Notification permission / push hijack
Trigger Notification.requestPermission so the attacker domain can later push notifications.
按 sandbox 策略的行为
| 策略 | 预期结果 |
|---|---|
| 无 sandbox | 通过 |
sandbox="allow-scripts" | 通过 |
sandbox="" (最严) | 阻止 |
Embed 代码
此代码使用专用嵌入页面。粘贴到您的服务后检查渲染或拦截行为。
<iframe src="https://xss-playground.com/embed/notification-permission?lang=zh" title="XSS Playground - Notification permission / push hijack" width="600" height="420" loading="lazy" referrerpolicy="strict-origin-when-cross-origin"></iframe>
실행
// 로그 없음
해설
- 최신 크롬은 사용자 제스처 + 메인 프레임 + 안전한 origin 을 요구해서 iframe 안의 자동 호출은 보통 차단됩니다. 사파리/파폭은 정책이 더 느슨할 수 있습니다.
- 위험성은 즉시 정보 탈취가 아니라 이후 사용자가 다른 페이지를 보고 있을 때 attacker 도메인이 푸시 알림으로 피싱 가능 해진다는 점입니다.
- iframe 에서 권한 프롬프트가 뜨려면
allow="notifications"가 필요한 브라우저도 있습니다. 임의 호스트 iframe 이라면 절대 부여하면 안 됩니다.