Symfony: The Serializer Builds UploadedFile Objects From Request Data, Letting a Client Point an Upload at Any Server File
Published 1 Dec 2026 · Updated 1 Dec 2026
Affected packages
- Affected
- <5.4.56
- Fixed in
- 5.4.56
composer require symfony/serializer:^5.4.56- Affected
- >=6.0.0 <6.4.50
- Fixed in
- 6.4.50
composer require symfony/serializer:^6.4.50- Affected
- >=7.0.0 <7.4.23
- Fixed in
- 7.4.23
composer require symfony/serializer:^7.4.23- Affected
- >=8.0.0 <8.1.11
- Fixed in
- 8.1.11
composer require symfony/serializer:^8.1.11- Affected
- <5.4.56
- Fixed in
- 5.4.56
composer require symfony/symfony:^5.4.56- Affected
- >=6.0.0 <6.4.50
- Fixed in
- 6.4.50
composer require symfony/symfony:^6.4.50- Affected
- >=7.0.0 <7.4.23
- Fixed in
- 7.4.23
composer require symfony/symfony:^7.4.23- Affected
- >=8.0.0 <8.1.11
- Fixed in
- 8.1.11
composer require symfony/symfony:^8.1.11Which symfony/serializer does your project really install?
Works for private projects: the file is read in memory to run the scan and then dropped. Also reads composer.json.
Public repo?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Details
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.
Is GHSA-h38r-xrmh-cwhr in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected symfony/serializer, and gives you the command that fixes it.
More advisories for symfony/serializer
- MediumCVE-2026-122053Symfony: ObjectNormalizer Dotted-Key Property-Path Traversal Bypasses #[Ignore] on Nested Objects · 1 Dec 2026
- CriticalGHSA-j68w-pg49-f6vxSymfony XML decoding attack vector through external entities · 30 May 2024
- MediumCVE-2021-41270CSV Injection in symfony/serializer · 24 Nov 2021
References
- Linkgithub.com/symfony/symfony/security/advisories/GHSA-h38r-xrmh-cwhr
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-118515
- Linkgithub.com/symfony/symfony/commit/72ece5bb3084e8233325166357f85c8c0650ee86
- Linkgithub.com/symfony/symfony/commit/c459104eb18ebda31e112c5490970da3f30bd668
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/serializer/CVE-2026-118515.yaml
- Linkgithub.com/FriendsOfPHP/security-advisories/blob/master/symfony/symfony/CVE-2026-118515.yaml
- Packagegithub.com/symfony/symfony
- Linkgithub.com/symfony/symfony/releases/tag/v5.4.56
- Linkgithub.com/symfony/symfony/releases/tag/v6.4.50
- Linkgithub.com/symfony/symfony/releases/tag/v7.4.23
- Linkgithub.com/symfony/symfony/releases/tag/v8.1.11
- Linksymfony.com/cve-2026-118515
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.