8.4high
Symfony: The Serializer Builds UploadedFile Objects From Request Data, Letting a Client Point an Upload at Any Server File
- Severity
- 8.4high CVSS:4.0 by Checkmarx
- Exploit likelihood
- 0.54% (higher than 47% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Checkmarx
- Also known as
- GHSA-h38r-xrmh-cwhr
Description
The Symfony Serializer component DataUriNormalizer handles only the exact types SplFileInfo, SplFileObject, and File, so for a property typed with a subclass such as UploadedFile, ObjectNormalizer instantiates the object through its constructor from attacker-controlled data, including the file path. This allows an arbitrary file on the server to be treated as an uploaded file in Symfony versions prior to 5.4.56, 6.x prior to 6.4.50, 7.x prior to 7.4.23, and 8.x prior to 8.1.11. A request body such as {"image": {"path": "/path/to/project/.env.local", "originalName": "a.png", "test": true}} makes the application handle any file on the server as an upload, without the file being sent. With test: true, UploadedFile::isValid() skips is_uploaded_file() and move() falls back to rename(). Assert\File does not prevent this because it validates the file at the attacker-chosen path, which exists on the server. Any code that deserializes untrusted data into a type that holds such a property is affected. That includes #[MapRequestPayload] on a DTO with an UploadedFile property, which is how uploads are mapped in Symfony 8.1; a single unauthenticated request with a JSON or form body is enough. Depending on what the application does with the upload, this can expose any file readable by PHP (for instance, when uploads are stored and served back), move any such file when move() is called, and reveal whether a path exists. A serializer built without DataUriNormalizer ahead of the object normalizer is not protected by the fix; the serializer configured by FrameworkBundle is.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| symfony/serializer | before 5.4.56, from 6.0.0 before 6.4.50, from 7.0.0 before 7.4.23, from 8.0.0 before 8.1.11 | CVE List |
| symfony/serializer (Packagist) | before 5.4.56, from 6.0.0 before 6.4.50, from 7.0.0 before 7.4.23, from 8.0.0 before 8.1.11 | GitHub Advisory Database |
| symfony/symfony (Packagist) | before 5.4.56, from 6.0.0 before 6.4.50, from 7.0.0 before 7.4.23, from 8.0.0 before 8.1.11 | GitHub Advisory Database |
All scores
| Checkmarx | 8.4high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:H/SC:N/SI:N/SA:N |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:L/VA:H/SC:N/SI:N/SA:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total.
What each source says
CVE List
The Symfony Serializer component DataUriNormalizer handles only the exact types SplFileInfo, SplFileObject, and File, so for a property typed with a subclass such as UploadedFile, ObjectNormalizer instantiates the object through its constructor from attacker-controlled data, including the file path. This allows an arbitrary file on the server to be treated as an uploaded file in Symfony versions prior to 5.4.56, 6.x prior to 6.4.50, 7.x prior to 7.4.23, and 8.x prior to 8.1.11. A request body such as {"image": {"path": "/path/to/project/.env.local", "originalName": "a.png", "test": true}} makes the application handle any file on the server as an upload, without the file being sent. With test: true, UploadedFile::isValid() skips is_uploaded_file() and move() falls back to rename(). Assert\File does not prevent this because it validates the file at the attacker-chosen path, which exists on the server. Any code that deserializes untrusted data into a type that holds such a property is affected. That includes #[MapRequestPayload] on a DTO with an UploadedFile property, which is how uploads are mapped in Symfony 8.1; a single unauthenticated request with a JSON or form body is enough. Depending on what the application does with the upload, this can expose any file readable by PHP (for instance, when uploads are stored and served back), move any such file when move() is called, and reveal whether a path exists. A serializer built without DataUriNormalizer ahead of the object normalizer is not protected by the fix; the serializer configured by FrameworkBundle is.
GitHub Advisory Database
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.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-118515 changed 2026-11-11 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-h38r-xrmh-cwhr changed 2026-12-01 | CC-BY-4.0 |
| NVD | CVE-2026-118515 changed 2026-11-11 | Public domain |