This detection identifies potential web shell deployments where adversaries establish a persistent backdoor via a newly created redcod.php file to enable remote command execution and data exfiltration. Proactive hunting for this artifact in Azure Sentinel is critical because web shells often serve as the initial foothold for lateral movement, allowing attackers to maintain stealthy access even after the initial compromise vector has been remediated.
rule webshell_PHP_redcod {
meta:
description = "Web Shell - file redcod.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 = "5c1c8120d82f46ff9d813fbe3354bac5"
id = "393e738a-b4c2-5630-a55f-c3caee4ff75e"
strings:
$s0 = "H8p0bGFOEy7eAly4h4E4o88LTSVHoAglJ2KLQhUw" fullword
$s1 = "HKP7dVyCf8cgnWFy8ocjrP5ffzkn9ODroM0/raHm" fullword
condition:
all 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 redcod.php detection rule, including tailored filters and exclusions:
Scenario: Legitimate CMS Plugin Updates via Scheduled Tasks
redcod.php to the /wp-content/plugins/ directory on an Apache/Nginx web server. The file is created by a known service account (svc-deploy) rather than a user interaction, mimicking the behavior of a dropped web shell.Process_Name matches ansible-playbook, cron, or systemd-tmpfiles AND the Source_Directory contains /wp-content/plugins/. Additionally, whitelist the specific SHA256 hash of the known good redcod.php artifact used in the deployment pipeline.Scenario: Developer Deployment via CI/CD Pipeline
redcod.php (a reporting utility) into the production web root (/var/www/html/reports). This is a standard part of the release workflow triggered by a GitHub Actions run, not an anomalous user upload.Parent_Process_Name is jenkins-agent, gitlab-runner, or github-actions. Ensure the User_Account matches the CI service identity (e.g., svc-cicd) and the destination path includes /var/www/html/.Scenario: Automated Backup and Restoration Routine