This rule detects adversaries deploying legacy command-and-control mechanisms via a cmd.jsp web shell to establish persistent access and execute remote commands within the environment. The SOC team should proactively hunt for this artifact in Azure Sentinel because outdated JSP-based tools often contain known vulnerabilities that attackers leverage to maintain stealthy footholds and facilitate lateral movement across cloud resources.
rule sig_238_cmd_2 {
meta:
description = "Disclosed hacktool set (old stuff) - file cmd.jsp"
author = "Florian Roth"
date = "23.11.14"
score = 60
hash = "be4073188879dacc6665b6532b03db9f87cfc2bb"
strings:
$s0 = "Process child = Runtime.getRuntime().exec(" ascii
$s1 = "InputStream in = child.getInputStream();" fullword ascii
$s2 = "String cmd = request.getParameter(\"" ascii
$s3 = "while ((c = in.read()) != -1) {" fullword ascii
$s4 = "<%@ page import=\"java.io.*\" %>" fullword ascii
condition:
all of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 5 string patterns in its detection logic.
Here are 5 specific false positive scenarios for the “Disclosed hacktool set (old stuff) - file cmd.jsp” detection rule, including suggested filters and exclusions:
Legacy Application Deployment via Jenkins Pipeline
jenkins user) extracts a WAR file which includes a standard cmd.jsp utility used for command-line diagnostics within the application container.java.exe or mvn.exe and the source path matches the deployment directory (e.g., C:\Jenkins\workspace\app-deploy\).Scheduled Maintenance Job for Tomcat Health Checks
cmd.jsp) located in the webapps/ROOT directory to trigger internal garbage collection and log rotation reports.System or Network Service account where the file path contains \tomcat\webapps\ROOT\WEB-INF\jsp\cmd.jsp.Database Backup Utility Execution
cmd.jsp file to log connection parameters and execute pre-flight checks before initiating the full backup stream.vbr.exe, commvault_agent.exe, or similar known backup agents