[ ezo labs // research ]
OpenHands 1.5.0 still executes the branch name its own fix left unquoted
CVE-2026-33718’s fix quoted the caller’s path and the git show argument. The repository’s own branch name is still interpolated into a shell=True command in the same handler, on the version the…
contentsSummary
abstract
OpenHands’ Git diff handler builds shell strings. The fix for CVE-2026-33718 (GHSA-7h8w-hj9j-8rjw) quoted the caller’s path at git_handler.py:141 and the ref:path argument of git show in the new `_make_git_show_cmd`, and it left `git --no-pager rev-parse --verify {ref}` at git_diff.py:76 interpolated with shell=True. `ref` is `origin/<current branch>`, and git permits `;`, `"`, `>` and `#` in a ref name. We executed the released 1.5.0 sdist, the version the advisory calls patched, and 1.6.0: a branch named `main;id>"/tmp/oh-branch-marker";#` writes its marker while `get_git_diff()` returns a normal diff and `get_git_changes()` a normal change list. A clean branch and the advisory’s own path payload produce no marker. The handler is gone from 1.7.0, removed with the V0 runtime; the input ends there by removal, not by a quoting change.
Summary
The published advisory names 1.5.0 as the patched release. On 1.5.0, the branch name the same handler reads is still a shell fragment.
The gap
The repository’s own branch name is interpolated into a shell=True command, so a branch named main;id>"/tmp/x";# executes a second command while get_git_diff() returns a normal diff.
openhands/runtime/utils/git_diff.py:49-50, 76:get_valid_ref()reads the repository’s branch name and interpolatesf'origin/{current_branch}'intorun(f'git --no-pager rev-parse --verify {ref}', repo_dir).openhands/runtime/utils/git_diff.py:35:run()issubprocess.run(args=cmd, shell=True).openhands/runtime/utils/git_changes.py:36-37, 63, 81: The sibling script repeats the same interpolation andshell=Truepattern.openhands/runtime/utils/git_handler.py:141: The 1.5.0 fix quotes the caller’spathhere and theref:pathargument atgit_diff.py:85-87; it does not touchgit_changes.pyor the branch interpolation atgit_diff.py:76.
Reproduction
The PyPI sdists were loaded verbatim (1.5.0 sha256 f056b253…, 1.6.0 sha256 883a5bc5…); GitHandler and the scripts were run with the runtime’s subprocess.run(args=cmd, shell=True); a git wrapper logged the argv git received.
With branch main;id>"/tmp/oh-branch-marker";#, get_git_diff('victim.txt') returns the normal two-line diff, exit 0, and writes the marker (sha256 6e03bce1…). The same branch through get_git_changes() returns [{"status":"M","path":"victim.txt"}] and writes the marker. 1.6.0 behaves identically; its three handler files are byte-identical to 1.5.0’s.
Impact
A repository whose branch name contains shell metacharacters executes a command of the branch author’s choosing in the OpenHands runtime when a diff or change list is requested. The caller sees a normal diff; the second command runs silently.
Affected versions
openhands-ai 1.5.0 and 1.6.0 ship the advisory’s named fix, and they are the two we executed; every earlier release that carries the same legacy runtime is affected too, and the unquoted interpolation is present in the 1.0.0, 1.1.0, 1.2.0, 1.2.1, 1.3.0 and 1.4.0 trees we read. 1.7.0 and later do not contain the handler. The advisory’s published range (affected <= 1.4.0 / patched 1.5.0) does not describe this input.
Fix status
Quote the ref at git_diff.py:76 and git_changes.py:63, or build the argv as a list and drop shell=True. The published 1.5.0 fix did not do this. No release quotes the branch name; 1.7.0 ends the input by deleting the handler.
The vendor’s record
No vendor reply since the advisory was filed on 2026-10-30. The published GHSA-7h8w-hj9j-8rjw is the authority for the class; the finding is the same handler’s other shell input, which the fix’s own remediation note (“proper argument array handling or rigorous path sanitization … to prevent command chaining”) covers.
Timeline
- 2026-10-30T18:51:38Z: Private report filed (
GHSA-wpxp-rv65-2h3j) - 2026-11-11T20:36:07Z: Publication ask posted (comment 369525)
- 2026-11-11T23:21:37Z: Class-anchored follow-up posted (comment 369706)
- 2026-11-12: Notice naming 2026-11-17T16:00Z as the planned publication
- 2026-11-24T06:36:19Z: This write-up published
- 2026-11-24: MITRE CNA-LR request submitted
References
- Command Injection in Git Diff Handler: https://github.com/OpenHands/OpenHands/security/advisories/GHSA-7h8w-hj9j-8rjw
- Private report: https://github.com/OpenHands/OpenHands/security/advisories/GHSA-wpxp-rv65-2h3j
Disclosure
This note is an independent write-up. It is published on 2026-11-24 as the public reference for a CVE request. The private advisory and this write-up describe the same defect; the vendor advisory named above is the authority where one exists.
revisionsfirst published , last updated
| date | change |
|---|---|
| First publication. |
cite this
EZO Labs Security. OpenHands 1.5.0 still executes the branch name its own fix left unquoted. EZO Labs Inc, research report EZO-R-2026-13, 24 November 2026. https://ezolabs.net/research/openhands-branch-name-command-injection
@techreport{openhandsbranchnamecommandinjection,
title = {OpenHands 1.5.0 still executes the branch name its own fix left unquoted},
author = {{EZO Labs Security}},
institution = {EZO Labs Inc},
type = {Research report},
number = {EZO-R-2026-13},
year = {2026},
month = nov,
url = {https://ezolabs.net/research/openhands-branch-name-command-injection}
}
licensed under CC BY 4.0.
next
-
The Relay Trap
Trying to keep pace with your AI agents is a loop you cannot win. The fix is not reviewing faster; it is changing what reaches you.
-
Budibase’s 4.0.0 blacklist fix reads three IPv6 transition forms and misses the fourth
Budibase’s GHSA-622v calls 4.0.0 patched for the IPv6 transition prefixes. extractEmbeddedIPv4 handles compatible, NAT64 and 6to4, not the RFC 2765 translated prefix.
-
django-guardian’s get_objects_for_user returns every object when two models share a permission codename
django-guardian tests global permissions by the bare app_label.codename string. When two models in one app share a codename, a user holding only one model’s permission passes the other model’s check…