The OWASP Top 10 is the most widely used list of web application security risks. It is published by the Open Worldwide Application Security Project (OWASP), a non-profit, and is based on data from millions of tested applications. The newest edition is the OWASP Top 10:2025 — the first update since 2021.
This guide explains all ten risks in plain language, with a real-world example of each and code showing the vulnerable and the safe version (in PHP and Laravel, but the ideas apply to every language). You do not need to be a security expert — you need to recognise these patterns in your own code.
The OWASP Top 10:2025 at a glance
| # | Risk | One-line meaning |
|---|---|---|
| A01 | Broken Access Control | Users can reach data or actions they should not (now includes SSRF). |
| A02 | Security Misconfiguration | Unsafe defaults, debug mode, exposed files and open settings. |
| A03 | Software Supply Chain Failures | Risky or compromised packages, build tools and dependencies. New. |
| A04 | Cryptographic Failures | Sensitive data stored or sent without proper encryption. |
| A05 | Injection | Untrusted input runs as code: SQL injection, XSS, command injection. |
| A06 | Insecure Design | The feature itself is unsafe, no matter how well it is coded. |
| A07 | Authentication Failures | Weak login, password and session handling. |
| A08 | Software or Data Integrity Failures | Trusting updates, data or objects without verifying them. |
| A09 | Security Logging & Alerting Failures | Attacks happen and nobody notices. |
| A10 | Mishandling of Exceptional Conditions | Errors and edge cases that fail open or leak information. New. |
What changed from 2021: Security Misconfiguration jumped to #2, "Vulnerable and Outdated Components" grew into the broader Software Supply Chain Failures at #3, Server-Side Request Forgery (SSRF) was merged into Broken Access Control, and Mishandling of Exceptional Conditions is brand new.
A01: Broken Access Control
Still number one. The classic example is an IDOR (insecure direct object reference): changing /invoices/1041 to /invoices/1042 in the URL and seeing someone else's invoice.
// Vulnerable: any logged-in user can view any invoice
public function show(Invoice $invoice)
{
return view('invoices.show', compact('invoice'));
}
// Safe: check ownership with a policy
public function show(Invoice $invoice)
{
$this->authorize('view', $invoice); // InvoicePolicy: $user->id === $invoice->user_id
return view('invoices.show', compact('invoice'));
}
SSRF lives here now: if your app fetches a URL the user provides (an "import from URL" feature, a webhook tester), an attacker can point it at internal addresses such as http://169.254.169.254/ to read cloud credentials. Allow-list domains and block private IP ranges.
Checklist: deny by default, check permissions on the server for every request (hiding a button is not security), and test with a second user account.
A02: Security Misconfiguration
The application is fine — the setup is not. Common examples:
APP_DEBUG=truein production, which shows stack traces, file paths and sometimes environment variables to anyone.- A publicly downloadable
.env,.gitfolder or database backup. - Default admin passwords, directory listing enabled, unnecessary ports open.
- Missing security headers such as
Content-Security-PolicyandX-Frame-Options.
# Quick checks on your own site
curl -I https://yoursite.com/.env # must NOT return 200
curl -I https://yoursite.com/.git/HEAD # must NOT return 200
Point the web server's document root at the public/ folder only, never at the project root.
A03: Software Supply Chain Failures (new)
Modern apps contain far more third-party code than their own: Composer and npm packages, Docker images, GitHub Actions, CDN scripts. Attackers increasingly target that chain — publishing malicious packages with names similar to popular ones, or taking over abandoned packages.
composer audit # known vulnerabilities in PHP dependencies
npm audit # same for JavaScript
Checklist: commit your lock files, install only packages you actually need, check a package's maintainers and download count before adding it, pin versions in CI, and turn on automated alerts such as Dependabot. Be especially careful with packages suggested by AI coding tools — check that they really exist and are the official ones.
A04: Cryptographic Failures
Sensitive data — passwords, card data, health records, API keys — exposed because it is stored or transmitted without proper protection.
// Vulnerable: fast hashes are cracked in seconds
$hash = md5($password);
// Safe: slow, salted password hashing
$hash = password_hash($password, PASSWORD_DEFAULT); // Laravel: Hash::make($password)
if (password_verify($input, $hash)) { /* ok */ }
Checklist: HTTPS everywhere with HSTS, never store passwords with MD5 or SHA-1, encrypt sensitive columns (Laravel's encrypted cast), and keep keys out of your code repository.
A05: Injection
Untrusted input ends up being run as code. SQL injection and cross-site scripting (XSS) are the most common forms.
// Vulnerable: SQL injection
$users = DB::select("SELECT * FROM users WHERE email = '$email'");
// Safe: parameter binding
$users = DB::select('SELECT * FROM users WHERE email = ?', [$email]);
// or simply: User::where('email', $email)->get();
{{-- Vulnerable: renders raw HTML, allows XSS --}}
{!! $comment->body !!}
{{-- Safe: Blade escapes output by default --}}
{{ $comment->body }}
In AI-powered apps, prompt injection is the newest member of this family: text in a document or web page that tricks your AI feature into ignoring its instructions. Treat model output as untrusted input too.
A06: Insecure Design
Some flaws cannot be fixed with better code because the design is wrong. Examples: a password reset that asks a "security question" whose answer is on social media; a checkout that trusts the price sent from the browser; a coupon that can be applied unlimited times.
// Vulnerable design: trusting the price from the form
$order->total = $request->input('price');
// Safe design: the server decides the price
$order->total = Product::findOrFail($request->product_id)->price;
Checklist: before building a feature, ask "how would someone abuse this?" — threat modelling in five minutes. Add rate limits and business rules (one coupon per order) on the server.
A07: Authentication Failures
Weak login systems: no protection against password guessing, weak password rules, session IDs that never expire, or "remember me" tokens that never rotate.
// Laravel: limit login attempts per email + IP
RateLimiter::for('login', function (Request $request) {
return Limit::perMinute(5)->by($request->input('email').'|'.$request->ip());
});
Checklist: rate-limit logins, offer two-factor authentication or passkeys, regenerate the session ID after login, check new passwords against known-breached lists, and never reveal whether an email exists ("invalid email or password").
A08: Software or Data Integrity Failures
Trusting code or data without checking it has not been tampered with: auto-updates downloaded over plain HTTP, CI pipelines that anyone can modify, or unserialize() on data a user controls.
// Vulnerable: PHP object injection
$prefs = unserialize($_COOKIE['prefs']);
// Safe: use JSON for data from users
$prefs = json_decode($_COOKIE['prefs'] ?? '{}', true);
Load third-party scripts from a CDN with Subresource Integrity (integrity="sha384-...") and verify webhook signatures from payment providers before trusting them.
A09: Security Logging & Alerting Failures
Most breaches are discovered weeks or months late, often by someone outside the company. If you do not log failed logins, permission errors and admin actions — and nobody gets alerted — attackers have unlimited time.
Checklist: log authentication events and access-control failures (never log passwords or full card numbers), send alerts for spikes, keep logs somewhere an attacker cannot easily delete them, and use an error tracker such as Sentry or Flare.
A10: Mishandling of Exceptional Conditions (new)
What does your code do when something unexpected happens — a timeout, a null value, a failed payment callback? Unsafe error handling either fails open (grants access when a check errors out) or leaks information through detailed error messages.
// Vulnerable: fails open — any error grants access
try {
$allowed = $licenseApi->check($key);
} catch (\Throwable $e) {
$allowed = true;
}
// Safe: fail closed, log the problem, show a generic message
try {
$allowed = $licenseApi->check($key);
} catch (\Throwable $e) {
report($e);
$allowed = false;
}
A practical security routine for small teams
- Before every deploy:
APP_DEBUG=false,composer audit,npm audit. - For every new route: who is allowed to call this, and where is that checked?
- For every form: validate on the server, escape on output, use bound parameters.
- Monthly: update dependencies, review admin accounts, test a backup restore.
FAQ
Is the OWASP Top 10 a security standard?
No. OWASP describes it as an awareness document and a starting point. For a detailed checklist, use the OWASP Application Security Verification Standard (ASVS).
Does using Laravel or another framework make me safe?
Frameworks protect you from many injection and session problems by default, but they cannot stop broken access control, insecure design or misconfiguration. Those depend on your decisions.
How often is the list updated?
Roughly every three to four years. The 2025 edition replaced the 2021 list. Always check owasp.org for the current version.
Keep learning
If you use AI coding assistants, the same review habits apply to generated code — read why developers still need fundamentals. To protect your APIs from abuse, use our Laravel rate-limiting snippet and the secure file upload snippet.