July 25, 2026
The Usual Suspects: Most Common Bugs & Vulnerabilities
SQL Injection
By Bhardwajsiddhi
2 min read
SQL Injection
This happens when attackers insert malicious SQL commands into input fields. If your app directly uses user input in database queries, hackers can bypass logins, steal data, or delete tables.
Fix: Always use parameterized queries or ORM frameworks. Never trust user input.
Cross-Site Scripting (XSS)
Attackers inject harmful JavaScript into web pages that other users view. This can steal cookies, session tokens, or redirect visitors to malicious sites.
Fix: Encode all user-generated content before displaying it. Use Content Security Policy headers. Modern frameworks like React handle this automatically.
Broken Authentication
Weak passwords, missing rate limits, and poor session management make accounts easy to compromise. Attackers use stolen credentials or brute-force attacks to gain access.
Fix: Enforce multi-factor authentication, implement account lockout policies, and use secure session tokens that expire properly.
Security Misconfiguration
Default passwords, exposed debug modes, and unnecessary open ports are surprisingly common. These aren't code flaws — they're setup errors.
Fix: Harden production environments, disable debugging, change all default credentials, and audit your cloud configurations regularly.
Path Traversal
When file paths accept user input without validation, attackers can navigate directories using ../ sequences to access sensitive system files.
Fix: Map file IDs to actual paths in a database. Never use direct user input for filesystem operations.
Off-by-One Errors
Loops that run one time too many or too few. Usually happens when mixing zero-based indexing with count-based conditions.
Fix: Test edge cases thoroughly. Use inclusive vs exclusive bounds consistently.
Null Pointer Exceptions
Accessing properties on undefined variables crashes applications. This remains one of the most frequent runtime errors.
Fix: Always check for null or undefined before accessing nested properties. Use optional chaining where available.
Race Conditions
Multiple threads modify shared data simultaneously, causing inconsistent states. Common in payment processing and inventory systems.
Fix: Use locks, atomic operations, or transactional patterns to ensure data integrity.