This detection identifies adversary behavior where a malicious web shell named pwhash.php is deployed to establish persistence and execute commands on compromised web servers. A SOC team should proactively hunt for this artifact in Azure Sentinel because such shells often serve as an initial foothold for attackers to escalate privileges, exfiltrate sensitive data, or move laterally within the network before triggering broader alerts.
rule webshell_phpshell_2_1_pwhash {
meta:
description = "Web Shell - file pwhash.php"
license = "Detection Rule License 1.1 https://github.com/Neo23x0/signature-base/blob/master/LICENSE"
author = "Florian Roth (Nextron Systems)"
date = "2014/01/28"
score = 70
hash = "ba120abac165a5a30044428fac1970d8"
id = "393e738a-b4c2-5630-a55f-c3caee4ff75e"
strings:
$s1 = "<tt> </tt>\" (space), \"<tt>[</tt>\" (left bracket), \"<tt>|</tt>\" (pi"
$s3 = "word: \"<tt>null</tt>\", \"<tt>yes</tt>\", \"<tt>no</tt>\", \"<tt>true</tt>\","
condition:
1 of them
}
This YARA rule can be deployed in the following contexts:
This rule contains 2 string patterns in its detection logic.
Here are 5 specific false positive scenarios for the Web Shell - file pwhash.php detection rule, including targeted filters and exclusions:
Scenario: Automated Password Hash Migration Script
pwhash.php in the /var/www/html/migration/ directory as part of the staging workflow.svc-iam-migrate) within the migration subdirectory, or filter out events where the user agent is identified as Ansible-Pull or PowerShell Core.Scenario: CI/CD Pipeline Artifact Deployment
pwhash.php to the web root (/var/www/html/tools/) to validate hash integrity before the main application release. This file is generated dynamically and deleted immediately after the pipeline completes.10.20.50.x) or filter by process name where the parent process is jenkins-agent or gitlab-runner.Scenario: Third-Party Security Scanning Tool
pwhash.php file in the web server’s document root to test specific hashing algorithms and verify SSL/TLS configurations against password storage mechanisms.