Missing Tls in Fastapi
How Missing Tls Manifests in Fastapi
Missing TLS in FastAPI applications creates multiple attack vectors that directly impact data confidentiality and integrity. When FastAPI endpoints are exposed over HTTP instead of HTTPS, several critical vulnerabilities emerge.
The most immediate risk is credential exposure during authentication flows. FastAPI's OAuth2PasswordBearer and API key authentication mechanisms transmit sensitive tokens over unencrypted channels. An attacker positioned on the same network can intercept these credentials using simple packet sniffing tools like Wireshark or tcpdump.
Consider a FastAPI authentication endpoint:
Fastapi-Specific Detection
Detecting missing TLS in FastAPI applications requires examining both configuration and runtime behavior. Start by inspecting your FastAPI application's startup configuration and middleware stack.
Check your main application file for HTTP-only server initialization:
Related CWEs: encryption
CWE ID Name Severity CWE-319 Cleartext Transmission of Sensitive Information HIGH CWE-295 Improper Certificate Validation HIGH CWE-326 Inadequate Encryption Strength HIGH CWE-327 Use of a Broken or Risky Cryptographic Algorithm HIGH CWE-328 Use of Weak Hash HIGH CWE-330 Use of Insufficiently Random Values HIGH CWE-338 Use of Cryptographically Weak PRNG MEDIUM CWE-693 Protection Mechanism Failure MEDIUM CWE-757 Selection of Less-Secure Algorithm During Negotiation HIGH CWE-261 Weak Encoding for Password HIGH