Common types of attack on web applications
Attacks on web applications fall into a small number of recurring types, and each type has a typical cause, such as query text built from request data or a record looked up by ID without an ownership check. Table 1 lists eight common types; each has its own main article.
Summary
| No. | Type | Definition | Typical cause | OWASP Top 10:2025 | Main article |
|---|---|---|---|---|---|
| 1 | Injection | Input changes the structure of a database query or command | Query text assembled from request data | A05 | SQL injection |
| 2 | Cross-site scripting | Input supplied by one user runs as script in other users' browsers | User content inserted into HTML without encoding | A05 | Cross-site scripting |
| 3 | Broken access control | A user reads or changes data that belongs to another user | Records looked up by ID without an ownership check | A01 | Insecure direct object reference |
| 4 | Exposed credentials | A secret key is readable by unauthorised people | Keys committed to a repository or shipped in client-side code | A07 | Exposed credentials in source code repositories |
| 5 | Authentication attacks | Passwords are guessed, or reused from other breaches | No limit on sign-in attempts; no second factor | A07 | Credential stuffing |
| 6 | Security misconfiguration | A file, service or setting is more open than intended | Default settings, debug pages, open ports, public buckets | A02 | Exposed sensitive files |
| 7 | Vulnerable and malicious dependencies | Third-party code brings a known flaw or hostile code | Outdated packages; packages installed without review | A03 | Vulnerable dependencies |
| 8 | Server-side request forgery | The server is made to fetch an address chosen by the attacker | URL-fetching features with no allow-list | A01 | Server-side request forgery |
Injection
Injection happens when user input, joined into a query or a command, changes what that query or command does. In SQL injection, the form covered in the main article, the input alters a database query.1 The cause is query text assembled by joining strings, and passing values as parameters removes it. Command injection and template injection are other forms of the same weakness.2
Cross-site scripting
In cross-site scripting (XSS), text supplied by one user is placed in a page without encoding and runs as script in the browsers of other users.3 The script runs with the victim's session, so it can read the page, act as the victim or send them to another site. The defences are Output encoding by the template system, keeping away from functions that insert raw HTML, such as React's dangerouslySetInnerHTML, and a Content Security Policy.
Broken access control
A user who changes a number in a URL and gets back another user's data is exploiting broken access control, the class of weakness that lets a user reach data or functions beyond their permissions. That case has its own name, insecure direct object reference, because the application returns a record by its identifier without checking who owns it.4 In applications built on Supabase, the same weakness appears as a table without row level security.
Exposed credentials
API keys, tokens and passwords become exposed when they are committed to a repository, included in JavaScript sent to the browser, or written to logs. Anyone who reads the credential can use the service as the application.5 The remedy is to revoke the credential at the provider; deleting the file leaves it in the repository's history. Related articles: Client-side code exposure, Abuse of leaked API keys.
Authentication attacks
Authentication attacks target the sign-in form. In credential stuffing, an attacker tries username and password pairs leaked from other services; in a brute-force attack, the attacker tries many passwords or one-time codes in turn.6 Both succeed where the application does not limit the number of attempts or does not require a second factor. A stolen session cookie skips the sign-in altogether; see Session hijacking.
Security misconfiguration
A misconfigured service or setting is more open than its owner intended: default accounts left enabled, debug pages and directory listings left on, database ports reachable from the internet, or cloud storage buckets readable by anyone.7 None of these needs a flaw in the application's own code, and automated scanners find them by requesting common paths and ports.
Vulnerable and malicious dependencies
A package version with a published vulnerability exposes every application that installs it. A malicious package, often named to resemble a popular one, runs its own code when it is installed.8 Keeping packages updated, reviewing a new dependency before installing it and committing a lock file reduce both risks.
Server-side request forgery
An application that fetches a URL supplied by a user can be handed the address of an internal service instead, such as a cloud provider's metadata endpoint or a database on the private network. This is server-side request forgery (SSRF).9 The request leaves from inside the network, past firewalls that block outside traffic. The defence is an allow-list of permitted destinations, checked after the host name has been resolved.
Relationship to other classifications
The table's fifth column refers to the OWASP Top 10:2025, a ranking of the most serious security risks to web applications published by the Open Worldwide Application Security Project (OWASP).10 The Top 10 files cross-site scripting under Injection (A05)2 and SSRF under Broken Access Control (A01), the category it ranks first.11 Each type also matches one or more entries in the Common Weakness Enumeration (CWE), cited in the infobox of its main article. MITRE ATT&CK describes the same attacks from the attacker's side, as techniques grouped by tactic. Mapping to the OWASP Top 10:2025 and Mapping to MITRE ATT&CK place every article of this wiki in both schemes.
See also
- Stages of an attack on a web application
- Mapping to the OWASP Top 10:2025
- Mapping to MITRE ATT&CK
- Securing a Next.js and Supabase application
References
- back "CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')". Common Weakness Enumeration. MITRE.
- a b "A05:2025 Injection". OWASP Top 10:2025. OWASP Foundation.
- back "CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')". Common Weakness Enumeration. MITRE.
- back "CWE-639: Authorization Bypass Through User-Controlled Key". Common Weakness Enumeration. MITRE.
- back "CWE-798: Use of Hard-coded Credentials". Common Weakness Enumeration. MITRE.
- back "A07:2025 Authentication Failures". OWASP Top 10:2025. OWASP Foundation.
- back "A02:2025 Security Misconfiguration". OWASP Top 10:2025. OWASP Foundation.
- back "A03:2025 Software Supply Chain Failures". OWASP Top 10:2025. OWASP Foundation.
- back "CWE-918: Server-Side Request Forgery". Common Weakness Enumeration. MITRE.
- back "OWASP Top 10:2025". OWASP Foundation.
- back "A01:2025 Broken Access Control". OWASP Top 10:2025. OWASP Foundation.
External links
- OWASP Top Ten project, OWASP Foundation
- OWASP Cheat Sheet Series, prevention guidance by topic