Drupal Lightgallery, Cross-site Scripting (XSS), CVE-2025-XXXX (Moderate)

Listen to this Post

How the CVE Works

The vulnerability (CVE-2025-XXXX) in Drupal Lightgallery arises from improper input sanitization in the image gallery module. Attackers can inject malicious JavaScript via crafted image metadata (e.g., s or descriptions) due to insufficient output encoding. When rendered, this payload executes in a victim’s browser, leading to session hijacking, defacement, or phishing. The flaw affects versions before 1.6.0, where user-supplied data is directly embedded in the DOM without proper escaping.

DailyCVE Form

Platform: Drupal Lightgallery
Version: < 1.6.0
Vulnerability: Stored XSS
Severity: Moderate
Date: Jun 11, 2025

Prediction: Patch expected by Jul 10, 2025

What Undercode Say:

Exploitation:

1. Payload Injection:

<img src="x" onerror="alert('XSS')" />

Stored in image metadata (/description).

2. Triggering XSS:

Victims viewing the gallery execute the payload.

Detection:

curl -s "http://target/gallery" | grep -E "script|onerror"

Mitigation:

1. Temporary Fix:

Disable user-submitted metadata.

2. Permanent Fix:

Upgrade to Lightgallery 1.6.0+.

Patch Analysis:

The update implements HTML entity encoding:

htmlspecialchars($user_input, ENT_QUOTES, 'UTF-8');

Exploit Code (PoC):

fetch('/gallery/upload', {
method: 'POST',
body: '=<script>alert(1)</script>'
});

Protection Commands:

Drupal module update:
drush pm-update lightgallery

Log Monitoring:

tail -f /var/log/drupal/error.log | grep "XSS"

WAF Rule (ModSecurity):

SecRule ARGS "@contains <script>" "deny,log,msg:'XSS Attempt'"

References:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top