CVE-2022-25277: Malicious File Upload
Drupal core - Critical - Arbitrary PHP code execution - SA-CORE-2022-014
Other sources
Drupal core sanitizes filenames with dangerous extensions upon upload (reference: SA-CORE-2020-012) and strips leading and trailing dots from filenames to prevent uploading server configuration files (reference: SA-CORE-2019-010). However, the protections for these two vulnerabilities previously did not work correctly together. As a result, if the site were configured to allow the upload of files with an htaccess extension, these files' filenames would not be properly sanitized. This could allow bypassing the protections provided by Drupal core's default .htaccess files and possible remote code execution on Apache web servers. This issue is mitigated by the fact that it requires a field administrator to explicitly configure a file field to allow htaccess as an extension (a restricted permission), or a contributed module or custom code that overrides allowed file uploads.
Drupal core sanitizes filenames with dangerous extensions upon upload and strips leading and trailing dots from filenames to prevent uploading server configuration files.
However, the protections for these two vulnerabilities previously did not work correctly together. As a result, if the site were configured to allow the upload of files with an htaccess extension, these files' filenames would not be properly sanitized. This could allow bypassing the protections provided by Drupal core's default .htaccess files and possible remote code execution on Apache web servers.
This issue is mitigated by the fact that it requires a field administrator to explicitly configure a file field to allow htaccess as an extension (a restricted permission), or a contributed module or custom code that overrides allowed file uploads.
Affected Software
Event History
Frequently Asked Questions
What is the vulnerability ID for this Drupal vulnerability?
The vulnerability ID for this Drupal vulnerability is CVE-2022-25277.
What is the severity of CVE-2022-25277?
The severity of CVE-2022-25277 is high with a CVSS score of 7.2.
How does CVE-2022-25277 affect Drupal?
CVE-2022-25277 affects Drupal versions 8.9.0 up to 8.10.0, 9.0.0 up to 9.1.0, 9.1.0 up to 9.2.0, 9.2.0 up to 9.3.0, 9.3.0 up to 9.3.19, and 9.4.0 up to 9.4.3.
What does CVE-2022-25277 allow an attacker to do?
CVE-2022-25277 allows an attacker to execute arbitrary PHP code.
How can I fix the vulnerability CVE-2022-25277?
To fix the vulnerability CVE-2022-25277, it is recommended to update Drupal core to a version that includes the patch provided in SA-CORE-2022-014.