Executive brief
simple-git is a popular Node.js library used by developers to automate Git commands within their applications. A security flaw allows an attacker to execute unauthorized commands on the server by providing a specially crafted Git repository URL. This could lead to a full system compromise, data theft, or service disruption.
Technical details
The simple-git library before version 3.5.0 is vulnerable to command injection (specifically argument injection, CWE-88). This occurs because the library fails to properly sanitize or block the '--upload-pack' argument when executing 'git clone' operations. While a previous fix (CVE-2022-24433) addressed this for 'git fetch', the 'git clone' vector remained open. An attacker can provide a malicious URL or argument list containing '--upload-pack' followed by arbitrary shell commands, which Git then executes. This can be exploited remotely if the application accepts user-supplied repository URLs. The vulnerability is fixed in version 3.5.0.
Affected products
- steveukx simple-git < 3.5.0
Timeline
- 2022-03-27: other: Proof of concept published by researcher
- 2022-03-29: patched: Version 3.5.0 released
- 2022-04-01: disclosed: NVD publication date
- 2022-04-02: advisory: GitHub Advisory published
References
- https://github.com/steveukx/git-js/commit/2040de601c894363050fef9f28af367b169a56c5
- https://gist.github.com/lirantal/a930d902294b833514e821102316426b
- https://github.com/steveukx/git-js
- https://github.com/steveukx/git-js/releases/tag/simple-git%403.5.0
- https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-2434820
- https://snyk.io/vuln/SNYK-JS-SIMPLEGIT-2434306