CVE-2023-37154

8.4 HIGH

📋 TL;DR

CVE-2023-37154 is a command injection vulnerability in Nagios check_by_ssh plugin that allows attackers to execute arbitrary commands on the monitoring server. This affects systems using check_by_ssh with vulnerable configurations, potentially allowing attackers to gain control of the monitoring infrastructure.

💻 Affected Systems

Products:
  • Nagios Plugins
  • Monitoring Plugins
Versions: nagios-plugins 2.4.5 and earlier versions
Operating Systems: Linux, Unix-like systems
Default Config Vulnerable: ✅ No
Notes: Requires check_by_ssh plugin usage with specific SSH configurations that allow ProxyCommand, LocalCommand, or PermitLocalCommand with ${IFS} expansion.

⚠️ Manual Verification Required

This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.

Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).

🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.

Recommended Actions:
  1. Review the CVE details at NVD
  2. Check vendor security advisories for your specific version
  3. Test if the vulnerability is exploitable in your environment
  4. Consider updating to the latest version as a precaution

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete compromise of monitoring server leading to lateral movement across monitored infrastructure, data exfiltration, and persistent backdoor installation.

🟠

Likely Case

Unauthorized command execution on monitoring server, potentially leading to service disruption, credential theft, or further network penetration.

🟢

If Mitigated

Limited impact with proper input validation and restricted SSH configurations, potentially only affecting specific plugin functionality.

🌐 Internet-Facing: MEDIUM - Requires SSH access to monitoring server, but many monitoring systems are not directly internet-facing.
🏢 Internal Only: HIGH - Monitoring servers often have privileged access to internal systems, making successful exploitation particularly dangerous.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires SSH access to the monitoring server and specific plugin configuration. Public technical details and proof-of-concept are available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Fixed in commit e8810de21be80148562b7e0168b0a62aeedffde6

Vendor Advisory: https://github.com/monitoring-plugins/monitoring-plugins/security/advisories/GHSA-p3gv-vmpx-hhw4

Restart Required: No

Instructions:

1. Update nagios-plugins to version containing commit e8810de or later. 2. For Nagios Plugins: git pull from repository and rebuild. 3. For Monitoring Plugins: Update to latest version from official repositories.

🔧 Temporary Workarounds

Disable vulnerable SSH options

linux

Configure SSH to disallow ProxyCommand, LocalCommand, and PermitLocalCommand in check_by_ssh usage

# In ssh_config or sshd_config: PermitLocalCommand no
# For check_by_ssh calls: Use -o options to restrict SSH features

Restrict check_by_ssh usage

linux

Limit check_by_ssh plugin usage to trusted hosts only and implement strict input validation

# In Nagios configuration: define command { command_line /usr/lib/nagios/plugins/check_by_ssh -H $HOSTADDRESS$ -C '$ARG1$' }
# Ensure $ARG1$ is properly sanitized

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate monitoring servers from critical infrastructure
  • Deploy application control to restrict command execution from check_by_ssh processes

🔍 How to Verify

Check if Vulnerable:

Check if check_by_ssh plugin version is 2.4.5 or earlier and if SSH configurations allow command injection via ${IFS}

Check Version:

check_by_ssh --version 2>&1 | head -1

Verify Fix Applied:

Verify nagios-plugins version includes commit e8810de or test with known payloads that should no longer execute

📡 Detection & Monitoring

Log Indicators:

  • Unusual command execution patterns from check_by_ssh processes
  • SSH connections with suspicious ProxyCommand or LocalCommand parameters
  • Unexpected process spawns from Nagios monitoring user

Network Indicators:

  • Anomalous outbound connections from monitoring server
  • SSH traffic patterns inconsistent with normal monitoring

SIEM Query:

source="nagios.log" AND "check_by_ssh" AND ("ProxyCommand" OR "LocalCommand" OR "PermitLocalCommand")

🔗 References

📤 Share & Export