OWASP Top 10 Explained: How Each Attack Works
The OWASP Top 10 is the best-known list in application security: ten categories of weakness that account for most real-world breaches of web applications and APIs. It is published by the Open Worldwide Application Security Project, a non-profit, and built from data on hundreds of thousands of tested applications plus a survey of practitioners. It is an awareness document, not a checklist: each entry is a family of related mistakes. This page explains each one the way an attacker sees it, shows a small example, and points to a place where you can try it.
What changed in this edition: The 2025 edition replaced the 2021 list. Two categories are new: Software Supply Chain Failures (a wider version of the old "Vulnerable and Outdated Components") and Mishandling of Exceptional Conditions. Server-Side Request Forgery was folded into Broken Access Control, and Security Misconfiguration moved up to second place.
Try the attacks yourself in the Attack Lab → Small simulations in your browser. Nothing to install, no real system involved.
A01:2025 Broken Access Control
The application knows who you are but does not properly check what you are allowed to do. Users can read or change things that belong to someone else, or use functions meant for administrators.
How the attack works
The attacker signs in with an ordinary account and then changes something the application trusted: an ID in the address, a hidden form field, a role name in a request. If the server does not check ownership or permission for that exact request, it answers. Asking the server to fetch an internal address on your behalf (server-side request forgery) belongs here too.
Example
An invoice page loads /api/invoices/1041. Changing the number to 1042 returns another customer's invoice with their bank details.
How to defend
- Deny by default: every request is checked on the server for this user, this action and this record.
- Check ownership in the data layer too (row-level security), so one forgotten check in the application is not fatal.
- Use one shared authorisation component instead of checks scattered through the code.
- Log and alert on repeated access-denied results.
Try it
- Attack Lab: Read another customer's invoice by changing one number, then switch on the ownership check.
- RBAC Visualizer: Model roles, grants and inheritance and inspect each role's effective privileges.
- PostgreSQL Playground: Write a row-level security policy and query the table as two different users.
Who deals with this at work: application security engineer, backend developer, penetration tester. Want to become one? Careers and free mentoring →
A02:2025 Security Misconfiguration
The software may be fine, but it is set up insecurely: default passwords, features nobody needs left switched on, storage open to the internet, missing security headers, error pages that show internals.
How the attack works
Attackers scan the internet for known defaults: admin consoles, sample applications, open storage buckets, debug endpoints, files such as .env or .git/config left in the web root. Nothing has to be "hacked"; they use what was left open.
Example
A cloud storage bucket holding customer exports is readable by anyone with the address, because the default permission was never changed.
How to defend
- Build every environment from the same hardened, automated configuration, and review it like code.
- Remove or disable what is not used: features, sample content, accounts, ports.
- Change every default credential; keep secrets out of the web root and out of the repository.
- Scan your own systems the way attackers do, and fix what the scan finds.
Try it
- x86 Virtual Machines: A Linux machine in your browser: try dig, curl and ip to see what a host exposes.
Who deals with this at work: cloud engineer, platform engineer, DevOps engineer, security architect. Want to become one? Careers and free mentoring →
A03:2025 Software Supply Chain Failures
Most of an application is code its team did not write: libraries, build tools, container images, update mechanisms. A weakness or a deliberate backdoor anywhere in that chain becomes your problem.
How the attack works
Attackers compromise something many others depend on: they take over a maintainer's account and publish a malicious version of a popular package, register look-alike package names, or break into a vendor's build system so that the official update carries their code. Or they simply use a known flaw in an old component that was never updated.
Example
In 2025 the self-spreading "Shai-Hulud" worm published malicious versions of npm packages, stole secrets from the machines that installed them, and used the stolen tokens to infect further packages.
How to defend
- Know what you run: an inventory of components (a software bill of materials), including indirect dependencies.
- Pin versions, use lock files, take packages only from official sources, and prefer signed ones.
- Scan continuously for known vulnerabilities and remove dependencies you do not need.
- Protect the build pipeline itself: multi-factor authentication, least privilege, reviewed changes.
Who deals with this at work: DevSecOps engineer, platform engineer, software engineer. Want to become one? Careers and free mentoring →
A04:2025 Cryptographic Failures
Sensitive data is not protected by encryption, or is protected by encryption that does not hold: old algorithms, keys stored next to the data, passwords stored with a fast hash, traffic sent in clear text.
How the attack works
The attacker rarely "breaks" the mathematics. They read data that was never encrypted, find the key in a configuration file or the source code, downgrade a connection to a weak protocol, or look up leaked password hashes in a ready-made table.
Example
A leaked user table stores passwords as plain SHA-256. Common passwords are recovered instantly from a lookup table, the rest at billions of guesses a second.
How to defend
- Classify data and encrypt what is sensitive, in transit (TLS) and at rest.
- Store passwords with a slow, salted password hash: Argon2id, bcrypt, scrypt or PBKDF2.
- Use current, standard algorithms with authenticated encryption (AES-GCM), never home-made schemes.
- Keep keys in a key management service, apart from the data, and rotate them.
Try it
- Attack Lab: Crack a leaked password table, then add a salt and a slow hash and see what changes.
- Crypto & JWT Playground: Encrypt, hash and sign in notebooks to see what each primitive does.
- Encryption Pipeline Builder: Chain encryption and signing steps and watch the output change.
Who deals with this at work: security engineer, data protection engineer, backend developer. Want to become one? Careers and free mentoring →
A05:2025 Injection
Data supplied by a user is treated as part of a command. The classic forms are SQL injection (the data becomes part of a database query) and cross-site scripting, XSS (the data becomes script that runs in another user's browser).
How the attack works
The attacker types characters that have a meaning in the target language, such as a quote in SQL or a tag in HTML, to end the place where data was expected and start writing commands. The server or the browser cannot tell the difference, because code and data were joined into one string.
Example
A login builds its query by pasting in the user name. Entering admin' -- as the name comments out the password check and signs the attacker in as the administrator.
How to defend
- Keep data and commands apart: parameterised queries for SQL, safe APIs for the operating system.
- Encode output for the place it goes (HTML, attribute, URL) so the browser shows it as text.
- Validate input against what is expected, as a second line, not the only one.
- Give the application's database account only the rights it needs, and add a Content Security Policy.
Try it
- Attack Lab: Sign in as the administrator without the password, then switch to a parameterised query.
- Attack Lab: Post a comment that runs as code in another visitor's page, then encode the output.
- PostgreSQL Playground: Use PREPARE and EXECUTE in a real PostgreSQL to see how parameters are passed.
Who deals with this at work: application security engineer, web developer, penetration tester. Want to become one? Careers and free mentoring →
A06:2025 Insecure Design
The flaw is in the idea, not the code. The application works exactly as designed, and the design allows abuse: no limit on attempts, a recovery process that trusts easily guessed answers, a business rule that can be turned against the business.
How the attack works
The attacker reads the application like a rule book and looks for the move nobody thought of: repeating a step, doing things in a different order, automating what was meant for one person, combining two harmless features.
Example
A cinema lets a group book up to fifteen seats before paying a deposit. Attackers script the booking flow and reserve every seat in every cinema, with no intention to pay.
How to defend
- Threat-model before building: who would abuse this, how, and what would it cost us?
- Write misuse cases next to use cases, and test them.
- Set limits by design: per user, per time, per amount.
- Reuse proven patterns and components for sign-in, recovery and payments.
Try it
- Excalidraw Whiteboard: Draw the data flow of a system you know and mark where trust changes hands.
Who deals with this at work: security architect, software architect, product security engineer. Want to become one? Careers and free mentoring →
A07:2025 Authentication Failures
The application can be fooled about who is signing in, or lets a session be taken over: weak or reused passwords are accepted, there is no second factor, session tokens are predictable or never expire.
How the attack works
Attackers try passwords leaked from other sites (credential stuffing), try a few common passwords against many accounts (password spraying), steal or guess session tokens, or trick the user into approving a sign-in for them, as in device code phishing.
Example
A user enters a "meeting code" on the real Microsoft sign-in page. The code was started by the attacker, who now receives tokens for the user's mailbox. The user's password and second factor were never stolen.
How to defend
- Multi-factor authentication, preferably phishing-resistant (passkeys, FIDO2).
- Block known-leaked and common passwords; rate-limit and monitor sign-in attempts.
- Use a standard identity provider and standard protocols (OpenID Connect, SAML) instead of building your own.
- Short-lived tokens, secure session cookies, and real sign-out that invalidates the session on the server.
Try it
- Attack Lab: See why stolen password hashes turn into passwords, and what slows that down.
- OIDC Authorization Code Flow: Step through a sign-in with OpenID Connect and watch what is checked.
- Device Code Flow Playground: Run the device code flow yourself to see what the attacker abuses.
- JWT Playground: Decode a token, change a claim and watch the signature check fail.
Who deals with this at work: identity and access management engineer, security engineer, SOC analyst. Want to become one? Careers and free mentoring →
A08:2025 Software or Data Integrity Failures
The application trusts code or data without checking that it is genuine and unchanged: updates without a signature, objects rebuilt from data a user controls, scripts loaded from a server someone else runs.
How the attack works
The attacker changes something on its way to you, or sends a crafted object where the application expects its own. If nothing verifies a signature or a checksum, the altered code runs, or the altered data is believed.
Example
An application stores the user's role in a cookie as an encoded object without a signature. The attacker decodes it, changes "user" to "admin" and sends it back.
How to defend
- Verify digital signatures on updates, packages and container images.
- Sign or authenticate any data that leaves your control and comes back (tokens, cookies, messages).
- Never rebuild objects from untrusted data with formats that can carry code.
- Require review for changes to code and to the build pipeline.
Try it
- JWT Playground: Change one character in a signed token's payload and see verification fail.
- Encryption Pipeline Builder: Add a signing step and check what happens when the data changes.
Who deals with this at work: DevSecOps engineer, software engineer, security engineer. Want to become one? Careers and free mentoring →
A09:2025 Security Logging and Alerting Failures
An attack happens and nobody notices, because the relevant events are not logged, the logs are not watched, or an alert fires and no one acts on it.
How the attack works
This is not a way in but what lets every other attack succeed quietly. Attackers work slowly, stay under thresholds, and often remain inside for weeks. Many breaches are first discovered by someone outside the organisation.
Example
An attacker tries two passwords an hour against each of a thousand accounts. No single account is locked, no alert is defined for the pattern, and after a week several accounts are taken over.
How to defend
- Log sign-ins, failures, access-control denials and administrative actions, with who, what, when and from where.
- Send logs to one place where they can be searched and cannot be altered by the systems that write them.
- Define alerts for known attack patterns, and test that they fire and that someone responds.
- Keep personal data and secrets out of the logs.
Try it
- SQL Playground: Load a sign-in log and find the attack patterns with SQL.
- Data Lab: Query a log with SQL, then plot events over time to see the attack as a spike.
Who deals with this at work: SOC analyst, detection engineer, security engineer. Want to become one? Careers and free mentoring →
A10:2025 Mishandling of Exceptional Conditions
The application behaves badly when something unexpected happens: it shows internal details in an error message, lets a request through because a check crashed ("failing open"), or leaves a half-finished transaction behind.
How the attack works
The attacker causes errors on purpose, with malformed input, huge files, interrupted connections or requests sent at the same moment, and watches what happens. Error messages reveal how the system is built; a security check that fails open is a door; an interrupted transfer can be repeated.
Example
A payment service asks a separate fraud-check service for approval. When that service times out, the code treats the missing answer as "approved".
How to defend
- Fail closed: when a check cannot be completed, the answer is no.
- Handle errors where they occur; show users a generic message and keep the details in the log.
- Make multi-step operations all-or-nothing, and roll back completely on failure.
- Limit rates and sizes, and alert on repeated errors: they often mean someone is probing.
Try it
- Attack Lab: Type a single quote as the user name and read what the database error gives away.
Who deals with this at work: software engineer, site reliability engineer, application security engineer. Want to become one? Careers and free mentoring →