GHSL-2023-006: Cross-site scripting (XSS) in Decidim leading to potential endorsement manipulation - CVE-2023-32693
The external link feature of Decidim was vulnerable to reflected cross-site scripting because the URL validation regex used line anchors instead of string anchors, allowing a newline to smuggle a JavaScript URL. An attacker could execute JavaScript in a logged-in user's browser and perform actions such as voting on proposals without consent.
Decidim, a platform for digital citizen participation, has an external link feature which was vulnerable to Cross-site scripting (XSS). This would have allowed attackers to perform actions on behalf of logged-in users, potentially tricking citizens to support proposals without their consent.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The URL validation regex used line anchors (^ and $) instead of string anchors (\A and \z), so a newline could bypass the check and allow a javascript: URL to be rendered.
Impact
An attacker could perform actions on behalf of logged-in users, such as voting on proposals, via cross-site scripting.
What the attacker needed
Victim is logged in; victim clicks a crafted link
The fix
The vulnerability was fixed in Decidim releases published on 2023-05-11, and the report recommends parsing the URI with an allow list and using string anchors in the regex.
How it was found
- Craft a URL that starts with a javascript: payload, uses // to comment out the rest, then a newline, then a normal https URL.
- URL-encode the payload and place it in the external_url GET parameter of the /link endpoint.
- Send the crafted link to a logged-in Decidim user (e.g., via comment, proposal, or email).
- The user sees the external link warning page with the normal https URL and hostname highlighted.
- The user clicks 'Proceed', and the JavaScript payload executes in the context of the Decidim site.
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 report has not been written yet. The Original tab links to the source.
Cross-site scripting (XSS) is a bug where a website shows attacker-supplied text as if it were part of the site, so the attacker's code runs in the victim's browser. Here, a link-checking page accepted a web address that secretly contained a line break and JavaScript code, so clicking 'Proceed' ran that code. Because the code ran while the user was logged in, it could make the user vote on proposals without them knowing.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.