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.

Published in #Security Advisories