title: PHP Worker Process Spawning a Shell or Download Tool
id: 7f3c1e2a-9b44-4d6e-8c2f-1a2b3c4d5e6f
status: experimental
description: |
    Detects a PHP SAPI worker (php-fpm, php-cgi, mod_php) spawning an interactive
    shell or a download utility. This is the expected post-exploitation behaviour of
    a PHP RCE such as CVE-2026-109618 / CVE-2026-109619, where the attacker turns
    code execution into a command shell on the host. The parent match uses a contains
    on "php" so that versioned binaries such as php-fpm8.2 are covered.
references:
    - https://www.huntress.com/blog/php2shell-leaked-critical-php-vulnerabilities
    - https://sansec.io/research/php2shell
author: Chabnco (PurpleLog)
date: 2026-10-21
tags:
    - attack.execution
    - attack.t1059.004
    - attack.initial-access
    - attack.t1190
logsource:
    category: process_creation
    product: linux
detection:
    selection_parent:
        ParentImage|contains: '/php'
    selection_child:
        Image|endswith:
            - '/sh'
            - '/bash'
            - '/dash'
            - '/zsh'
            - '/curl'
            - '/wget'
            - '/python3'
            - '/perl'
            - '/nc'
            - '/ncat'
    filter_sendmail:
        CommandLine|contains: '/sendmail'
    condition: selection_parent and selection_child and not filter_sendmail
falsepositives:
    - Applications that legitimately shell out (imagemagick wrappers, backup or deploy scripts, some CMS plugins)
    - Mail delivery via sendmail, excluded above
level: high
