The time I found a persistent DOM XSS on DuckDuckGo

In the summer of 2020, I found a not-so-interesting but impactful XSS on the DuckDuckGo search engine. I looked into the security of their Cloud Save feature, which lets you have your preferences (colour scheme, styles etc.) saved and then restored in a privacy-friendly way using a passphrase. The passphrase gets hashed and is used as an API key to access them.

I enumerated all the possible options you can save in the preferences object and found two interesting ones. It soon turned out they were indeed vulnerable! You saved a simple DOM XSS payload via Cloud Save and when you tried to restore you got XSSed. And the best thing is… you got XSSed permanently because the malicious options were saved to your cookies and executed every time you opened the page.

This is how the Cloud Save was set up:

POST /settings.js HTTP/1.1
Content-Length: 248

        "kp":"\"><img src=/ onerror=alert(1)>",
        "kae":"\"><img src=/ onerror=alert(2)>"

But I hear you ask, how do you force someone to apply your malicious Cloud Save preferences? Well, that’s easy enough, DuckDuckGo has a parameter for that. You just put the key of the Cloud Save in the key parameter like and it gets applied immediately.

However, there was an annoying (and challenging) limitation. The length of the option value, and thus the payload, was limited to 30 characters. That is not a lot, but still can be abused.

See the original report for more details.

Published on
xss bugbounty web

Latest Posts