COMMAND INJECTIONS

DETECTING SUSPICIOUS WEB CMDS

Search for HTTP requests that might show malicious activity; searches the web access logs for any HTTP requests that include signs of command execution attempts, such as cmd.exe, PowerShell, or Invoke-Expression

SPLUNK> Search
 QUERY: index=windows_apache_access (cmd.exe OR powershell OR "powershell.exe" OR "Invoke-Expression") | table _time host clientip uri_path uri_query status
 DTG: All time

 _time	              host	        clientip	  uri_path	          uri_query                                                                                         status
 2025-10-27 04:37:36	WebAppServer	10.9.0.217	/cgi-bin/hello.bat	cmd=powershell.exe+-enc+VABoAGkAcwAgAGkAcwAgAG4AbwB3ACAATQBpAG4AZQAhACAATQBVAEEASABBAEEASABBAEEA	200
 2025-10-26 21:47:59	WebAppServer	10.9.0.217	/cgi-bin/hello.bat	cmd=cmd.exe	                                                                                      200
 2025-10-26 21:48:33	WebAppServer	10.9.0.217	/cgi-bin/hello.bat	cmd=powershell.exe+-enc+VABoAGkAcwAgAGkAcwAgAG4AbwB3ACAATQBpAG4AZQAhACAATQBVAEEASABBAEEASABBAEEA	200
 2025-10-27 04:39:10	WebAppServer	10.9.0.217	/cgi-bin/hello.bat	cmd=powershell.exe+-enc+VABoAGkAcwAgAGkAcwAgAG4AbwB3ACAATQBpAG4AZQAhACAATQBVAEEASABBAEEASABBAEEA	200

* This query helps identify possible Command Injection attacks, where the evil attacker tries to execute system commands through a vulnerable CGI script (hello.bat)
    - does this query identify obfuscated cmds like base64 or just plain as is characters
                - cmd or powershell will be captured unencoded

MALICIOUS ENCODED STRINGS

This will identify any or all potentially malicious encoded strings

DECODING ENCODED STRINGS

This traces suspicious process creation (HOST) from Apache. Explore Sysmon for other malicious executable files that the web server might have spawned

IDENTIFYING ENUMERATION ACTIVITY

This is how to confirm attacker enumeration activity (post-exploitation reconnaissance) - powershell specific. The aim is to discover specific programs found from previous queries "tracing suspicious process creation (host) from apache

IDENTIFYING BASE64 ENCODED PAYLOADS (POWERSHELL)

Last updated