Skip to content
Threat Feed
low advisory updated

Web Server Potential Command Injection via HTTP Requests

Threat actors are exploiting web application command injection vulnerabilities to execute arbitrary code by submitting crafted HTTP requests containing interpreter invocations, downloader utilities, or shell commands.

What's new

  • 1. new product Sep 19, 13:18 via elastic

Attackers are leveraging command injection vulnerabilities in web applications to achieve remote code execution and establish persistence. By submitting HTTP requests with crafted payloads in URL parameters, threat actors invoke interpreters (e.g., Python, Perl, Ruby, PHP) or shell commands (e.g., /bin/bash, /bin/sh) to gain control over the web server. This activity often aims to download secondary payloads, modify cron jobs, or exfiltrate sensitive files such as /etc/passwd or SSH keys. Because successful exploitation frequently returns a 200 OK status code, detection relies on identifying patterns of shell metacharacters and suspicious command-line utilities within request logs. This threat is particularly dangerous as it allows adversaries to operate within the context of the web server process, potentially leading to full host compromise or lateral movement if egress is not restricted.

Attack Chain

  1. Attacker identifies a web application vulnerability allowing user input to influence system commands or interpreter execution.
  2. Attacker crafts an HTTP request containing malicious command-line strings (e.g., curl, wget, bash -c) within the request URL or query parameters.
  3. The target web server receives the request and, due to insecure input handling, executes the command or interpreter payload as a child process of the web server (e.g., nginx, httpd, tomcat).
  4. The malicious process downloads additional stages or persistence mechanisms (e.g., reverse shells, web shells) from an external attacker-controlled server.
  5. The attacker modifies system files such as /etc/cron.* or injects code into the web root to ensure persistence.
  6. The attacker leverages the established persistence to perform reconnaissance, exfiltrate sensitive data, or open outbound connections to a command-and-control server.

Impact

Successful exploitation allows attackers to gain full control over the compromised web server, leading to data exfiltration, service disruption, and potential lateral movement into the internal network. The ability to modify system files and spawn reverse shells means that sensitive credentials, system configurations, and internal business data are at immediate risk.

Recommendation

Prioritized actions for detection engineering teams:

  • Implement request logging that captures the full original URL to enable identification of embedded shell metacharacters.
  • Correlate web server 200-series status codes with process creation logs (Event ID 1 on Windows, or equivalent process execution logs on Linux) to identify unauthorized child processes spawned by web server services.
  • Monitor for suspicious file modifications in web-accessible directories, /tmp, /dev/shm, and /etc/cron.* paths.
  • Enforce strict input validation on all web applications and disable unnecessary shell-out functions (e.g., PHP disable_functions) in the application runtime.
  • Restrict outbound network access from web servers to only approved destinations to prevent the download of malicious payloads and the establishment of reverse shells.

Immediate actions

Review web server access logs for requests containing /bin/bash, /bin/sh, or common interpreter flags in the URL

SOC 24h

Threat Hunt

Search logs for 200 HTTP responses originating from external IPs that contain shell metacharacters in the URL

T1059 high high confidence hunt now

Data: Web server access logs

Mitigations

Enable input sanitization and implement WAF filtering for known shell metacharacters and interpreter commands

immediate IT Operations

General command injection risk

Gaps

  • Requires fine-tuning to minimize false positives from legitimate application diagnostics