Web attacks: how the common ones work, and what stops them
A web attack uses an application's own requests against it: it sends input the code mishandles, or asks for something the user should not be allowed to do. Unlike a flood, it needs no volume. The pages in this section take the common web application attacks one at a time, by the name people search for them.
Quick facts
- What they target
- The application's handling of input, sessions and permissions
- Volume needed
- Usually none: a single request can be enough
- Where they are listed
- OWASP Top 10:2025 groups them into categories
- Where they are fixed
- In the application code and configuration
- What a WAF adds
- It matches recognisable attack shapes in requests, which buys time; it does not fix the code
Each attack page links up to its OWASP category, where the category's data and prevention guidance are summarised.
The attacks in this section
Three attacks account for most of what people look up, and the rest of the section follows the same pattern: what goes wrong, which OWASP category it belongs to, and what a filter can see.
| Attack | What goes wrong | OWASP category | What a WAF can see |
|---|---|---|---|
| SQL injection | Input changes a database query | A05 Injection | Most: query syntax arrives in the request |
| Cross-site scripting | Input is sent back to other users as script | A05 Injection | Part: markup in the request; not every DOM-based case |
| Cross-site request forgery | A user's browser is made to send a request they did not intend | A01 Broken Access Control | Little: the forged request looks legitimate |
| Command injection | Input reaches an operating system command or code evaluator | A05 Injection | Most: shell syntax arrives in the request |
| Server-side request forgery | The server fetches an address the attacker chose | A01 Broken Access Control | Part: obvious internal targets, not redirects or DNS tricks |
| XML external entities | An XML parser fetches files or URLs named in the document | A02 Security Misconfiguration | Part: entity declarations in plain XML bodies |
| Clickjacking | Another site frames your page under a decoy | A06 Insecure Design | None: it happens in the browser |
| Path traversal | A file name in the request climbs out of the intended folder | A01 Broken Access Control | Most: traversal sequences in parameters |
| CRLF injection | Line breaks in input start new headers or log lines | A05 Injection | Part: encoded line breaks in single-line values |
| HTTP request smuggling | A front-end and a back-end disagree on where a request ends | A06 Insecure Design | Part: conflicting length headers, where the filter refuses them |
| Business logic flaws | Valid requests produce outcomes the business never intended | A06 Insecure Design | None: there is no pattern to match |
| Insecure direct object reference | Changing an identifier reaches another user's object | A01 Broken Access Control | None: the request is valid |
| Session hijacking | A stolen or planted session token is used as the user | A07 Authentication Failures | Little: the script that steals cookies, not the stolen token |
| CORS misconfiguration | A response lets any site read a signed-in user's data | A02 Security Misconfiguration | None: it is in the response and the browser |
Injection is the largest family: SQL injection changes a database query, XSS sends script to other users, command injection reaches the operating system and CRLF injection plants line breaks in headers. A second family abuses trust: CSRF and SSRF forge requests, while session hijacking reuses a stolen token and IDOR reaches another user's record.
The rest are about the shape of the system: XXE in XML parsers, path traversal in file names, clickjacking in framing, CORS error causes in response headers, HTTP request smuggling between servers and the logic flaw class that no pattern catches. Also covered: remote code execution, file inclusion, file upload, the open redirect, NoSQL injection and HTTP parameter pollution, server-side template injection, web cache poisoning, host header injection and LDAP injection. More: insecure deserialization, XPath injection, Log4Shell and WebSocket hijacking, subdomain takeover, DOM-based XSS, CSV injection and web cache deception, prototype pollution and XML bomb, user enumeration, session fixation, formjacking and forced browsing, email header injection and DNS rebinding.
More attacks are added to this section as their pages are written; the OWASP category pages already describe the others at category level.
Attacks without their own page yet
An open redirect, also searched as an open URL redirection or external redirect vulnerability, is a page that sends visitors to an address taken from the request. Attackers use it to put a trusted site's name in front of a phishing link; the fix is to check the destination against an allowlist of addresses the site means to use. Mass assignment happens when a framework binds request parameters straight into program objects, so fields the form never showed can be set too; the fix is an allowlist of the fields a request may fill in.
When injected input runs attacker-chosen code on the server, the outcome is called remote code execution (RCE); command injection is the road to it in this section.
Why web attacks work
Almost every web attack comes down to one of three mistakes: data that is treated as instructions, a request that is trusted because of where it seems to come from, or a permission that is checked in the page but not on the server.
None of these is visible from outside until someone tries it, which is why the same few attacks have stayed common for years. The fix is known for each; applying it everywhere is the hard part.
What a WAF can and cannot do about them
A web application firewall reads requests, so it does well where an attack has to put recognisable syntax into one: query fragments, script tags, command separators. It can refuse those while the code is fixed, which is called virtual patching.
It does poorly where the attack request is indistinguishable from a real one: a forged request carrying the victim's own cookies, or a request for another user's record. Those are fixed only in the application, by checking intent and ownership on the server.
Where to start fixing
- Keep data out of instructions. Parameterised queries and output encoding close injection and cross-site scripting.
- Check every request on the server. Ownership, role and intent, not only what the page allowed the user to click.
- Make cookies harder to misuse. The SameSite attribute and anti-forgery tokens stop forged cross-site requests.
- Watch before enforcing. Run filtering in monitor mode first to see which of your own fields look like attacks.
How to secure a web application
Building secure web applications is work in four places; the list below is how to secure a web application beyond the four steps above.
- Design. Secure web application design begins before the code: decide who may see and change what.
- Development. Developing secure web applications means putting the checks in shared code: one query layer, one output encoder, one authorisation check.
- Configuration. Security Misconfiguration is a category of its own in OWASP Top 10:2025, so turn off what is unused.
- Testing. Dynamic application security testing (DAST) sends requests to the running application, so it works without the source code. A scanner finds weaknesses to fix; a WAF only filters requests for them.
Questions
What are web attacks?
Web attacks are attacks on a website or web application through its own requests: input that the code mishandles, or requests for actions the user should not be allowed to take. SQL injection, cross-site scripting and cross-site request forgery are the most common.
What is the most common web application attack?
Injection attacks, including SQL injection and cross-site scripting, are among the most common; OWASP places injection in its Top 10:2025, alongside broken access control in first place.
Can a WAF stop web attacks?
Partly. A WAF can refuse requests carrying recognisable attack syntax, which protects vulnerable code while it is fixed. It cannot stop attacks that look like legitimate requests, such as forged requests or access to another user's data.
How do you secure a web application?
Fix the weaknesses in the application itself, then add filtering around it. Keep data out of instructions with parameterised queries and output encoding, check ownership and role on the server for every request, set the SameSite attribute on cookies, and test the running application with a scanner. A WAF buys time but does not replace the fixes.