Breaking (Bad) Cross-Site Request Forgery Protection – The Netgear Nighthawk M1
The router's web interface used a CSRF token to protect its API, but the same token was also exposed inside a dynamically generated JavaScript file that any web page could embed and read. A malicious page could therefore obtain the token and send valid state-changing requests to the router from the victim's browser.
pentestpartners.com
Published on pentestpartners.com
Cross-site Request Forgery (CSRF) is a descriptive term, but pretty oblique if you don’t know exactly what it means. Broken down, it’s pretty simple:
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 CSRF token was embedded in a cross-origin embeddable JavaScript file, so the secret intended to be unreadable by third parties was readable by any page.
Impact
A malicious page could make authenticated requests to the router's API, such as restarting it, because the token could be read from the embeddable script; the text does not demonstrate a specific damaging action beyond this.
What the attacker needed
Victim visits a malicious page; victim's browser can reach the router
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 are logged into a website, another site you visit can quietly send requests to it using your login. To stop this, sites hand out a secret code (a token) that the other site cannot know. Here the secret code was also placed in a script file that any site is allowed to load and read, so the protection did not work.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.