ShieldNet is a detector, not a firewall. This page says what it can and cannot see, how the local service protects itself while running as root, and how to report a vulnerability.
| Attack | Rule (all counts are "aimed at this host") |
|---|---|
| TCP SYN flood | SYN without ACK, with any extra flags (SYN+ECE/CWR, SYN+PSH, SYN+FIN, ...). TCP headers hidden by RFC 1858 tiny or overlapping fragments (offset 8) count too. |
| TCP SYN-ACK flood (reflection) | SYN-ACKs that match no SYN this host sent. Each SYN allows up to 3 server retransmits. |
| Ping of Death | Any fragment (IPv4 or IPv6, any protocol) that ends past 65,535 bytes. The check runs per fragment, so fragment order does not matter. |
| ICMP Smurf | Echo replies to pings this host never sent, or ICMP that uses this host's IP but comes from another network card. |
| UDP flood | UDP datagrams that are not replies to a flow this host started (DNS, QUIC and video replies don't count). Later fragments count unless the first fragment was a reply. |
| ICMP ping flood | Echo requests (IPv4 and IPv6). |
Each attack has two windows:
- Short window (default 5 s, threshold set per attack) catches bursts.
- Long window (60 s) alerts at 40% of the short-window rate. A "low and slow" flood that stays just under the short threshold is still flagged, as
trigger: "sustained".
"This host" means two things: the destination IP is one of the interface's addresses, or the frame was sent to this machine's MAC address. That covers secondary addresses and IPv6 temporary addresses, including floods spread across several of them.
Memory stays bounded whatever an attacker sends:
- Windows are time buckets, not one entry per packet.
- Per-source tables are capped. Pruning keeps the heaviest sources, so junk addresses can't hide the real attacker.
- Distinct source IPs are counted with an 8 KB estimator.
- The pending-reply tables (32k entries each), the ARP table and the incident list (500) are all capped.
Tests in tests/test_evasions.py show that memory stays flat under 120k distinct
spoofed sources.
- It doesn't mitigate. It tells you an attack is happening and who sends it. It does not block anything.
- It only sees traffic that reaches this computer's network card. On switched networks, attacks on other hosts are invisible.
- It can't save you from a volumetric DDoS. A large flood fills your internet uplink or overloads your router before any packet reaches the host. At that point the fix lies with your ISP or an upstream scrubbing service. ShieldNet only helps you tell that this is what's happening.
- Spoofed source IPs are not the attacker. ShieldNet points at the sender's MAC address, which is the real sender on your LAN, or your router if the attack comes from the internet. Don't block or "strike back" at the IPs it lists.
- Out of scope: application-layer attacks (HTTP floods, slowloris), encrypted or tunnelled traffic, and attacks below the thresholds. A flood slower than about 40% of the threshold rate is, by design, not treated as a DoS.
- Thresholds are heuristics. A host that serves a lot of public traffic, or receives a lot of unsolicited UDP (game server, P2P), may need higher thresholds (
--udp-flood, etc.).
The service listens on 127.0.0.1:8765 only. Every website you visit can send
requests to 127.0.0.1, so the service is built to resist that:
- DNS rebinding: the
Hostheader must be127.0.0.1,localhostor[::1]. Any other host gets a 403. - Cross-site requests:
- If an
Originheader is present, it must be exactly the dashboard's own origin (http://<host>:<port>). This applies to HTTP and to the websocket. Other local apps on other ports are rejected too. - Requests with
Sec-Fetch-Site: cross-siteorsame-siteare refused, except a plain top-level navigation to/.
- If an
- State-changing commands need a 256-bit random token:
POST /api/controlwith headerX-ShieldNet-Token: <token>and a JSON body{"cmd": "start"|"stop"|"reset"}. The body must beapplication/json, so it can't be sent as a "simple" CSRF form.- Websocket commands:
{"cmd": ..., "token": ...}. - Tokens are compared in constant time.
- Read-only state:
GET /api/stateis open to local clients. Browsers on other sites can't read it: there are no CORS headers, it setsCross-Origin-Resource-Policy: same-origin, and the Origin/Fetch-Metadata checks apply. - Token file
<data dir>/control.token:- It is written atomically with
O_EXCL/O_NOFOLLOW. - A symlinked, foreign-owned or too-permissive existing file is replaced, not trusted.
- On macOS the root service sets it to
root:admin 0640. Members of theadmingroup (people who cansudo, so could stop the daemon anyway) can read it from their menu-bar app. Standard accounts can't read it, and their tray hides Pause/Resume. - Elsewhere it is
0600. - The data directory is
$SHIELDNET_HOME, else/Library/Application Support/ShieldNet(macOS root), else~/.shieldnet.
- It is written atomically with
- Headers on every response:
- Strict CSP:
default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self' ws://<host>; frame-ancestors 'none'; ..., with no inline script or style allowed. X-Frame-Options: DENY,nosniff,no-referrer, COOP/CORPsame-origin.Cache-Control: no-storeon pages and API responses.
- Strict CSP:
- Capture uploads (
/api/analyze):- 100 MB limit.
- pcap/pcapng magic-number check (anything else gets a 415).
- The file goes to a private
0700temp directory that is always deleted. - Filenames are sanitised before they are echoed back.
- The target must be a valid IP address.
- One analysis at a time (429 while busy), capped at 3M packets and a 180 s timeout.
- Parsing runs in a worker thread, off the event loop.
- Files are decoded by ShieldNet's own bounds-checked parser, which is fuzz-tested and never raises, not by a full Scapy dissection.
- Websocket: at most 16 clients, 4 KB messages, and malformed JSON is ignored.
Known limitation: the dashboard page contains the token, so that browser
tabs can send commands. Any process on the Mac, under any local user, can fetch
http://127.0.0.1:8765/ and so obtain it. The token protects against websites
and other remote callers. It does not separate local users from each other. The
worst a local user can do with it is pause, resume or clear the monitor.
Detection data (packet metadata) can likewise be read by local processes.
Use ShieldNet only on hosts and networks you own or are allowed to monitor.
The sample attacks in tests/make_samples.py are offline capture files, and
the live tests only send packets to the loopback interface. ShieldNet contains
no code to attack other machines, and contributions that add such code will not
be accepted.
Please don't open a public issue. Use GitHub's private vulnerability report ("Security" tab → "Report a vulnerability") on the ShieldNet repository. Include the version, OS, steps to reproduce and the impact. You should get an answer within 7 days. Fixes are credited in the changelog unless you prefer otherwise.