Drupal Malicious file upload with filenames stating with dot
Impact
Drupal 8 core's file_save_upload() function does not strip the leading and trailing dot ('.') from filenames, like Drupal 7 did.
Source excerpt · OSVAffected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| From 8.0.0 before 8.7.11Ecosystem versions | 8.7.11 |
| From 8.8.0 before 8.8.1Ecosystem versions | 8.8.1 |
Version evidence: OSV · GHSA-58xv-7h9r-mx3c
View original version evidence (121 explicit versions)
Original source description
Drupal 8 core's file_save_upload() function does not strip the leading and trailing dot ('.') from filenames, like Drupal 7 did.
Users with the ability to upload files with any extension in conjunction with contributed modules may be able to use this to upload system files such as .htaccess in order to bypass protections afforded by Drupal's default .htaccess file.
After this fix, file_save_upload() now trims leading and trailing dots from filenames.