OWASP Top 10 2025 explained with code examples and fixes

Latest Comments

No comments to show.
Abstract secure software development interface with code panels, validation checks, and subtle gold and purple accents

The OWASP Top 10 remains one of the most useful ways to prioritise application security work. It is not a standard, and it is not a complete secure coding guide. It is a risk-based list of the most important classes of web application weakness that security engineers, developers, and product teams should keep in view when they design, build, test, and operate software.

For UK SMEs, the value is practical. The list helps you focus limited engineering time on the weaknesses that are most likely to matter in real systems, especially where you have web apps, APIs, cloud services, and third-party dependencies. It also gives teams a common language for discussing findings from code review, SAST, DAST, penetration testing, and incident response. If you are already using secure development practices, the OWASP Top 10 can act as a prioritisation layer on top of them, not a replacement for them. For a broader secure development baseline, it is worth reading our overview of secure software development alongside this article.

Key takeaways

  • Use the OWASP Top 10 as a prioritisation tool, not a compliance checklist, and map each category to your own architecture and delivery process.
  • Fix broken access control, injection, and authentication issues in the service layer with explicit server-side checks, parameterised queries, and stronger session controls.
  • Treat supply chain integrity, dependency risk, and logging as first-class application security concerns, not separate operational topics.
  • Build OWASP coverage into design, build, test, and release stages using threat modelling, SAST, DAST, SCA, SBOMs, and signed artefacts.

What the OWASP Top 10 is and how to use it

The OWASP Top 10 is best treated as a conversation starter and a triage aid. It is useful when you need to decide what to fix first, what to test more deeply, and where to invest in controls that reduce recurring risk. It is less useful if you treat it as a tick-box checklist and assume that a product is safe because it has no obvious Top 10 issues in one scan.

For engineers, the right way to use it is to map each category to your own architecture. A SaaS platform with REST APIs, background jobs, and cloud storage will have different exposure from a monolithic internal line-of-business app. The same category can also show up in different ways. Broken access control might be an IDOR in an API, a missing object-level permission check in a service layer, or a privilege escalation path in an admin console.

For product teams, the list is a reminder that security is not just about code quality. Some weaknesses are design problems, some are deployment problems, and some are operational problems. That is why the Top 10 works best when paired with threat modelling, secure design reviews, code review, and release-time testing. If you want a structured way to measure maturity over time, OWASP SAMM is a useful companion framework.

What changed in the OWASP Top 10 for 2025

The 2025 list continues the same broad themes as 2021, but the emphasis has shifted further towards real-world engineering patterns: API-first systems, cloud-native deployments, supply chain trust, and the operational reality of logging and detection. In practice, that means the list is less about isolated web forms and more about the full application lifecycle.

That shift matters because many modern failures are not caused by a single vulnerable line of code. They arise when insecure defaults, weak identity controls, poor dependency hygiene, and incomplete telemetry combine. A secure design can still fail if the build pipeline cannot prove what was built, or if the application cannot tell you who did what after the fact.

For technical teams, the main change in mindset is to think in terms of control coverage. Ask where each weakness can be introduced, where it can be detected, and where it can be prevented. That gives you a more useful view than simply asking whether a scanner found a matching issue.

Broken access control

Broken access control remains one of the most common and most damaging application issues. It appears when a user can access data or functions they should not be able to reach. In APIs, the classic pattern is object-level authorisation failure, where the application checks that a user is authenticated but does not verify that they are allowed to access the specific record.

A weak pattern looks like this in pseudocode:

app.get('/orders/:id', async (req, res) => {
  const order = await db.orders.findById(req.params.id);
  res.json(order);
});

This code returns any order by ID, regardless of ownership. The fix is to bind the object lookup to the authenticated principal and enforce the access rule in the service layer, not just in the UI:

app.get('/orders/:id', authRequired, async (req, res) => {
  const order = await db.orders.findOne({
    id: req.params.id,
    accountId: req.user.accountId
  });

  if (!order) {
    return res.status(404).send('Not found');
  }

  res.json(order);
});

That pattern is better because the server enforces the rule, and the response does not reveal whether the object exists for another tenant. In more complex systems, use centralised authorisation checks, role-based access control where appropriate, and explicit policy decisions in the service layer. For broader access design patterns, our article on least privilege access using IAM and RBAC is a useful companion.

In practice, engineers should test for missing object checks, forced browsing, privilege escalation, and insecure direct object references. These issues often survive code review because the code looks reasonable at a glance, especially when the UI hides the action but the API still accepts it.

Cryptographic failures

Cryptographic failures usually mean data is not protected properly in transit, at rest, or in memory, or that keys and secrets are handled badly. The problem is often not the algorithm itself. It is the implementation. Common mistakes include using weak or outdated ciphers, hard-coding keys, reusing IVs or nonces incorrectly, and storing sensitive data without a clear retention or encryption strategy.

A poor pattern is to invent your own encryption wrapper and reuse a static key from configuration:

const crypto = require('crypto');
const key = Buffer.from(process.env.APP_KEY, 'hex');
const iv = Buffer.alloc(16, 0);

function encrypt(text) {
  const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);
  return cipher.update(text, 'utf8', 'hex') + cipher.final('hex');
}

This is fragile because the IV is fixed and CBC mode does not provide authenticated encryption by itself. A safer approach is to use a well-reviewed library or a platform service that gives you authenticated encryption, key rotation, and access control. If you must implement encryption in application code, prefer an authenticated mode such as AES-GCM and generate a fresh IV for each encryption operation:

const crypto = require('crypto');

function encrypt(text, key) {
  const iv = crypto.randomBytes(12);
  const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);

  const encrypted = Buffer.concat([
    cipher.update(text, 'utf8'),
    cipher.final()
  ]);

  const tag = cipher.getAuthTag();
  return Buffer.concat([iv, tag, encrypted]).toString('base64');
}

Transport security matters too. Use TLS for all external and internal service-to-service traffic where practical, and do not rely on network location as a control. For a more detailed treatment of secure channels, see our guide to encryption and secure channels.

From a control perspective, cryptographic failures are best handled through standards-based libraries, secrets management, key lifecycle controls, and regular review of where sensitive data is stored and copied. If the application does not need to retain the data, do not encrypt it and keep it forever. Reduce the data first.

Injection flaws

Injection remains relevant because applications still build queries, commands, and templates from untrusted input. SQL injection is the best known example, but command injection, LDAP injection, and template injection follow the same basic pattern: user input is interpreted as part of a language rather than as data.

Unsafe SQL construction looks like this:

const sql = `SELECT * FROM users WHERE email = '${email}'`;
const rows = await db.query(sql);

Parameterised queries remove the ambiguity by separating code from data:

const sql = 'SELECT * FROM users WHERE email = ?';
const rows = await db.query(sql, [email]);

The same principle applies to shell commands. Do not concatenate user input into a command string. Use safe APIs that pass arguments separately, and avoid shell invocation unless there is no alternative. For web applications, validate input against an allow list, encode output for the target context, and keep the trust boundary clear. Our article on input validation, encoding, and output sanitisation goes deeper into those patterns.

For technical teams, the important point is that injection is not just a coding issue. It is also a design issue. If a service accepts free-form text and passes it to a parser, query engine, or template renderer, you need to understand the downstream interpreter and the exact context in which the input will be used.

Insecure design

Insecure design is where the application behaves as intended, but the intended behaviour is unsafe. This is why code review alone will not catch it. A system can be perfectly implemented and still fail because it lacks rate limiting, abuse-case handling, workflow validation, or trust boundaries between components.

Examples include password reset flows that reveal account existence, approval workflows that can be bypassed by changing state directly, or business logic that assumes a user will only ever submit one request at a time. These are not syntax errors. They are design assumptions.

The right response is threat modelling and abuse-case testing. Start with the data flow, identify trust boundaries, and ask how an attacker could misuse each step. Techniques such as STRIDE or attack trees are useful here, but the key is to make the exercise concrete. Ask what happens if a request is replayed, if a token is stolen, if a workflow step is skipped, or if a background job is triggered out of sequence.

For SMEs, the practical outcome should be a short list of design controls that are enforced consistently: rate limits, state validation, step-up authentication for sensitive actions, server-side workflow checks, and explicit authorisation at each sensitive transition. If you want a structured way to embed this into architecture reviews, our guide to secure design reviews and architecture checkpoints is a useful reference.

Security misconfiguration

Security misconfiguration covers unsafe defaults, unnecessary services, overly permissive headers, debug features left on, and cloud or platform settings that expose more than intended. In modern environments, this can be as simple as a storage bucket with public access, a container running as root, or an API that returns verbose error messages in production.

A common example is a framework running in debug mode:

app.set('env', 'development');
app.use(errorHandler({ exposeStack: true }));

That may be fine in local development, but it is risky in production because it can leak stack traces, internal paths, and implementation details. A safer pattern is to separate configuration by environment and make secure defaults the norm:

const isProd = process.env.NODE_ENV === 'production';

app.set('env', isProd ? 'production' : 'development');
app.use(errorHandler({
  exposeStack: !isProd
}));

Configuration hardening should also cover HTTP security headers, CORS policy, container runtime settings, infrastructure as code, and cloud IAM. The goal is to remove unnecessary exposure and make insecure states harder to deploy accidentally. Where possible, enforce this in CI and deployment pipelines rather than relying on manual review.

Vulnerable and outdated components

Most teams depend on third-party packages, base images, and platform components. That is normal. The risk comes from untracked dependencies, transitive dependencies, and patch lag. A package may appear safe at the top level while pulling in a vulnerable library several layers deep.

Good practice starts with version pinning, dependency review, and software composition analysis. Use a lockfile, keep direct dependencies minimal, and review updates before they reach production. An SBOM, or software bill of materials, helps you understand what is actually in the build. For a practical approach to dependency risk, see our article on managing dependency risk and transitive dependencies.

A simple operational pattern is to combine three controls:

  • Run SCA in CI to identify known vulnerable packages.
  • Generate an SBOM for each release so you can trace what shipped.
  • Use dependency update automation with human review for higher-risk changes.

That combination will not eliminate supply chain risk, but it gives you visibility and a repeatable remediation path. It also helps when you need to answer customer or assurance questions about what is in a release.

Identification and authentication failures

Authentication failures include weak password handling, poor session management, missing MFA for sensitive actions, insecure password reset flows, and token handling mistakes. The issue is not just whether a user can log in. It is whether the application can reliably prove identity and maintain that identity safely across requests.

A weak session pattern is to store a long-lived token in a place that is easy to steal, or to accept a token without checking expiry, audience, or revocation state. A safer approach is to use short-lived access tokens, secure cookie flags where cookies are used, and server-side session controls for sensitive applications. For browser-based systems, set HttpOnly, Secure, and SameSite attributes appropriately, and avoid exposing tokens to JavaScript unless you have a clear reason and compensating controls.

Authentication flows should also protect against enumeration and brute force. Return generic error messages, rate limit login and reset endpoints, and step up to MFA for risky actions. If your application supports administrative functions, separate those flows from standard user sessions and require stronger assurance for privileged access.

In code, the fix is often not a single line. It is a set of guardrails around the whole flow: password policy, reset token expiry, session invalidation on password change, MFA enforcement, and logging of suspicious authentication events.

Software and data integrity failures

Integrity failures happen when the application or build pipeline trusts code, artefacts, or updates that have not been properly verified. This includes unsigned packages, tampered build outputs, compromised CI jobs, and update mechanisms that accept untrusted content.

For engineering teams, this is where build provenance and artefact signing become important. You want to know what source was used, what build process created the artefact, and whether the artefact was altered after the build. That is especially relevant for container images and release bundles. Our guide to signing and verifying container images shows one practical route, and our article on SLSA build provenance explains how to strengthen build trust further.

A useful control pattern is:

  • Build in a controlled CI environment.
  • Sign the artefact and attach provenance metadata.
  • Verify signatures before deployment.
  • Restrict who can modify pipeline definitions and release credentials.

This is one of the clearest examples of the OWASP Top 10 reaching beyond application code into the software supply chain. If your pipeline cannot prove integrity, the application inherits that weakness.

Security logging and monitoring failures

Logging and monitoring failures are often overlooked because they do not create an immediate visible defect. The problem appears later, when you need to investigate suspicious activity and discover that the application did not log enough detail, logged the wrong detail, or logged it in a way that is hard to search.

At minimum, log authentication events, authorisation failures, privilege changes, sensitive data access, workflow anomalies, and security-relevant configuration changes. Make sure logs include a stable user identifier, a request identifier, the source IP or network context where appropriate, and the outcome of the action. Do not log secrets or full payment data. Log enough to investigate, not enough to create a new data exposure.

A practical pattern is to emit structured JSON logs:

logger.info({
  event: 'order_access_denied',
  userId: req.user.id,
  accountId: req.user.accountId,
  orderId: req.params.id,
  reason: 'ownership_mismatch'
});

That is more useful than a free-text message because it can be queried in a SIEM and correlated with other events. If you are building detection content, think about what should trigger an alert versus what should remain as searchable telemetry. For broader monitoring design, our article on what security logs you actually need is a good companion.

From a defensive standpoint, logging is only valuable if someone reviews it, or if detections are built on top of it. That means you need retention, alerting, and a clear ownership model for response.

Server-side request forgery and other modern web risks

Server-side request forgery, or SSRF, is especially relevant in cloud and API-heavy systems. It occurs when an application fetches a URL supplied by a user or another system without properly restricting where the request can go. The result can be access to internal services, metadata endpoints, or other resources that should not be reachable from the application tier.

A weak pattern is to accept any URL and fetch it directly:

const response = await fetch(req.body.url);
const data = await response.text();

That is dangerous because the application becomes a proxy for arbitrary outbound requests. A safer pattern is to use an allow list of destinations, validate scheme and host, resolve and check the final target, and block access to internal address ranges and metadata services. You should also set timeouts, limit redirects, and use a separate egress policy at the network layer where possible.

SSRF is a good example of why application controls and platform controls need to work together. Input validation alone is not enough if the runtime can still reach internal systems freely. Likewise, network filtering alone is not enough if the application can be tricked into using an approved proxy path.

How to prioritise remediation in a real engineering backlog

Not every finding deserves the same treatment. A useful triage model combines severity, exploitability, exposure, and business impact. A broken access control issue on a customer-facing API with sensitive records should usually outrank a low-risk misconfiguration in an internal tool. A cryptographic issue that affects authentication tokens is more urgent than one that affects non-sensitive cached data.

When you triage, map the issue to the underlying weakness class using CWE where possible, and use CVE data for third-party components. If the issue resembles a known attack pattern, map it to MITRE ATT&CK to help security operations understand how it might be abused in the wider environment. That is particularly useful when the same weakness could support multiple attack stages.

For example, broken access control may support initial data access, privilege escalation, or lateral movement depending on the system. Logging failures may not be directly exploitable, but they increase dwell time and reduce confidence in detection. This is why remediation should be risk-based, not purely score-based.

How to build OWASP Top 10 coverage into SDLC and DevSecOps

The most effective way to reduce Top 10 risk is to build checks into the delivery process rather than relying on a final test phase. In design, use threat modelling and architecture review. In build, use SAST, secret scanning, dependency scanning, and policy checks. In test, use DAST, API testing, and abuse-case testing. In release, verify artefacts, review configuration, and enforce deployment gates. In operations, monitor for abuse and feed findings back into the backlog.

For a growing team, a practical baseline might look like this:

  • Pre-commit secret scanning for obvious credential leaks.
  • SAST on every merge request for common coding flaws.
  • SCA and SBOM generation on every build.
  • DAST or API security testing against a staging environment.
  • Signed artefacts and provenance checks before deployment.

That does not need to be over-engineered. The key is consistency. If a control only runs occasionally, it will miss the defects that matter most. If it runs automatically and produces actionable output, it becomes part of the engineering workflow rather than a separate security event.

A practical checklist for teams adopting the OWASP Top 10 2025

Start with the highest-value controls rather than trying to cover everything at once. In the next sprint, you can usually make meaningful progress by doing the following:

  • Review all object-level authorisation checks in customer-facing APIs.
  • Replace any string-built SQL or shell execution with parameterised or safe APIs.
  • Confirm that production environments do not expose debug mode, verbose errors, or unsafe defaults.
  • Generate an SBOM for the current release and identify the highest-risk dependencies.
  • Verify that authentication flows have MFA, rate limiting, and generic error handling.
  • Check that logs capture security-relevant events in a structured format.
  • Require signed artefacts or at least controlled provenance for production deployments.

Over time, track a small set of metrics: time to remediate high-risk findings, percentage of builds with SCA and SBOM coverage, number of production misconfigurations caught before release, and the proportion of critical endpoints with explicit authorisation tests. Those measures are more useful than a generic security score because they show whether the team is actually reducing risk.

For UK SMEs, the aim is not to become perfect. It is to make the most common and most damaging weaknesses harder to introduce, easier to detect, and quicker to fix. If you need help turning the OWASP Top 10 into a practical engineering backlog, or aligning it with an ISO 27001-oriented ISMS and delivery process, speak to a consultant.

Frequently asked questions

What is OWASP Top 10 in simple terms? It is a shortlist of the most important classes of web application security risk, used to help teams focus on the weaknesses that matter most in real systems.

What changed in the OWASP Top 10 for 2025? The 2025 emphasis is even more practical for modern delivery environments, with stronger attention on APIs, cloud deployments, supply chain integrity, and operational detection rather than just classic web form issues.

Is the OWASP Top 10 a secure coding standard? No. It is a prioritisation guide. It helps teams decide what to fix and test first, but it should be used alongside secure coding standards, threat modelling, and control frameworks such as ASVS and SAMM.

How should SMEs use the OWASP Top 10 alongside ASVS and SAMM? Use the Top 10 to identify the main risk areas, ASVS to define control depth for applications, and SAMM to measure whether your secure development practice is improving over time.

Tags:

Comments are closed