Web Attack Types Reference: Signs and Core Defenses

A reference table of web attack types with the exact log evidence of each and its core defense; from SQLi and XSS to CSRF and SSRF, along with real errors and common mistakes.

6 min Updated 17 Nov 2026

You've opened the Apache access log and see an odd line: GET /product.php?id=1%20UNION%20SELECT%20username,password%20FROM%20users with a 200 status code. That means the request wasn't just not rejected — it got a full response. The next question is always the same: which type of attack is this, how serious is it, and what's the first thing I should do. This text is written for that exact moment; a short reference of definition, sign, and core defense, not a step-by-step tutorial.

Web Attack Types Reference Table: Definition, Sign, Defense

I've arranged the table below so you can get from the sign to the attack type. The last column is the most important: if you can only do one thing, that's it.

AttackShort definitionSign of occurrenceCore defense
SQL InjectionInjecting SQL commands through user inputQuote or UNION SELECT in the query string; You have an error in your SQL syntax error in the responsePrepared statement; never build SQL strings by concatenation
XSSExecuting the attacker's script in another user's browserReflected parameter containing <script>; stolen session cookieContext-based output encoding; Content-Security-Policy header
CSRFSending a valid request with the victim's session, without their knowledgePassword or email change without a corresponding login log; external Referer on a POST requestPer-session CSRF token; SameSite=Lax cookie
SSRFForcing the server to make a request to an attacker-chosen destinationOutbound request to 169.254.169.254 or 127.0.0.1 in the firewall logDestination allowlist; blocking internal ranges at the network layer
Command InjectionInjecting OS commands through input; | $( characters in a parameter; unexpected child processAvoid the shell; array-based execution and strict validation
Path TraversalReading files outside the permitted directory../../etc/passwd in the URL; 200 code on a forbidden pathTake basename and check the final path with realpath()
File UploadUploading an executable file instead of an image.php file in wp-content/uploads; sudden mtime changeValidate the real MIME; disable PHP execution in uploads
Brute ForceMass guessing of passwords or tokensHundreds of POSTs to wp-login.php from one IP per minuteRate limit; two-factor authentication
DDoSSaturating bandwidth or resources with massive trafficSudden TTFB drop; SYN flood in netstatScrubbing layer and Anycast; filtering at the network edge
Session HijackingStealing or reusing a session identifierTwo different geographic IPs with one session id in a short intervalHttpOnly; Secure cookie; session rotation after login

SQL Injection: Why One Quote Is Enough

The error You have an error in your SQL syntax near ''' at line 1 in the HTML response means the input reached the database directly. The attacker first maps out the columns with this very error, then extracts data with UNION SELECT. Even if error output is disabled, the difference in response time between SLEEP(5) and normal mode is enough to extract blindly.

The real defense is a prepared statement, not mysql_real_escape_string. Escaping with the wrong charset (for example, connecting with latin1 while the table is utf8) gets bypassed. If you have legacy code and a rewrite isn't possible, at least set the connection with the correct charset and disable display_errors in production.

XSS and CSRF: Two Attacks That Get Confused

XSS executes a script in the victim's browser; CSRF sends a request with the victim's session, without any code being executed. The sign of XSS in the log is parameter reflection. The sign of CSRF isn't in the log; it's in the absence of a log. The password has been changed and no successful login was recorded.

For XSS, context-based output encoding (HTML, attribute, JavaScript) and a strict CSP that forbids unsafe-inline have the greatest effect. The guide configuring security headers for a WordPress site has exactly these headers with ready-made syntax. For CSRF, a per-session token and a SameSite=Lax cookie close almost all POST scenarios.

This is where they go wrong

Relying on SameSite=Strict as a replacement for a CSRF token. The problem is that Strict doesn't send the cookie even on a link click from an email or Google results; the user enters the site and finds themselves logged out, logs in again, and the technical team spends weeks chasing a session bug. And the sign is exactly this: random logouts only when the user comes from an external link.

SSRF: An Attack That Starts From Inside the Network

Any feature that takes a URL from the user (image import, webhook, link preview) is an SSRF candidate. Instead of a public address, the attacker sends http://169.254.169.254/latest/meta-data/ and reads the cloud server metadata. In an internal environment, 127.0.0.1:6379 means Redis without a password.

Filtering the URL string isn't enough; DNS rebinding and redirects bypass it. Resolve the destination, compare the final IP against private ranges, and restrict outbound requests at the network layer. If you have a server that should only talk to one specific API, lock outbound traffic to that IP in the firewall.

Network Layer: Where to Catch DDoS and Brute Force

A volumetric attack can't be solved in the application. When 20 Gbps of SYN traffic hits the network card, nginx doesn't even get a chance to read its config. The filtering must be before your server; DDoS protection at the network edge does exactly this and delivers clean traffic.

Brute Force, however, is at the application layer. With fail2ban and the rule below, three failed attempts in ten minutes means a 24-hour ban:

[sshd]
enabled = true
maxretry = 3
findtime = 10m
bantime = 24h

Put the same logic in place for wp-login.php too. You can also block the list of malicious IPs at the control panel and htaccess level; the method is covered in blocking malicious IPs.

After a Breach: What to Check First

If you see a suspicious file in uploads, first close off access, then delete. find /var/www -type f -perm -o+w -mtime -7 shows files writable by everyone that have changed recently; in a healthy WordPress install this output should be almost empty. The guide setting secure file permissions has the correct directory and file values: 755 for directories, 644 for files, and 600 for wp-config.php.

Then go after the accounts. A user in the users table with the administrator role and a registration date of today is almost always a leftover from the breach. Revoke the passwords of all accounts, SSH keys, and API tokens. Make two-factor authentication mandatory for admins; enabling two-factor authentication blocks the attacker's login even when the password has leaked.

A note about WAF

A WAF is good, but it doesn't replace fixing the code, and it has a cost too: the more aggressive the rule, the higher the chance of blocking legitimate traffic. I like WAF as a net, not a wall. If you don't have the budget to maintain rules, the same CSP and prepared statement and patch updates have more effect than a WAF with default rules that no one reviews.

Frequently Asked Questions

What's the difference between XSS and CSRF in one sentence?

In XSS, the attacker's code is executed in the victim's browser, but in CSRF no code is executed and the attacker only uses the victim's valid session to send a request. That's why their defenses differ too: output encoding and CSP for XSS, token and SameSite for CSRF.

How do I find out if my site has SQL Injection?

The first sign is an SQL syntax error in the response or a difference in response time to tampered inputs. Automated scanning tools like sqlmap find it faster, but the definitive result comes from code review: anywhere an SQL string is built by concatenating input is vulnerable.

Do security headers stop all web attack types?

No. Headers like CSP and HSTS mainly make XSS and downgrade-based attacks harder, but they have no effect on SQL Injection or SSRF. These headers are one layer, not a complete solution; input validation and prepared statements are still necessary.

After detecting an attack, what's the first step?

Save the logs before any change; wiping logs at the moment of cleanup destroys the evidence. Then close off the attacker's access (rotate passwords and keys), and finally clean up the files. The reverse order usually means the attacker comes back.

If you have a suspicious line in the log right now, before doing anything else, copy that line and check the source IP in the DNS and network lookup tools. Then go to the code. Remember one simple rule: any user input, until it's validated, isn't data; it's code.

Was this page helpful?