Drupal Core Unrestricted File Upload Vulnerability

drupal/core Updated 02 Oct 2025

Summary

15/05/2024
MODERATE
Yes i
Moderate
6.6

GHSA-7gwj-7fhm-vw4w: Drupal core unrestricted file upload. Affects drupal/core across 2 version ranges.

>= 8.0.0, < 8.7.11 >= 8.8.0, < 8.8.1

Fixed in 8.7.11 or 8.8.1, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Drupal is a popular open-source content management system (CMS) written in PHP. It provides a flexible platform for building websites and applications. The Drupal core package is the foundation of the CMS and includes essential features and functionality. However, a vulnerability has been discovered in the file upload functionality of Drupal core.

Vulnerability Detail

The vulnerability in Drupal core's file_save_upload() function allows users with the ability to upload files to bypass protections provided by Drupal's default .htaccess file. The file_save_upload() function does not strip the leading and trailing dot ('.') from filenames, which can be exploited by users to upload system files such as .htaccess. This can potentially lead to unauthorized access or manipulation of the Drupal installation. The vulnerability affects versions 8.0.0 to 8.7.11 and 8.8.0 to 8.8.1 of the Drupal core package.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 8.0.0, < 8.7.11 8.7.11
    composer require drupal/core:8.7.11
  • >= 8.8.0, < 8.8.1 8.8.1
    composer require drupal/core:8.8.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If updating the Drupal core package is not immediately possible, a temporary workaround is to implement a custom validation function for file uploads that explicitly checks for and rejects filenames with leading or trailing dots. Here is an example of a validation function in PHP:

function custom_file_upload_validation(array &$file) {
  $filename = $file['name'];
  if (strpos($filename, '.') === 0 || strrpos($filename, '.') === strlen($filename) - 1) {
    $file['error'] = UPLOAD_ERR_EXTENSION;
  }
}

Conclusion

The Drupal core unrestricted file upload vulnerability allows users to upload system files and bypass Drupal's default protections. It is crucial to update the Drupal core package to the recommended versions to mitigate this vulnerability. Implementing the provided workaround can serve as a temporary solution until the update is applied. For further support and assistance in vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for drupal/core →

Share this vulnerability

FAQ

This vulnerability allows users to upload system files such as .htaccess, bypassing Drupal's default protections. This can potentially lead to unauthorized access or manipulation of the Drupal installation.

Versions 8.0.0 to 8.7.11 and 8.8.0 to 8.8.1 of the Drupal core package are affected.

To fix this vulnerability, update the Drupal core package to version 8.7.12 or later (for versions 8.0.0 to 8.7.11) or version 8.8.2 or later (for versions 8.8.0 to 8.8.1).

A temporary workaround is to implement a custom validation function for file uploads that explicitly checks for and rejects filenames with leading or trailing dots. See the 'workaround' section for an example.

You can find more information about this vulnerability, including the technical details and the fix, in the advisory on the GitHub Advisory Database: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/05/GHSA-7gwj-7fhm-vw4w/GHSA-7gwj-7fhm-vw4w.json

Related vulnerabilities

Recent vulnerabilities recorded for drupal/core.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 8.0.0, < 8.7.11 8.7.11
    composer require drupal/core:8.7.11
  • >= 8.8.0, < 8.8.1 8.8.1
    composer require drupal/core:8.8.1

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback