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.

Section Web attacks Updated Attacks by name

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.

AttackWhat goes wrongOWASP categoryWhat a WAF can see
SQL injectionInput changes a database queryA05 InjectionMost: query syntax arrives in the request
Cross-site scriptingInput is sent back to other users as scriptA05 InjectionPart: markup in the request; not every DOM-based case
Cross-site request forgeryA user's browser is made to send a request they did not intendA01 Broken Access ControlLittle: the forged request looks legitimate
Command injectionInput reaches an operating system command or code evaluatorA05 InjectionMost: shell syntax arrives in the request
Server-side request forgeryThe server fetches an address the attacker choseA01 Broken Access ControlPart: obvious internal targets, not redirects or DNS tricks
XML external entitiesAn XML parser fetches files or URLs named in the documentA02 Security MisconfigurationPart: entity declarations in plain XML bodies
ClickjackingAnother site frames your page under a decoyA06 Insecure DesignNone: it happens in the browser
Path traversalA file name in the request climbs out of the intended folderA01 Broken Access ControlMost: traversal sequences in parameters
CRLF injectionLine breaks in input start new headers or log linesA05 InjectionPart: encoded line breaks in single-line values
HTTP request smugglingA front-end and a back-end disagree on where a request endsA06 Insecure DesignPart: conflicting length headers, where the filter refuses them
Business logic flawsValid requests produce outcomes the business never intendedA06 Insecure DesignNone: there is no pattern to match
Insecure direct object referenceChanging an identifier reaches another user's objectA01 Broken Access ControlNone: the request is valid
Session hijackingA stolen or planted session token is used as the userA07 Authentication FailuresLittle: the script that steals cookies, not the stolen token
CORS misconfigurationA response lets any site read a signed-in user's dataA02 Security MisconfigurationNone: 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.

WHICH MISTAKE EACH ATTACK USES DATA TREATED AS INSTRUCTIONS TRUST IN THE ORIGIN CHECK ONLY IN THE PAGE SQL INJECTION CROSS-SITE SCRIPTING CROSS-SITE REQUEST FORGERY // three attacks, two kinds of mistake
// the mistake behind each attack decides where it is fixed

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

  1. Keep data out of instructions. Parameterised queries and output encoding close injection and cross-site scripting.
  2. Check every request on the server. Ownership, role and intent, not only what the page allowed the user to click.
  3. Make cookies harder to misuse. The SameSite attribute and anti-forgery tokens stop forged cross-site requests.
  4. 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.