GHSA-4v5g-8pq2-32m2: By-passing Protection of PharStreamWrapper Interceptor
Noroxi assessment
Priority: Monitor (action score 0/100)
- The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
- Fixed version: typo3/phar-stream-wrapper (Packagist) 2.0.1, 3.0.1.
Low priority for now. Upgrade to typo3/phar-stream-wrapper (Packagist) 2.0.1, 3.0.1 or later.
Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it
Primary sources: OSV
Insecure deserialization is a vulnerability which occurs when untrusted data is used to abuse the logic of an application. In July 2018, the vulnerability of insecure deserialization when executing Phar archives was addressed by removing the known attack vector in the TYPO3 core. For more details read the corresponding TYPO3 advisory. In addition, a new interceptor was introduced to protect possible (but unknown) vulnerabilities in 3rd party components like TYPO3 extensions. Basically, the PharStreamWrapper intercepts direct invocations of Phar archives and allows or denies further processing based on individual rules. Recently, the PharStreamWrapper was extracted from the TYPO3 core and released as standalone package under the MIT license. It is now available for any PHP driven project. The stream wrapper overwrites the existing Phar handling of PHP, applies its own assertions and then restores the native PHP Phar handling for the corresponding commands (e.g. file_exists, include, fopen) to continue processing. After that, the native PHP Phar handling gets disabled and is overwritten by the logic of the PharStreamWrapper again. This is the only way to control invocations of Phar archives as PHP only allows a single handler for each corresponding stream. We were informed that exception and error handlers in custom applications (e.g. TYPO3 extensions) sometimes didn't return to the original operating sequence of the PharStreamWrapper. A possible consequence was that the unprotected native PHP Phar handling remained active and therefore became vulnerable for the basic issue of insecure deserialization again. Examples Take a look at the following examples showing how the handling is by-passed in custom application code. Scenario A: Exception thrown from code organized in a Phar archive ``` try { include('phar://path-to-archive/good-archive.phar'); } catch (\Throwable $throwable) { // not doing much here, continue execution } // the insecure value can be anything that is or was user-submitted // and cannot be trusted in terms of security, $_GET is just used as example $insecureValue = $_GET['path']; // the value might be 'phar://path-to-archive/malicious-archive.phar' file_exists($insecureValue); ``` Scenario B: Errors converted to exceptions and thrown when interacting with archive contents ``` // set error handler in order to convert errors to exceptions set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); }); // interacting with Phar archive try { $resource = opendir('phar://path-to-archive/good-archive.phar/non-existing-path/'); closedir($resource); } catch (\Throwable $throwable) { // not doing much here, continue execution } // the insecure value can be anything that is or was user-submitted // and cannot be trusted in terms of security, $_GET is just used as example $insecureValue = $_GET['path']; // the value might be 'phar://path-to-archive/malicious-archive.phar' file_exists($insecureValue); ```
- Published
- Jun 5, 2024
- Updated
- Dec 2, 2024
- EPSS
- —
- CWE
- CWE-502
Report tools
Action score
0
Low priority for now.
- CVSS
- 0 / 40 · —
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 0 / 30 · —
Get told when this record changes
- Not in KEV: no record of exploitation in the wild
- No public exploit code on record
- A fix has been released
If any of these changes, we'll tell you in the daily email digest.
Is your version affected? Check itNoroxi analysis
What does it mean in your environment?
The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.
We use this product, ask for helpAffected systems
Is your version affected?
Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.
| Vendor | Product | CPE |
|---|---|---|
| Packagist | typo3/phar-stream-wrapper | pkg:composer/typo3/phar-stream-wrapper |
Package-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Packagist | typo3/phar-stream-wrapper | from 1.0.0 · before 2.0.1 | 2.0.1 |
| Packagist | typo3/phar-stream-wrapper | from 3.0.0 · before 3.0.1 | 3.0.1 |
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| Packagist:typo3/phar-stream-wrapper | 2.0.1 | Package registry (OSV) |
| Packagist:typo3/phar-stream-wrapper | 3.0.1 | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
Not on record for this CVE: EPSS history · patch commit or PR link · researcher credit · variant or chain candidate · public bounty program.
Technical details
No CVSS vector for this record, so attack conditions can't be derived.
Weakness class (CWE)
CWE-502 · Deserialization of Untrusted DataRoot cause
Data received over the network is deserialized into the language’s native object format without verifying its source. Code paths inside the object can be triggered during deserialization.
The bug in code
The whole CWE-502 classA representative example of this vulnerability class. Not the vendor's source code; it shows the faulty pattern and its fix.
Vulnerable
payload = sock.recv(65536)
job = pickle.loads(payload)Fixed
payload = sock.recv(65536)
if not hmac.compare_digest(sign(payload), header_sig):
raise PermissionError("invalid signature")
job = JobSchema.validate(json.loads(payload))Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
Attack patterns (CAPEC)
ATT&CK techniques
—
Change log (2)
- Fix✗ → ✓
- CVSS5.5 → —
For records you follow, these changes also arrive as notifications. →
References
Show all references (1 more)Show less
Vendor advisories and official records. Exploit/PoC links are deliberately left out.