DOM-Based Cookie Manipulation
The application stored the last viewed product URL in a client-side cookie and reflected it into a DOM operation without validation, allowing an attacker to inject an external URL. An attacker could redirect users to phishing or malware sites.
medium.com
Published on medium.com
This lab demonstrates a DOM-based open redirection issue caused by unsafe client-side handling of cookies. The application tracks user navigation using a “Last Viewed Product” feature.
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
Impact
Users could be silently forwarded to phishing pages, malware delivery sites, or fake login portals that resemble the original application.
What the attacker needed
Victim clicks a link; attacker can set cookie value
The fix
The application should validate the cookie value to ensure it is a safe internal path before using it in navigation, or avoid using cookies for navigation altogether.
How it was found
- Open the lab and navigate to Product 1, then Product 2, and return to the homepage.
- Intercept the request and modify the cookie value to an arbitrary external URL.
- Use an iframe payload with an onload handler to execute JavaScript.
- Store the exploit on the Exploit Server and verify it executes.
- Deliver the exploit to the victim.
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.
A cookie is a small piece of data a website stores in your browser. Here, the site saved the address of the last product you looked at in a cookie, then used that address to create a link on the homepage. Because it never checked the address, an attacker could change the cookie to point to a malicious website, and the site would create a link to that bad site.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.