From Debug Warnings to XSS: Exploiting a Drupal CMS Endpoint
A Drupal CMS endpoint reflected the 'error' parameter without sanitisation, allowing an attacker to inject and execute arbitrary JavaScript in a victim's browser. The report claims this could lead to session cookie theft and actions on behalf of authenticated users.
medium.com
Published on medium.com
The target was a Drupal-based CMS where I discovered a Reflected Cross-Site Scripting (XSS) vulnerability due to lack of proper input sanitization, which could potentially lead to impactful exploitation.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the endpoint reflected the 'error' parameter into the HTML response without output encoding or input validation.
Impact
This could allow an attacker to execute arbitrary JavaScript in the victim's browser, steal session cookies, perform actions on behalf of authenticated users, and deliver phishing or malicious payloads.
What the attacker needed
Victim clicks a crafted link; endpoint accessible
The fix
The endpoint should validate input and encode output so that user-supplied data is not reflected as executable HTML.
How it was found
- Access the Drupal endpoint and observe debug warnings that reveal parameters.
- Identify the 'error' parameter from the warnings.
- Test the 'error' parameter with a simple value and see it reflected in the response.
- Inject a script payload into the 'error' parameter and observe the alert triggering.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Cross-site scripting (XSS) is when a website takes input from a user and puts it into a page without cleaning it first, so an attacker can make the page run their own JavaScript. Here, the 'error' parameter was echoed back into the page, so a script tag in the URL ran in the browser. This lets an attacker do things like steal cookies or act as the logged-in user.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.