Symfony: The Serializer Builds UploadedFile Objects From Request Data, Letting a Client Point an Upload at Any Server FileGHSA-h38r-xrmh-cwhr
Fix: symfony/symfony@72ece5bGHSA-h38r-xrmh-cwhr is a CWE-73 vulnerability in symfony/serializer. A fix is available for symfony/serializer — see the affected versions and patch details below.
Exploitation Status
No confirmed exploitation observed yet
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
- A successful exploit gives an attacker total control of the affected component, not partial access.
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for GHSA-h38r-xrmh-cwhr.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
symfony/serializer🐘symfony/serializer🐘symfony/serializer🐘symfony/serializer🐘symfony/symfony🐘symfony/symfony🐘symfony/symfony🐘symfony/symfonyReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
Description
DataUriNormalizer builds \SplFileInfo, \SplFileObject and Symfony\Component\HttpFoundation\File\File objects from data URIs, for those exact types only. A property typed with a subclass of them, like UploadedFile, was left to ObjectNormalizer, which instantiated it through its constructor from the denormalized data, path, original name and test flag included. With #[MapRequestPayload] and a DTO holding an UploadedFile property, which is how uploads are mapped in Symfony 8.1, a request needs no upload at all to make the application handle any file of the server as one:
{"name": "x", "image": {"path": "/path/to/project/.env.local", "originalName": "a.png", "test": true}}
The same works with a form body, and with any code that deserializes untrusted data into a type holding such a property, on every maintained branch. test: true makes UploadedFile::isValid() skip is_uploaded_file() and move() fall back to rename(); code that reads the file without calling isValid() does not even need it. Depending on what the application does with the upload, this exposes any file readable by PHP, for instance when uploads are stored and served back, moves any such file when move() is called as the upload documentation shows, and reveals whether a path exists. Assert\File does not prevent it, since it validates the real server file.
Resolution
DataUriNormalizer now handles every subclass of \SplFileInfo as well: it passes through an instance of the expected type, as the files of a request are, and rejects any other data with a NotNormalizableValueException, which #[MapRequestPayload] turns into a 422. File, \SplFileInfo and \SplFileObject are still built from data URIs when the type is spelled as their ::class constant. Any other spelling of these classes, like a leading backslash, a different case or a class alias, is handled like a subclass.
A serializer built without DataUriNormalizer ahead of the object normalizer does not get this protection; the serializer configured by FrameworkBundle has it.
The patches for this issue are available here for branch 5.4 and here for branch 6.4 (and forward-ported to 7.4, 8.1 and 8.2).
Credits
Symfony would like to thank Oliver Wenzel for reporting the issue and Nicolas Grekas for providing the fix.
Symfony would also like to thank Bruno Dias and Miguel Neves from Checkmarx for their help getting a CVE assigned.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | symfony/serializer | all versions | 5.4.56composer require symfony/serializer:^5.4.56 |
| 🐘Packagist | symfony/serializer | ≥ 6.0.0&&< 6.4.50 | 6.4.50composer require symfony/serializer:^6.4.50 |
| 🐘Packagist | symfony/serializer | ≥ 7.0.0&&< 7.4.23 | 7.4.23composer require symfony/serializer:^7.4.23 |
| 🐘Packagist | symfony/serializer | ≥ 8.0.0&&< 8.1.11 | 8.1.11composer require symfony/serializer:^8.1.11 |
| 🐘Packagist | symfony/symfony | all versions | 5.4.56composer require symfony/symfony:^5.4.56 |
| 🐘Packagist | symfony/symfony | ≥ 6.0.0&&< 6.4.50 | 6.4.50composer require symfony/symfony:^6.4.50 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for symfony/serializer, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update symfony/serializer to 5.4.56 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-h38r-xrmh-cwhr is resolved across your whole dependency graph.
Workarounds
Do not deserialise data from untrusted sources: where the format allows it, restrict deserialisation to an explicit allowlist of expected types, and prefer a data-only format (JSON, Protobuf) over one that can reconstruct arbitrary objects until you can upgrade.
Frequently Asked Questions
Is GHSA-h38r-xrmh-cwhr in your dependencies?
Find it across Packagist, including transitive dependencies.