Repository navigation
Security Hotspots
Security Hotspots are security-sensitive pieces of code that require manual review. Unlike Vulnerabilities (which are definite bugs), Hotspots highlight areas where security could be weak if not implemented correctly.
See also: Security Vulnerabilities | Best Practices | Rule Catalog
Security Hotspots are not bugs - they're areas of code that:
- Use security-sensitive APIs
- Could be vulnerable if misconfigured
- Require security expertise to review
- Should be verified by security team
Your job: Review each hotspot and confirm it's secure, then mark as "Safe" or "Fix".
Rule: WeakAuthentication
Review: Does this authentication method provide adequate security?
Sensitive code:
(* Simple password check - is this enough? *)
AuthenticateUser[user_, pass_] := user == "admin" && pass == "password123"Security checklist:
- Uses strong hashing (bcrypt, Argon2)?
- Implements rate limiting?
- Protects against timing attacks?
- Enforces password complexity?
- Uses multi-factor authentication?
Safe implementation:
(* Secure: Use proper hashing *)
AuthenticateUser[user_, pass_] := Module[{stored, hash},
stored = LoadHashedPassword[user];
hash = Hash[pass, "bcrypt"]; (* Use proper library *)
SlowEquals[hash, stored] (* Timing-safe comparison *)
]Check every protected resource has authorization.
- Insecure session management
- Missing role validation
- Privilege escalation risks
- Account enumeration
- Credential management
###Cryptography (7 rules)
Rule: WeakHashing
(* REVIEW NEEDED *)
hash = Hash[password, "MD5"] (* MD5 is broken! *)
(* SAFE *)
hash = Hash[password, "SHA256"] (* Minimum SHA-256 *)Avoid: DES, RC4, ECB mode
Use: AES-256-GCM, ChaCha20-Poly1305
(* REVIEW: Should this use HTTPS? *)
URLRead["http://api.internal.com/data"]
(* SAFE: Use HTTPS *)
URLRead["https://api.internal.com/data"]Never disable cert validation in production!
Validate: file type, size, content
Review if service should be public
Never log passwords, tokens, PII
All user inputs must be validated before use.
- Go to Security Hotspots tab
- Click a hotspot to review
- Read the security concern
- Check the code implementation
- Choose:
- Safe - Confirmed secure
- Fixed - Made changes
- Won't Fix - False positive
For each hotspot:
- Understand the security risk
- Check implementation details
- Verify secure coding practices
- Consult security guidelines
- Test security controls
- Document review decision
| Category | Rule | What to Review |
|---|---|---|
| Auth | Weak Authentication | Hash algorithm, rate limiting |
| Auth | Missing Authorization | Permission checks |
| Auth | Session Management | Timeout, secure flags |
| Auth | Role Validation | RBAC implementation |
| Auth | Privilege Escalation | Vertical/horizontal checks |
| Auth | Account Enumeration | Timing attacks, error messages |
| Auth | Credential Storage | Encryption at rest |
| Crypto | Weak Hashing | MD5, SHA-1 usage |
| Crypto | Weak Encryption | DES, RC4, ECB mode |
| Crypto | Short Keys | Key length >= 2048 bits |
| Crypto | Hardcoded IV | Random IV generation |
| Crypto | Weak Random | Cryptographic PRNG |
| Crypto | Custom Crypto | Use standard libraries |
| Crypto | Insecure Protocols | SSLv3, TLS 1.0/1.1 |
| Network | HTTP Without TLS | HTTPS enforcement |
| Network | Cert Validation Disabled | Production certs |
| Network | Public Binding | Network exposure |
| Network | Unrestricted CORS | Origin validation |
| Network | Open Redirects | URL validation |
| Network | DNS Rebinding | Host validation |
| Data | File Uploads | Type, size, content validation |
| Data | Sensitive in Logs | PII, credentials |
| Data | Unencrypted Storage | Encryption at rest |
| Input | Missing Validation | Whitelist validation |
| Input | Regex Complexity | DoS potential |
| Input | Mass Assignment | Field whitelisting |
| Input | XML Parsing | DTD disabled |
| Input | Deserialization | Safe formats |
| Input | File Path Construction | Path traversal |
See Rule Catalog for detailed descriptions of all 29 rules.