Skip to content

Security: ShankarSec/ClueStream

Security

SECURITY.md

CLUESTREAM Security Documentation

Security architecture, controls, threat model, and responsible disclosure for CLUESTREAM v1.0.0.


Table of Contents

  1. Security Philosophy
  2. Security Controls
  3. Threat Model
  4. Live Mode Security
  5. Known Limitations
  6. Security Checklist
  7. Responsible Disclosure
  8. Security Audit

Security Philosophy

CLUESTREAM is designed with defense in depth and zero trust principles:

  • Offline-first: Offline analysis makes no outbound network connections. The optional local dashboard binds to loopback. No telemetry, update checks, or automatic remote enrichment are performed.
  • Memory-only credentials: Passwords are never written to disk. The per-startup credential exists only in process memory and is rotated on every startup.
  • Evidence integrity: Every input file is SHA-256 hashed before parsing. Manifests provide byte-level integrity verification.
  • Epistemic labeling: All analytical conclusions carry explicit status (OBSERVED/INFERRED/HYPOTHESIS/UNKNOWN) to prevent mistaking inference for observation.
  • Zero stack traces: Standard operations never expose raw Python tracebacks to the operator.
  • Least privilege: All mutating endpoints require authentication, CSRF tokens, and role-based access control.

Security Controls

Authentication

Control Implementation
Password hashing PBKDF2-SHA256, 240,000 rounds, random 16-byte salt
Credential storage Memory-only; never written to disk; rotated per startup
Startup credential Cryptographically random 256-bit password (secrets.token_urlsafe(32))
Local user accounts Salted PBKDF2 hashes in state directory (0o600 permissions)

Session Management

Control Implementation
Session tokens secrets.token_urlsafe(32) (256 bits)
CSRF tokens Per-session, validated on all mutating endpoints
Session timeout 30-minute idle timeout (sliding)
Cookie attributes HttpOnly, SameSite=Strict, Max-Age=1800
Session fixation fix Token regenerated on every login

Input Validation

Control Implementation
File extensions Allowlist (.evtx, .log, .txt, .csv, .json, .jsonl, .xml, .gz, .zip, .7z, .pcap, .pcapng)
Path traversal Canonical path resolution + member validation for archives
Decompression bombs MAX_INPUT_MB (256 MB), MAX_ZIP_RATIO (500:1), MAX_ZIP_MEMBERS (1000)
Line length Capped at 8,192 characters
Request body Capped at 64 MB
Filename validation Rejects null bytes, control chars, traversal, reserved names

Output Sanitization

Control Implementation
HTML escaping escape_for_html() at API boundary
Security headers CSP, X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Cache-Control: no-store, Permissions-Policy, Strict-Transport-Security
Network binding Offline dashboard and live mode default to 127.0.0.1 loopback

Threat Model (STRIDE)

Threat Category Offline Risk Live Risk Mitigation
Path traversal Spoofing Low Critical Canonical path resolution, extension allowlisting
Session fixation Spoofing Medium High Token regeneration on login
Unauthorized access Tampering N/A Critical RBAC, authentication, session management
Data exfiltration Information Disclosure None High Egress allowlisting, audit logging of all API calls
ReDoS Denial of Service Medium High Regex complexity caps, timeout on rule evaluation
SQL injection Tampering N/A High Parameterized queries (SQLite)
XSS Tampering Low Medium HTML escaping, CSP
CSRF Tampering N/A High Per-session CSRF tokens
Brute force Denial of Service Low High Rate limiting (5 failures/60s per IP)

Live Mode Security

Live mode expands the attack surface. Additional controls are required:

Network Security

  • Transport: The built-in live API/dashboard serve HTTP, not HTTPS. Do not expose them directly to untrusted networks. For remote access, terminate TLS at a trusted reverse proxy and restrict the upstream to loopback/private interfaces.
  • CORS: Restrict live_cors_origins to trusted domains only
  • Bind address: Defaults to 127.0.0.1; do not bind to 0.0.0.0 unless protected by a firewall and TLS-terminating reverse proxy.
  • Rate limiting: Per-IP, per-endpoint sliding window

Authentication & Authorization

  • Multi-user: Local user accounts with PBKDF2-SHA256 hashes
  • RBAC: Four roles — Admin, Analyst Manager, Analyst, Auditor
  • MFA: TOTP-based multi-factor authentication (RFC 6238)
  • Session security: HttpOnly/SameSite cookies, 30-minute idle timeout

Data Protection

  • Database: SQLite with 0o600 file permissions
  • State directory: 0o700 permissions
  • Audit log: Append-only JSONL with 0o600 permissions
  • Evidence: SHA-256 hashes for all stored evidence files

Known Limitations

Limitation Description Mitigation
SHA-256 integrity Proves byte-level integrity, not source authenticity Document limitation; use secure boot/storage
No network in offline Cannot receive threat intel feeds By design; air-gapped operation
In-memory sessions Sessions lost on restart Acceptable for single-host deployment
SQLite single-writer Concurrent writes may contend Single-process deployment
Database not encrypted Only optional alert evidence is sealed Use filesystem/volume encryption for the live DB
Vault crypto is not AEAD HMAC-SHA256 CTR + tag, stdlib only Use disk encryption for high-value deployments
Collector is plain HTTP Token protects access, not transport TLS reverse proxy + firewall allow-list
No SSO/OIDC Framework stub only Future integration planned

Collector Security (Phases 1–6)

  • The HTTP collector uses a secrets.token_urlsafe(32) Bearer token stored 0600, compared with hmac.compare_digest. Never paste the token into screenshots, issue reports or terminal transcripts.
  • Rotate with cluestream collect-token rotate; the command prints only the path. Restart cluestream live and update every forwarder afterwards.
  • Config validation refuses to start an enabled HTTP collector without a token file, and refuses to store normal raw events.
  • Syslog and file-watcher sources are unauthenticated by design: bind them to loopback or a trusted management network and firewall the port.
  • The optional raw-evidence vault uses HMAC-SHA256 counter-mode with an authentication tag and SHA-256 hash, with a 0600 key file. It is at-rest protection, not an audited AEAD cipher; use volume encryption for high-value evidence. Expired records are purged on an interval and each purge is recorded in retention_audit.
  • Offline mode never imports or starts any network component.

Security Checklist

Deployment

  • Run as non-root user (dedicated cluestream user)
  • Filesystem permissions: database 0o600, state dir 0o700
  • Network: keep the service on loopback unless a secured reverse proxy is configured
  • TLS: terminate HTTPS at a trusted reverse proxy before any remote access
  • CORS: origins restricted to trusted domains
  • Firewall: restrict API port (8080) to internal networks
  • Logging: audit log enabled and monitored

User Management

  • Strong passwords (min 10 characters) for all accounts
  • MFA enabled for admin accounts
  • Least privilege role assignment
  • Regular access review

Maintenance

  • Dependency vulnerability scanning (pip-audit)
  • Security patch management
  • Backup and recovery procedures
  • Incident response plan

Responsible Disclosure

Security vulnerabilities should be reported privately to the project maintainer before public disclosure.

Contact: Shankar M. (ShankarSec) via GitHub

Please include:

  • Description of the vulnerability
  • Steps to reproduce
  • Affected versions
  • Potential impact
  • Suggested remediation (if any)

We will acknowledge receipt within 7 business days and provide status updates as the issue is investigated and remediated.


Security Audit

The following controls were verified during development:

Control Status Method
PBKDF2 password hashing Verified Unit tests
Session regeneration on login Verified Code review + tests
CSRF token validation Verified Code review
Input validation module Verified Unit tests (validation functions)
Rate limiting Verified Unit tests
Path traversal prevention Verified Unit tests (upload security)
Security headers Verified Code review
No hardcoded credentials Verified Secret scan: CLEAN
Offline mode zero network Verified Import test (no socket/http)

There aren't any published security advisories