S3fs Followup for Drupal CORE SA 2022-012
This issue was previously raised with the Drupal Security Team in SDO 1715391 NOTE: This is a private security tracker, only members of the Security Team and individuals who have been added will be able to access this link. Do not report Access Denied errors.
Problem/Motivation
Drupal Core SA 2022-012 did not secure up all vulnerabilities that impact contrib. Explicitly when an ITOK is present a user will ALWAYS be granted access through the Core provided ImageStyleDownloadControler
In the case of s3fs we are open to a possible minor DoS vulenrability due how the ImageStyleDownloadController is constucted.
It is inefficient, fragile, and ultimately insecure to attempt to block this from contrib as relies on detecting what routes that trace their heritage to ImageStyleDownloadController and register additional and unnecessary 'null' routes into the Drupal routing system to deny access.
Steps to reproduce
Upload an image to content (such as an Article) that will generate an ImageStyle derivative using the s3:// scheme.
Assume the file is named s3://2021-09/2020-11-20 18.09.12-1.jpg
Obtain the link to the ImageDerivative. Assuming this is for a 'large' derivative the link may be "https://s3fsbucket/styles/large/public/2021-09/2020-11-20 18.09.12-1.jpg?itok=JzmJlrXt"
Attempt to access the file via the image.style_private route controller (assuming the example above) "system/files/styles/large/s3/2021-09/2020-11-20 18.09.12-1.jpg?itok=JzmJlrXt"
Expected Result:
The content is not served
Current Result:
Drupal Streams the content to the requestor.
Proposed resolution
This issue should be solved by Core.
The attached patch is intended as a stop-gap while we await the Drupal Core teams to secure core.
Remaining tasks
Fix Core see
🐛
ImageStyleDownloadController routes do not limit schemes served
Fixed
User interface changes
None
API changes
None in this issue.
Data model changes
None