High, CVSS 7.6PyPIAmendedPublished
OpenHands is Vulnerable to Command Injection through its Git Diff Handler
CVE-2026-33718 · GHSA-7h8w-hj9j-8rjw
- Affected
- PyPI openhands-ai < 1.5.0
- Fixed in
- 1.5.0· Vendor fix available
- Issue
- A Command Injection vulnerability exists in the getgitdiff() method at openhands/runtime/utils/githandler.py:134. The path parameter from the /api/conversations/{conversationid}/git/diff API endpoint is passed unsanitized to a shell command, allowing authenticated attackers to execute arbitrary commands in the agent sandbox. The user is already allowed to instruct the agent to execute commands, but this bypasses the normal channels. --- Details Vulnerable Code Path The vulnerability flows through these files: 1. API Endpoint (openhands/server/routes/files.py:267-277) 2. Runtime (openhands/runtime/base.py:1231-1233) 3. Vulnerable Method (openhands/runtime/utils/githandler.py:10-12, 134) 4. Shell Execution (openhands/runtime/utils/gitdiff.py:25-27) Root Cause The filepath parameter is directly interpolated into a shell command string using Python's .format() method without any sanitization. When this command is executed with shell=True, shell metacharacters like ", ;, and are…
Recommended action: Upgrade to 1.5.0 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.