Chapter 1

Web Security

Common security vulnerabilities and best practices in Go web applications

✓ Understand XSS vulnerabilities ✓ Use html/template safely ✓ Avoid common security pitfalls
1
XSS from text/template
Learn why using text/template or string concatenation for HTML is dangerous
cyber.orijtech.com +20 XP intermediate
2
Integer overflow in the wild: infinite loop
Learn how integer overflow in a power-of-2 loop can cause infinite loops and DOS attacks
cyber.orijtech.com/advisory/pow2-loop-overflow +30 XP advanced
2
Goroutine Leaks
Learn how to prevent goroutine leaks using context.Context and proper channel handling
cyber.orijtech.com +20 XP intermediate
3
Data Races
Understand data races and how to prevent them with proper synchronization
cyber.orijtech.com +20 XP intermediate
4
Safe Map Initialization
Learn why nil maps panic on write and how to initialize them safely
cyber.orijtech.com +15 XP beginner
5
Integer Overflow
Understand integer overflow/underflow vulnerabilities and safe type casting
cyber.orijtech.com +20 XP intermediate
10
PEM Decoding Nil Check
Learn why pem.Decode can return nil and how to handle it safely
cyber.orijtech.com +15 XP beginner
11
Nonce Initialization
Understand why zero nonces break GCM security and how to randomize them
cyber.orijtech.com +20 XP intermediate
12
Nonce Reuse Vulnerability
Learn why reusing nonces is catastrophic for GCM security
cyber.orijtech.com +25 XP intermediate
13
Weak Encryption Algorithms
Identify broken algorithms (DES, RC4) and use secure alternatives
cyber.orijtech.com +15 XP beginner
14
Timing Attack Prevention
Use constant-time comparison to prevent timing attacks on secrets
cyber.orijtech.com +20 XP intermediate
15
Secure Random Numbers
Use crypto/rand instead of math/rand for security-sensitive values
cyber.orijtech.com +15 XP beginner
16
TLS Certificate Verification
Never disable TLS certificate verification - it enables MITM attacks
cyber.orijtech.com +15 XP beginner
17
Key Management
Never hardcode encryption keys - use environment variables or secret managers
cyber.orijtech.com +15 XP beginner