Stored XSS on the DuckDuckGo search results page
DuckDuckGo's search results page failed to properly sanitise the URL displayed for some third-party results, such as Urban Dictionary, allowing HTML injection. An attacker could get a malicious URL to rank highly for a search term and then send a victim a DuckDuckGo search link, causing script to run in the victim's browser.
This XSS was accidental. For whatever reason, I was messing about with the searchbar, putting various payloads into it without expecting to find anything.
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 search results page inserted the third-party result URL into HTML without proper encoding or sanitisation.
Impact
An attacker could run script in a victim's browser via a crafted DuckDuckGo search link, but only if the attacker's URL ranked highly for the search term; the issue later stopped reproducing.
What the attacker needed
Attacker URL ranks highly for a search term; victim opens a crafted search link
How it was found
- Enter a payload containing HTML markup into the DuckDuckGo search bar.
- Observe that the green URL in the Urban Dictionary result renders the injected HTML.
- Find a URL containing an XSS payload that appears in the search results.
- Load the search results and see the alert pop up.
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.
When you search on DuckDuckGo, each result shows a small green web address. The site was putting that address into the page without cleaning it first, so if the address contained special characters that look like webpage code, the browser would treat them as code. That let an attacker run their own script in a victim's browser when the victim opened a crafted search link.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.