A tour of the most common web attacks (injection, XSS, broken access control) and how each is stopped.
OWASP (the Open Worldwide Application Security Project) is a non-profit that publishes free security guidance. Its best-known list, the OWASP Top 10, names the most common and most damaging kinds of web application weakness, so teams know what to fix first.
Attackers do not invent new tricks for every site. They try the same small set of mistakes over and over, because developers keep making them. The Top 10 is a ranked list of those mistakes, based on data from many real applications. It is a starting checklist, not a complete standard.
The categories below are those on the recent list. Names and order change between editions, so treat this as a map and look up the current edition for the exact numbering.
| Category | How it happens (one line) | Main defence |
|---|---|---|
| Broken access control | The server does not check that this user may see this object (change the id in the URL, see someone else's data) | Check permission on the server for every request and object |
| Cryptographic failures | Sensitive data sent or stored in clear, or weak algorithms and keys | TLS everywhere, strong algorithms, managed keys |
| Injection (SQL, command) | Input is pasted into a command and becomes code | Parameterized queries, no shell string building |
| Insecure design | A flaw in the plan itself, such as no limit on password guesses | Threat modelling, secure design patterns |
| Security misconfiguration | Default passwords, open storage buckets, debug pages left on | Hardened, repeatable configs, regular scans |
| Vulnerable and outdated components | A library with a known hole is still in use | Track dependencies, patch quickly |
| Identification and authentication failures | Weak passwords, no lockout, bad session handling | MFA, slow password hashes, safe sessions |
| Software and data integrity failures | Unsigned updates, untrusted build steps, unsafe deserialization | Sign and verify code and data, protect the pipeline |
| Logging and monitoring failures | Attacks happen and nobody notices | Log security events, alert on them |
| Server-side request forgery (SSRF) | The server is tricked into calling an address the attacker picks | Allow-list destinations, block internal ranges |
| Attack | What the attacker controls | Why it works | Defence |
|---|---|---|---|
| SQL injection | Text that reaches a database command | The server builds the command by joining strings | Parameterized queries, least-privilege database account |
| XSS: stored | Text saved and shown to other users | The page prints it as HTML without encoding | Output encoding, Content Security Policy |
| XSS: reflected | Text in a link that is echoed back in the page | The page prints the request back unsafely | Output encoding, input checks |
| XSS: DOM-based | Data read by browser script, such as the URL fragment | Client code writes it into the page as HTML | Use text APIs, not innerHTML; trusted types |
| CSRF | A request sent by the victim's own browser | Cookies are sent automatically with any request | SameSite cookies, anti-forgery tokens |
| SSRF | A URL the server will fetch | The server can reach places the attacker cannot | Allow-list hosts, block internal and metadata addresses |
| IDOR / broken access control | An id in a URL or body | The server trusts that the id belongs to the caller | Check ownership on the server for every object |
query = "SELECT * FROM users WHERE name = '" + name + "'"
query = "SELECT * FROM users WHERE name = ?" run(query, [name])
With the second form the database has already understood the command before it sees the value, so the value can never change its meaning. Quotes, comments and keywords in the input are just characters. The pages on Input Validation and CSRF go deeper on those two topics. This page is the map that ties them together.
If the URL is /orders/1002, the server must ask: "does the logged-in user own order 1002?" Hiding the link, or using hard-to-guess ids, is not a check. See Authentication vs Authorization and RBAC.
SELECT * FROM users WHERE name = '' OR '1'='1' AND pass_hash = '<hash of the typed password>'<p class="comment"><script>alert('hi')</script></p>This is a text simulation only. No database is queried and no HTML from the boxes is ever put on this page; the lines above are plain text.
| Term | Meaning in easy words |
|---|---|
| OWASP | A non-profit that publishes free security guidance and tools |
| OWASP Top 10 | A ranked awareness list of common web application risk categories |
| Injection | Input that is run as part of a command, such as SQL or a shell command |
| Parameterized query | A query where the values are sent separately from the command text |
| XSS | Cross-site scripting: attacker script runs in another user's browser |
| Output encoding | Turning special characters into safe text for where they will appear |
| CSP | Content Security Policy: a header that limits which scripts a page may run |
| CSRF | Making a victim's browser send a request they did not intend |
| SSRF | Tricking a server into making a request to a place the attacker chooses |
| IDOR | Insecure direct object reference: using an id you should not be allowed to use |
| Least privilege | Give code and people only the access they need |
| Threat modelling | Thinking through how a design could be attacked before building it |
| Choice | We gain | We lose |
|---|---|---|
| Strict input validation | Fewer odd inputs reach deep code | More rejected, sometimes valid, input |
| Strict CSP | A strong second line against XSS | Effort to remove inline scripts |
| Deny-by-default access | No accidental exposure | More rules to write and maintain |
| Frequent dependency updates | Fewer known holes | Risk of breaking changes, more testing |
| Detailed security logging | Faster detection and investigation | More storage, risk of logging sensitive data |