Skip to content

Instantly share code, notes, and snippets.

@hazcod
Last active October 21, 2026 07:36
Show Gist options
  • Select an option

  • Save hazcod/71712c0bfe5abf191cbc87245c27fcb8 to your computer and use it in GitHub Desktop.

Select an option

Save hazcod/71712c0bfe5abf191cbc87245c27fcb8 to your computer and use it in GitHub Desktop.
Sigma detection rule to detect suspicious PHP child processes.
title: Suspicious Process From PHP Web Worker
id: 795d944e-9fde-4879-87ba-42644396ed9f
status: experimental
description: |
Detects a suspicious operating-system process spawned by a PHP or web-server worker on Linux,
macOS, or Windows. This is strong behavioral evidence of command execution through a PHP web
request and can identify successful php2shell exploitation independently of the HTTP payload.
It requires process telemetry that supplies the executable path of both the child and parent
process. It does not detect payloads that execute entirely inside the PHP worker.
references:
- https://www.php.net/archive/2026.php#2026-10-20-1
- https://sigmahq.io/docs/basics/log-sources.html
- https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_webshell_detection.yml
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_webshell_susp_process_spawned_from_webserver.yml
author: php2shell-scan contributors
date: 2026-10-21
tags:
- attack.initial-access
- attack.execution
- attack.t1190
- attack.t1059
logsource:
category: process_creation
detection:
selection:
ParentImage|re|i: '.*[\\/](?:php(?:-fpm|-cgi)?[0-9.]*(?:\.exe)?|apache2|httpd(?:\.exe)?|nginx(?:\.exe)?|w3wp\.exe)$'
Image|endswith:
# Linux and macOS paths
- '/arp'
- '/ash'
- '/bash'
- '/busybox'
- '/cat'
- '/chmod'
- '/curl'
- '/dash'
- '/dscl'
- '/env'
- '/hostname'
- '/id'
- '/ifconfig'
- '/ip'
- '/ioreg'
- '/ksh'
- '/launchctl'
- '/nc'
- '/ncat'
- '/netstat'
- '/osascript'
- '/perl'
- '/plutil'
- '/powershell'
- '/pwsh'
- '/python'
- '/python3'
- '/ruby'
- '/scutil'
- '/security'
- '/sh'
- '/socat'
- '/system_profiler'
- '/uname'
- '/wget'
- '/whoami'
- '/zsh'
# Windows paths
- '\arp.exe'
- '\bash.exe'
- '\bitsadmin.exe'
- '\certutil.exe'
- '\cmd.exe'
- '\cscript.exe'
- '\curl.exe'
- '\hostname.exe'
- '\mshta.exe'
- '\nbtstat.exe'
- '\nc.exe'
- '\ncat.exe'
- '\net.exe'
- '\net1.exe'
- '\netsh.exe'
- '\netstat.exe'
- '\nltest.exe'
- '\powershell.exe'
- '\powershell_ise.exe'
- '\pwsh.exe'
- '\python.exe'
- '\python3.exe'
- '\reg.exe'
- '\regsvr32.exe'
- '\ruby.exe'
- '\rundll32.exe'
- '\sh.exe'
- '\systeminfo.exe'
- '\whoami.exe'
- '\wmic.exe'
- '\wscript.exe'
condition: selection
fields:
- Image
- CommandLine
- ParentImage
- ParentCommandLine
- User
falsepositives:
- PHP or web applications that intentionally launch command-line programs or administrative jobs
level: high
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment