threat model
Guide for threat model
Threat Model - Legends of Hastinapur
Assets
Critical Assets
- Player Data
- Account credentials (hashed passwords, email)
- Personal information (username, payment history)
- Game progress (characters, inventory, skills)
- Game State
- Server-side authoritative state
- Real-time player positions and actions
- Payment Information
- Transaction records
- Subscription data
- Infrastructure
- Database servers
- Game servers (WebSocket)
- Cloudflare Tunnel tokens
Threat Actors
Attack Vectors & Mitigations
1. SQL Injection
Vector: Malicious input in login/registration forms
Impact: Database breach, account takeover
Mitigation:
Impact: Database breach, account takeover
Mitigation:
- ✅ Use parameterized queries (prepared statements)
- ✅ Input validation on all endpoints
- ⚠️ TODO: Add SQL injection tests
2. Plugin Exploits
Vector: Malicious Lua plugins bypass sandbox
Impact: Server compromise, player data theft
Mitigation:
Impact: Server compromise, player data theft
Mitigation:
- ✅ Restricted Lua libraries (no
io,os,debugin production) - ✅ Ed25519 signature verification
- ✅ Memory limits (32MB per plugin)
- ⚠️ TODO: Runtime monitoring for suspicious plugin behavior
3. DDoS Attacks
Vector: Flood game server with connections/messages
Impact: Service unavailability
Mitigation:
Impact: Service unavailability
Mitigation:
- ✅ Cloudflare WAF + DDoS protection
- ✅ Rate limiting (100 req/min per IP, 1000 actions/min per player)
- ⏳ TODO: Implement auto-scaling
4. Authentication Bypass
Vector: Weak JWT tokens, session hijacking
Impact: Account takeover
Mitigation:
Impact: Account takeover
Mitigation:
- ✅ Argon2id password hashing
- ✅ JWT with 15-min expiry
- ⚠️ TODO: Implement refresh token rotation
- ⚠️ TODO: Add 2FA (Time-based OTP)
5. XSS (Cross-Site Scripting)
Vector: Malicious scripts in player names, chat messages
Impact: Session theft, phishing
Mitigation:
Impact: Session theft, phishing
Mitigation:
- ⚠️ TODO: Sanitize all user-generated content
- ⚠️ TODO: Content Security Policy headers
6. Data Exfiltration
Vector: Insider access, compromised credentials
Impact: Player data breach
Mitigation:
Impact: Player data breach
Mitigation:
- ✅ SSL/TLS for all connections
- ⏳ TODO: Database encryption at rest
- ⏳ TODO: Audit logs for admin actions
- ⏳ TODO: Role-based access control (RBAC)
Risk Matrix
Security Recommendations
- Immediate (P0):
- Implement XSS sanitization
- Add 2FA support
- Database encryption at rest
- Short-term (P1):
- Security penetration testing
- Bug bounty program
- SIEM integration
- Long-term (P2):
- SOC 2 compliance
- Regular security audits
- Red team exercises