Linux Process Creation: PHP CLI Inline Code Using fsockopen with -r

Alerts on Linux executions of php -r inline code that references fsockopen, consistent with outbound reverse-shell style socket creation.

FreeReviewedSigma · High · v2
Product
linux
Category
process_creation
Author
@d4ns4n_ (SigmaHQ), DRL 1.1
Published
2023-04-07
Updated
2026-07-31

What it detects

This rule flags Linux process executions where the command line invokes the PHP CLI from a path containing “/php” with the “-r” option to run inline PHP code. It specifically matches inline code that includes the “fsockopen” function, indicating socket creation capability often used for remote command or reverse-shell style connectivity. It relies on process creation telemetry containing the image path and full command line, plus string matching for “-r” and “fsockopen”.

Changelog

v2
  1. v2
    Candidate ingested via manual entry.2026-07-31
  2. v1
    No changelog recorded for this version.2026-07-30

Detection content is published as a reviewed draft. Tune thresholds and exclusions against your own telemetry before enabling this rule for alerting.