Concealing payloads in URL credentials

Executive Summary

Researchers discovered that the credentials portion of a URL can hide malicious payloads that are not visible in the address bar of Chrome and Firefox. The study shows that document.URL retains the credentials while location does not, allowing attackers to embed code in the username or password fields. Firefox’s failure to URL‑encode single quotes further enables DOM XSS when sites strip query strings or hashes. By exploiting this behavior, an attacker can manipulate the username and password properties of anchor elements, even with a blank href, and combine the technique with DOM clobbering for advanced attacks. The findings apply to Chrome and Firefox; Safari discards URL credentials and Chrome blocks sub‑resources from using them, but no specific defensive guidance is provided in the source.

Original Overview

Last year Johan Carlsson discovered you could conceal payloads inside the credentials part of the URL . This was fascinating to me especially because the payload is not actually visible in the URL in both Chrome and Firefox. This even persists through same origin navigations. So like a dog with a bone I wouldn't let go and tried to see what was possible... The first surprising thing to me was document.URL does not always match location. I had assumed these two properties were the same since I'd never observed them being different but it turns out that document.URL contains the credentials part of the URL whereas location doesn't. What that means is you can use just URL inside an event grab the payload from the credentials: Grab payload from credentials After fuzzing to identify which...