Nokia BMC Log Scanner - Remote Code Execution
# Exploit Title: Nokia BMC Log Scanner Remote Code Execution
# Google Dork: N/A
# Date: November 29, 2023
# Exploit Author: Carlos Andres Gonzalez, Matthew Gregory
# Vendor Homepage: https://www.nokia.com/
# Software Link: N/A
# Version: 13
# Tested on: Linux
# CVE : CVE-2022-45899
Description
The BMC Log Scanner web application, available on several hosts, is vulnerable to command injection
attacks, allowing for unauthenticated remote code execution. This vulnerability is especially significant
because this service runs as root.
Steps to Reproduce:
In the Search Pattern field, type:
;";command
Replacing the word "command" above with any Linux command.
Root access can be confirmed with the id command or any other command that would require
root access, such as displaying the contents of the /etc/shadow file."
This issue was fixed in version 13.1. Nokia BMC Log Scanner — Remote Code Execution (CVE-2022-45899)
This article analyzes CVE-2022-45899, a critical unauthenticated command injection vulnerability in the Nokia BMC (Baseboard Management Controller) Log Scanner web application. The vulnerable component allowed unsanitized data from a web form to reach a shell context, enabling remote code execution (RCE) as the root user. The issue was fixed in Nokia BMC Log Scanner version 13.1.
Summary and impact
The vulnerability is a classic command injection: a string from a web input field was embedded or executed by the backend in a way that allowed an attacker to append shell metacharacters and arbitrary commands. Because the service ran with root privileges, successful exploitation could lead to full system compromise including access to sensitive files, persistence, lateral movement, and disruption of managed devices.
- Affected versions: Nokia BMC Log Scanner version 13 (fixed in 13.1).
- Authentication: Unauthenticated (remote HTTP access to the web UI).
- Privilege: Service ran as root — full system privileges possible.
- CVE: CVE-2022-45899.
How command injection vulnerabilities typically work (technical overview)
Command injection arises when user-controlled input is incorporated into shell commands without proper sanitization or isolation. Common unsafe patterns include building a command string and executing it with a shell interpreter (for example, using system(), popen() or shell=True in high-level languages). Attackers inject shell metacharacters or command separators to break out of the intended context and execute arbitrary commands.
In affected BMC Log Scanner implementations, a web field intended to constrain a log search (a “search pattern”) was forwarded into code paths that ultimately invoked a shell, enabling crafted input to be interpreted as additional commands. Because the process executed as root, the consequences were severe.
Real-world risk and use cases
- Complete host compromise: attacker gains root shell and can control the BMC host OS.
- Persistence and firmware manipulation: attacker may persist, change firmware, or alter logging and monitoring components to evade detection.
- Lateral pivoting: from an elevated BMC host, attackers can discover and attack other devices on management networks.
- Regulatory and business impact: potential exposure of credentials, device configurations, and customer data.
Detection and Indicators of Compromise (IoCs)
Detecting exploitation requires observability at the network, web, process, and file layers. Look for anomalous requests to the Log Scanner web interface, unusual process executions, and unexpected outbound connections originating from the BMC host.
- Web logs: POST/GET requests to the log search endpoint carrying unusual characters or sequences within the search parameter. Consider flagging requests that include shell metacharacters.
- Process and command execution logs: new or unexpected processes spawned by the web service account, especially those invoking shells (/bin/sh, /bin/bash) or netcat/SSH clients.
- System logs: abrupt changes to system files, new user accounts, or modifications to authentication files.
- Network indicators: connections to attacker-controlled infrastructure immediately after suspicious web requests.
Example heuristic (non-exploit, detection-focused): look for requests containing characters often used in command injection such as ; | & ` $ > < and backticks, or percent-encoded variants, and correlate with unexpected process starts within a short time window.
Mitigation and remediation
The primary remediation is to upgrade the affected software to Nokia BMC Log Scanner version 13.1 or later. If immediate patching is not possible, apply layered compensating controls:
- Network-level restrictions: limit access to the BMC Log Scanner web interface to trusted management networks and specific IP ranges using firewalls, VPNs, or ACLs.
- Web application firewall (WAF): deploy rules blocking requests that contain shell metacharacters or suspicious payloads targeted at the search parameter. Use conservative rules initially and tighten after testing to avoid false positives.
- Service hardening: run the service with least privilege (avoid running as root), apply OS-level hardening and reduce available toolset on the host (remove compilers, shells, and common network tools where possible).
- Monitoring and auditing: enable detailed web server logs, process accounting, auditd, and endpoint monitoring. Alert on processes spawned by the web service user that are uncommon for normal operation.
- Temporary disablement: if the instance is internet-facing and cannot be adequately protected, consider disabling the web interface until patched.
Secure coding practices to prevent command injection
At the development level, prevent command injection by avoiding shell interpretation entirely or by strictly validating and isolating input. Key approaches:
- Use library APIs instead of shell tools (e.g., parse logs using native libraries, not shell utilities).
- If a subprocess is necessary, use process APIs that accept argument lists and set shell=False (no shell expansion).
- Implement allowlists (preferred) for pattern inputs rather than blacklists; only allow expected characters/formats.
- Escape user input properly when passing to system utilities (as a defense-in-depth measure), but do not rely solely on escaping.
- Run services with minimal privileges — never as root unless strictly required.
Below are defensive code examples demonstrating safer approaches.
# Python: safe subprocess use (do not use shell=True)
import subprocess
def run_log_query(pattern):
# Validate the pattern using an allowlist: only alphanumerics, spaces, dashes, and underscores
import re
if not re.fullmatch(r'[A-Za-z0-9 _-]{0,200}', pattern):
raise ValueError("Invalid search pattern")
# Use a list of arguments and avoid invoking a shell
cmd = ['/usr/bin/logtool', '--search', pattern]
result = subprocess.run(cmd, capture_output=True, text=True, check=False)
return result.stdout
Explanation: This Python example performs allowlist validation on the "pattern" input and invokes an external program using an argument list with subprocess.run while leaving shell=False (the default). Because an argument list is used, the runtime will not interpret shell metacharacters contained in pattern, preventing command injection. The allowlist validation reduces unexpected characters and length, further reducing risk.
-- Example WAF rule pseudo-logic (illustrative, not copy-paste for production)
IF http.request.uri.path CONTAINS "/logscanner/search" AND
http.request.body.search_pattern MATCHES /[;|&`$><]/
THEN block_request AND alert
Explanation: This pseudo-rule blocks requests to the log search endpoint that contain suspicious shell metacharacters in the search parameter. It is an example of an intrusion prevention approach. When implementing in a real WAF, tune rules carefully to balance detection and false positives, and log events for forensic review.
Forensics and incident response
- Capture full web server and application logs, and preserve system images if compromise is suspected.
- Search for newly created accounts, modified cron jobs, or unexpected SSH keys and authorized_keys entries.
- Collect process accounting and audit logs; identify command lines spawned by the web service process.
- Isolate affected hosts from production networks to prevent lateral movement.
- Perform a complete rebuild from trusted images if persistence or kernel-level compromise is confirmed.
SIEM and detection queries (examples)
Below are conceptual query examples to generate alerts. Adapt to your environment's fields and log formats. These are detection-focused and do not include exploit payloads.
# Splunk-like pseudo query: detect suspicious search requests
index=web_logs sourcetype=access_combined
uri_path="/logscanner/search"
| where match(_raw, "search_pattern=.*[;|&`$]")
| stats count by client_ip, _time, uri_path
Explanation: This SIEM example looks for web access logs targeting the log scanner search endpoint where the raw request contains common shell metacharacters. Use percent-decoding and canonicalization before matching to detect encoded attempts.
Disclosure history and remediation status
Vendors and administrators should rely on Nokia advisories and CVE records for authoritative timelines and patch availability. As referenced publicly, Nokia released a fix in version 13.1. Administrators should verify the version running on their equipment and apply vendor-supplied updates as soon as possible.
Practical remediation checklist
| Action | Priority |
|---|---|
| Upgrade Nokia BMC Log Scanner to 13.1 or later | Critical |
| Restrict management interface access (firewall/VPN) | High |
| Deploy WAF rules to block suspicious search input | High (temporary) |
| Run service as least-privileged user (avoid root) | High |
| Enable auditing, endpoint protection, and alerting | High |
| Perform integrity checks and forensic review if compromise suspected | Critical |
Key takeaways
- Command injection vulnerabilities in management interfaces are high impact, especially when services run as root.
- Patch promptly — Nokia fixed this issue in 13.1 — and apply network-level controls to limit exposure.
- Defensive measures include input allowlisting, avoiding shell usage, running with least privilege, and improving monitoring/alerting.
- When investigating suspected exploitation, preserve logs and system images and assume full compromise until proven otherwise.