Symfony News

CVE-2017-16790: Ensure that submitted data are uploaded files

Affected versions

Symfony 2.7.0 to 2.7.37, 2.8.0 to 2.8.30, 3.2.0 to 3.2.13, and 3.3.0 to 3.3.12 versions of the Symfony Form component are affected by this security issue.

The issue has been fixed in Symfony 2.7.38, 2.8.31, 3.2.14, 3.3.13, 3.4-BETA5, and 4.0-BETA5.

Note that no fixes are provided for Symfony 3.0 and 3.1 as they are not maintained anymore.

Description

When a form is submitted by the user, the request handler classes of the Form component merge POST data (known as the $_POST array in plain PHP) and uploaded files data (known as the $_FILES array in plain PHP) into one array. This big array forms the data that are then bound to the form. At this stage there is no difference anymore between submitted POST data and uploaded files.

A user can send a crafted HTTP request where the value of a FileType is sent as normal POST data that could be interpreted as a locale file path on the server-side (for example, file:///etc/passwd). If the application did not perform any additional checks about the value submitted to the FileType, the contents of the given file on the server could have been exposed to the attacker.

Resolution

As part of the fix, a new isFileUpload() method was added to the RequestHandlerInterface. This method is called by the FileType to verify that the handled data is an uploaded file.

The patch for this issue is available here.

Credits

I would like to thank Ondrej Exner for reporting this security issue, Christian Flothmann for providing a fix, and the Symfony Core Team for reviewing the patch.


Be trained by Symfony experts - 2017-11-22 Cologne - 2017-12-4 Lyon - 2017-12-4 Lyon


About us

What a Symfony developer should know about the framework: News, Jobs, Tweets, Events, Videos,...

Resources

Find us on Twitter

Find us on Facebook