JavaScript can overwrite or remove HTTPONLY cookies
sjoerdlangkemper.nl
sjoerdlangkemper.nl
They don’t need to craft a special link, as long as they inject a script into your site it’s game over.
That’s why your server should sign session IDs it generates with an HMAC and reject any ones that the client simply sets! The client can overwrite httponly but it will only log the user out and annoy them.
HttpOnly merely prevents the theft of the cookie via XSS. It doesn't prevent an attacker from performing operations on behalf of the user via XSS.
That said, it does make the attack slightly harder. You have to write a bespoke attack script, rather than just a nearly universal one-liner to steal the cookie and then take over from there. In addition, if the victim navigates away from the page, then the attack ends. Of course, most likely, the attack script will only need a few seconds at most to complete the attack script.
This would prevent an attacker from both sniffing and performing operations on behalf of the user via XSS.
If the site has XSS, an attacker can still perform operations on behalf of the user even with SameSite and Secure.
script-src 'self'
There are no silver bullets, but together, they are greater than the sum of their parts.https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.2....