A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
fix(security): Host-header allowlist + restore dropped security headers
aeonframework0a3567af965f
diff --git a/README.md b/README.mdindex 0f74b891..bdcc78ba 100644--- a/README.md+++ b/README.md@@ -102,6 +102,8 @@ Anyone on the network can then access Flowsint at `http://<server-ip>:5173`.- `MASTER_VAULT_KEY_V1` — encrypts stored API keys. Generate one: `python3 -c "import os, base64; print('base64:' + base64.b64encode(os.urandom(32)).decode())"`- `NEO4J_PASSWORD` — Neo4j database password.+**Also add your server hostname/IP to the Host-header allowlist** in `flowsint-app/nginx.conf` (look for `map $http_host $is_flowsint_host`). The default allowlist accepts only `localhost` / `127.0.0.1` / `[::1]`, which defends single-user installs against DNS rebinding; LAN and public deploys must opt-in their own hostname. Two commented-out template lines in the same map block show the format.+Only port `5173` is exposed to the network. PostgreSQL, Redis, Neo4j and the API are bound to `127.0.0.1` on the server and reachable only through the frontend proxy.To pin a specific version instead of `latest`, set `FLOWSINT_VERSION` in `.env` (e.g. `FLOWSINT_VERSION=1.2.10`).diff --git a/flowsint-app/nginx.conf b/flowsint-app/nginx.confindex d097697c..c07f31a9 100644--- a/flowsint-app/nginx.conf+++ b/flowsint-app/nginx.conf@@ -45,12 +45,39 @@ http {# Securityserver_tokens off;+ # Host-header allowlist — defends against DNS rebinding.+ # The CORSMiddleware on the API blocks cross-origin reads, but after a+ # DNS rebinding flip the browser treats the request as same-origin and+ # skips the CORS check entirely, so a server-side Host check is the+ # canonical defense. Without it, attacker JS on evil.com can drive a+ # victim's browser to POST /api/auth/register against a flowsint instance+ # bound to localhost or a LAN IP, planting attacker-controlled accounts.+ #+ # Default allowlist covers single-user local deploys (localhost / 127.0.0.1+ # / ::1, any port). When deploying on a network (see README "Deploy on a+ # network"), add the server hostname/IP below — and add the public+ # hostname too when fronting with a reverse proxy like Caddy.+ map $http_host $is_flowsint_host {+ default 0;+ "~*^localhost(:[0-9]+)?$" 1;+ "~*^127\.0\.0\.1(:[0-9]+)?$" 1;+ "~*^\[::1\](:[0-9]+)?$" 1;+ # "~*^flowsint\.example\.com$" 1;+ # "~*^192\.168\.1\.42(:[0-9]+)?$" 1;+ }+server {listen 8080;server_name _;root /usr/share/nginx/html;index index.html;+ # Default-deny unknown Host headers (DNS rebinding defense).+ # See $is_flowsint_host map above for the allowlist.+ if ($is_flowsint_host = 0) {+ return 403;+ }+# Security headersadd_header X-Frame-Options "SAMEORIGIN" always;add_header X-Content-Type-Options "nosniff" always;@@ -88,6 +115,13 @@ http {location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {expires 1y;add_header Cache-Control "public, immutable";+ # Re-declare server-level security headers — nginx's add_header+ # inheritance is replace-all, not merge, so a location block that+ # sets any add_header drops every header set higher up.+ add_header X-Frame-Options "SAMEORIGIN" always;+ add_header X-Content-Type-Options "nosniff" always;+ add_header X-XSS-Protection "1; mode=block" always;+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;access_log off;}@@ -100,6 +134,12 @@ http {location = /index.html {expires -1;add_header Cache-Control "no-store, no-cache, must-revalidate";+ # Re-declare server-level security headers (see static-assets+ # location above for why).+ add_header X-Frame-Options "SAMEORIGIN" always;+ add_header X-Content-Type-Options "nosniff" always;+ add_header X-XSS-Protection "1; mode=block" always;+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;}# Deny access to hidden files