Injection Attacks
Injection attacks occur when untrusted user input is interpreted as executable commands by an application. Instead of treating input as data, the system mistakenly executes it as code.
Common Types of Injection Attacks
- SQL Injection (SQLi): Injecting malicious SQL queries into database fields.
- Command Injection: Executing operating system commands via vulnerable input fields.
- LDAP Injection: Manipulating directory service queries.
- Cross-Site Scripting (XSS): Injecting malicious scripts into web pages.
How Injection Attacks Work
- User submits input through a form or URL parameter.
- The application fails to validate or sanitize the input.
- The input is concatenated into a query or command.
- The system executes unintended malicious code.
Example: If an application builds SQL queries using string concatenation, an attacker may inject conditions that bypass authentication.
Impact on Security (CIA Model)
- Confidentiality: Unauthorized access to sensitive database records.
- Integrity: Modification or deletion of stored data.
- Availability: Database crashes or service disruption.
Detection Indicators
- Unexpected database errors.
- Unusual query patterns in logs.
- Sudden spikes in application exceptions.
- Repeated attempts with special characters (' OR 1=1 --).
Mitigation & Defense Strategies
- Use prepared statements and parameterized queries.
- Validate and sanitize all user inputs.
- Implement least privilege database access.
- Deploy Web Application Firewalls (WAF).
- Regularly perform code reviews and penetration testing.
Want to see how injection vulnerabilities can be simulated?
Explore Injection Simulation