OpenHands is software for AI-driven development. Starting in version 1.5.0, 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. Version 1.5.0 fixes the issue.
https://owasp.org/www-community/attacks/Command_Injection
https://github.com/OpenHands/OpenHands/security/advisories/GHSA-7h8w-hj9j-8rjw
https://github.com/OpenHands/OpenHands/pull/13051
https://docs.python.org/3/library/subprocess.html#security-considerations