navigator.sendBeacon / fetch 数据外传
检查 iframe 自身 origin 中收集的信息和 referrer 是否可通过 sendBeacon 或 fetch 发送到外部。
按 sandbox 策略的行为
| 策略 | 预期结果 |
|---|---|
| 无 sandbox | 通过 |
sandbox="allow-scripts" | 通过 |
sandbox="" (最严) | 阻止 |
Embed 代码
此代码使用专用嵌入页面。粘贴到您的服务后检查渲染或拦截行为。
<iframe src="https://xss-playground.com/embed/beacon-exfil?lang=zh" title="XSS Playground - navigator.sendBeacon / fetch 数据外传" width="600" height="420" loading="lazy" referrerpolicy="strict-origin-when-cross-origin"></iframe>
执行
document.referrer
-navigator.userAgent
-// 无日志
说明
- iframe 内发生的点击和键盘输入属于它自己的 origin,因此可以自由收集。放置假输入框时,用户输入的密码也可能被发送出去。
document.referrer可以暴露父页面的 origin / path(取决于 Referrer-Policy),从而知道 iframe 被嵌入在哪个文档、帖子或仪表盘中。- 这是最接近真实数据外传的场景。防护方式是用
sandbox=""完全阻止 JS,或通过 host allowlist 只允许可信域名。