logo svg
logo

November 4, 2026

Updated: November 4, 2026

Web Application Security: Best Practices and Testing Guide

The 2026 threat picture, core controls, the testing toolbox, OWASP ASVS 5.0 levels and a checklist.

Mohammed Khalil

Mohammed Khalil

Featured Image

Web application security is the practice of protecting websites, web apps and the APIs behind them from attacks that abuse their code, configuration, identity flows and third-party components. It combines secure design, controls built into the application and repeated testing.

The 2026 breach data shows why it matters: attackers still log in with stolen passwords or exploit unpatched web software. This guide covers the threat picture, the core controls, the testing toolbox, OWASP ASVS 5.0 levels and a checklist you can work through.

What Is Web Application Security?

Web application security covers everything that decides whether a request to your application can do something it should not. That includes the browser (what scripts may run and where cookies go), the edge (TLS, rate limits, a web application firewall), identity (login, sessions, tokens), the application logic itself (authorization, input handling), the data and secrets it touches, and the open-source and third-party code it is built from.

Three points define the discipline in practice:

Web application security vs application security vs API security

The terms overlap, and teams use them loosely. This is how they relate in practice:

TermScopeTypical ownerMain reference
Application securityAll software: web, mobile, desktop, embedded, internal servicesAppSec or product security teamOWASP ASVS, NIST SSDF
Web application securityBrowser-facing applications and the APIs they call over HTTPAppSec with web engineeringOWASP Top 10, OWASP ASVS, OWASP WSTG
API securityMachine-to-machine and front-end APIs (REST, GraphQL, gRPC)AppSec with platform or API teamsOWASP API Security Top 10

Modern web apps are mostly APIs with a browser on top, so in practice a web application security program must cover its APIs. Our API penetration testing guide explains the API-specific test areas.

The 2026 Threat Landscape for Web Applications

The best public evidence on how web applications are actually breached is the Verizon 2026 Data Breach Investigations Report (DBIR). Its dataset covers October 2024 through November 2025 and includes 22,624 confirmed breaches. Two of its findings matter most for web teams.

Basic Web Application Attacks: stolen credentials first

The DBIR's Basic Web Application Attacks pattern covers attacks that go straight at a web application and then stop: log in with stolen credentials, or exploit a known flaw, and take the data. According to the Verizon 2026 Data Breach Investigations Report:

Verizon describes the pattern as closer to "oh, they left the door open" than to a sophisticated heist. That is useful framing: most of these breaches need no novel technique, only a missing control.

Exploitation of web-facing software is rising

Across all breaches, the Verizon 2026 Data Breach Investigations Report found that exploitation of vulnerabilities is now the most common initial access vector, at 31%, while credential abuse fell to 13%. Patching is not keeping up: only 26% of critical vulnerabilities (those in CISA's Known Exploited Vulnerabilities catalog) were fully remediated in 2025, down from 38%, and the median time to full resolution rose to 43 days from 32. Breaches with third-party involvement reached 48% of the total.

More complex web exploitation, where attackers go on to deploy ransomware or move through the network, is counted in the DBIR's System Intrusion pattern rather than Basic Web Application Attacks. So the one-in-ten figure understates how often a web application is the entry point.

Real examples from the CISA KEV catalog

These publicly documented cases show the three most common root causes in web software: injection, unpatched internet-facing products and vulnerable components.

CVEProductRoot causeAdded to CISA KEVLesson
CVE-2023-34362Progress MOVEit TransferSQL injection in the web application allowed unauthenticated database access (CWE-89)June 2, 2023; known ransomware useParameterized queries are not optional, even in mature commercial software
CVE-2025-61882Oracle E-Business Suite (BI Publisher Integration)Unauthenticated network attacker over HTTP could take over Oracle Concurrent ProcessingOctober 6, 2025; known ransomware useInternet-facing business apps need emergency patch paths and exposure reviews
CVE-2025-55182React Server Components 19.0.0, 19.1.0, 19.1.1 and 19.2.0Unsafe deserialization of HTTP payloads to Server Function endpoints, pre-authentication RCE (CWE-502)December 5, 2025; known ransomware useA framework dependency can expose every app built on it; SCA and fast upgrades matter

The details are in the NVD records for CVE-2023-34362, CVE-2025-61882 and CVE-2025-55182, and in the CISA Known Exploited Vulnerabilities catalog. The Verizon report notes that the group behind the 2023 MOVEit exploitation turned to the Oracle E-Business Suite zero-day in late summer 2025, compromising more than 100 organizations; we covered the Oracle CVE-2025-61882 patch when it was released.

What goes wrong most often: the OWASP Top 10

The OWASP Top 10:2025 ranks the most critical web application risk categories: Broken Access Control, Security Misconfiguration, Software Supply Chain Failures, Cryptographic Failures, Injection, Insecure Design, Authentication Failures, Software or Data Integrity Failures, Security Logging and Alerting Failures, and Mishandling of Exceptional Conditions. Broken Access Control stays at number one; OWASP reports that 100% of the applications tested had some form of it.

Each category, with examples and how testers check it, is explained in our OWASP Top 10 2025 guide. The controls below map to those categories.

Core Web Application Security Controls

The controls that stop the attacks above fall into nine groups. Each subsection gives the control, why it matters and the ASVS 5.0 requirement you can use to verify it.

Six layers of web application security controls from browser headers to supply chain, with logging across all layers

Authentication: assume passwords are already stolen

Stolen credentials are the top action in Basic Web Application Attacks, so authentication is where most teams get the biggest risk reduction for the least effort.

Authorization: deny by default, check every object

Broken access control is the most common web flaw class, and scanners struggle to find it because every exploiting request looks legitimate.

text
# Illustrative pattern: scope the lookup to the caller (lab example, not production code)
def get_invoice(session, invoice_id):
    invoice = db.invoices.find_one({
        "id": invoice_id,
        "tenant_id": session.tenant_id,   # from the server-side session
        "owner_id": session.user_id,
    })
    if invoice is None:
        raise NotFound()                  # same response whether it exists or not
    return invoice

Input and output handling: validate, parameterize, encode

Injection flaws such as the MOVEit SQL injection come from mixing untrusted data with code or queries. Three habits remove most of them:

  1. Validate input against what the business expects. ASVS 2.2.1 calls for positive validation against an allowlist of values, patterns and ranges, or against an expected structure.
  2. Keep data out of the query language. Use parameterized queries or a safe ORM API, never string concatenation.
  3. Encode output for its context. ASVS 1.2.1 requires output encoding relevant to the context: HTML element, attribute, CSS or HTTP header. Context-aware encoding, plus a framework that encodes by default, is the main defense against cross-site scripting (XSS).
text
# Illustrative: a parameterized query keeps user input as data, not SQL
cursor.execute(
    "SELECT id, name FROM customers WHERE email = %s",
    (email_from_request,),
)

Two related risks deserve their own controls. When your server fetches URLs on a user's behalf, restrict destinations with an allowlist and block internal and cloud metadata addresses to prevent server-side request forgery (SSRF). And never deserialize untrusted data into objects; CVE-2025-55182 shows how a framework-level deserialization flaw becomes pre-authentication remote code execution.

Session management: short-lived, server-verified, well-scoped cookies

Once a user logs in, the session token is as good as their password. ASVS 5.0 sets clear baselines:

text
Set-Cookie: __Host-session=<opaque-random-value>; Path=/; Secure; HttpOnly; SameSite=Lax

The __Host- prefix tells the browser to accept the cookie only if it is Secure, has Path=/ and has no Domain attribute, which stops subdomains from overwriting it. The MDN Set-Cookie reference documents each attribute.

SameSite narrows cross-site sending but is not a complete defense against forged requests; our guide to cross-site request forgery (CSRF) covers the token and origin checks that complete it.

Secrets management: nothing sensitive in code or images

Secrets were among the data compromised in 15% of Basic Web Application Attacks breaches in the Verizon 2026 Data Breach Investigations Report. Leaked API keys, database passwords and signing keys turn a small bug into full compromise.

The OWASP Secrets Management Cheat Sheet covers rotation and lifecycle in detail.

Dependencies and the software supply chain

Most of a modern web application is code your team did not write. OWASP elevated this risk to A03:2025 Software Supply Chain Failures, noting that when tested it has the highest average incidence rate of any category, at 5.19%.

Our guide to supply chain attacks covers build-system and vendor compromise in more depth.

Security headers and Content Security Policy

HTTP response headers tell the browser how to treat your content. They are cheap to deploy and limit the damage when another control fails. ASVS 5.0 section 3.4 sets the baseline:

HeaderWhat it doesASVS 5.0Level
Strict-Transport-SecurityForces HTTPS; max-age of at least one year, and all subdomains from L23.4.1L1
Access-Control-Allow-Origin (CORS)Fixed value or an allowlist of trusted origins; no sensitive data with a wildcard3.4.2L1
Content-Security-PolicyLimits which scripts and resources load; includes object-src 'none' and base-uri 'none', with an allowlist, nonces or hashes3.4.3L2 (per-response nonces or hashes at L3)
X-Content-Type-Options: nosniffStops MIME-type sniffing3.4.4L2
Referrer-PolicyPrevents leaking paths and query data to third parties3.4.5L2

A nonce-based policy is the most practical way to meet the CSP requirement in a modern app:

text
Content-Security-Policy: default-src 'self'; script-src 'nonce-<random-per-response>' 'strict-dynamic'; object-src 'none'; base-uri 'none'; frame-ancestors 'self'
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin

Roll out CSP in report-only mode first, fix what it reports, then enforce it. The OWASP Content Security Policy Cheat Sheet and the MDN CSP guide explain each directive. If you run payment pages, our PCI DSS 6.4.3 and 11.6.1 guide shows how script inventories and header monitoring are now required there.

Logging, alerting and error handling

You cannot respond to what you do not record, and logs nobody watches do not help. The 2025 OWASP list calls this category Security Logging and Alerting Failures (it was Security Logging and Monitoring Failures in 2021), which puts the emphasis on alerting.

Edge controls and web application firewalls

A web application firewall (WAF) filters HTTP traffic against rules for known attack patterns; managed cloud WAFs and the open-source ModSecurity engine with the OWASP Core Rule Set are common examples. Rate limiting and bot management sit at the same layer.

These controls are valuable for blocking commodity attacks and buying time while you patch. They are not a substitute for fixing the application: a WAF cannot see that a valid-looking request reads another tenant's data, and it cannot repair broken session handling. Treat edge controls as a layer, and keep them out of your definition of "fixed."

Controls at a glance

ControlMain attack it stopsASVS 5.0 chapterHow to verify
MFA and strong password rulesUse of stolen credentials, brute forceV6 AuthenticationConfiguration review; login tests with breached passwords
Server-side, deny-by-default authorizationIDOR, privilege escalationV8 AuthorizationMulti-account, multi-role manual testing
Validation, parameterization, encodingSQL injection, XSS, command injectionV1 Encoding and Sanitization; V2 Validation and Business LogicSAST, DAST, manual review of sinks
Session rotation and cookie flagsSession fixation and hijackingV7 Session Management; V3 Web Frontend SecurityDAST and manual session tests
Secrets vault and scanningLeaked keys and credentialsV13 ConfigurationSecrets scanning across repo history
SBOM, SCA and patch deadlinesKnown-vulnerable componentsV15 Secure Coding and ArchitectureSCA results against written deadlines
Security headers and CSPXSS impact, clickjacking, downgradeV3 Web Frontend SecurityAutomated header checks; CSP violation reports
Logging and alertingUndetected attacksV16 Security Logging and Error HandlingSimulated attack and alert review
WAF, rate limits, bot controlsCommodity scanning and stuffingOutside ASVS scope (infrastructure)Rule review; blocked-request metrics

The Web Application Security Testing Toolbox

No single test proves an application is secure. Each method sees the application from a different angle, at a different point in the lifecycle, and each has blind spots. The practical answer is a layered mix: automated checks on every change, and human testing where logic and authorization matter.

MethodWhat it isWhen it runsBest atMain limitation
SASTStatic analysis of source codeEvery commit or pull requestInjection sinks, unsafe functions, hard-coded secretsFalse positives; cannot see runtime configuration or business rules
SCAInventory and vulnerability check of open-source dependenciesEvery buildKnown-vulnerable and outdated componentsSays nothing about flaws in your own code
Secrets scanningPattern and entropy search for credentialsPre-commit, CI, repo historyCommitted keys, tokens and passwordsMisses secrets exposed at runtime or in logs
DASTAutomated testing of the running app over HTTPStaging, on a scheduleMissing headers, reflected injection, TLS and configuration issuesWeak at multi-step flows and multi-role access control
IASTInstrumentation inside the running app during testsQA and integration testsConfirms which code paths are actually reachableNeeds agent support for your stack; limited to exercised paths
Manual penetration testSkilled testers attack the app with authorized scopeBefore major releases and at least yearlyIDOR, business logic, chained exploits, authorizationPoint-in-time; quality depends on the testers
Bug bountyOutside researchers report issues for rewardsContinuous, in productionNovel issues found by many eyesCoverage is uneven; needs mature triage and a clear scope
Comparison of SAST, SCA, secrets scanning, DAST, manual penetration testing and bug bounty by timing, strengths and gaps

For a deeper comparison of the automated tools, including where RASP fits, see our guide to SAST vs DAST vs IAST vs RASP. For the human side, our comparison of penetration testing vs bug bounty explains when each fits, and manual vs automated penetration testing covers why tool-only "pentests" miss logic flaws.

Which test catches which flaw

This matrix is a planning aid, not a guarantee: results depend on configuration, scope and tester skill.

FlawSASTSCASecrets scanDASTManual pentestBug bounty
SQL injectionOftenNoNoOftenYesOften
Reflected or stored XSSOftenNoNoOftenYesOften
IDOR or broken object-level authorizationRarelyNoNoRarelyYesSometimes
Business logic abuse (prices, limits, workflows)NoNoNoRarelyYesSometimes
Vulnerable dependency (such as CVE-2025-55182)SometimesYesNoSometimesSometimesSometimes
Hard-coded API keySometimesNoYesNoSometimesSometimes
Missing security headers or weak CSPNoNoNoYesYesRarely
Session fixation or weak cookie flagsSometimesNoNoOftenYesSometimes
SSRF to internal or cloud metadata servicesSometimesNoNoSometimesYesSometimes

The pattern is clear: automation covers the "known pattern in a known place" flaws well, while authorization and logic flaws, the ones behind Broken Access Control, still need people who understand how the application is supposed to behave.

Using a methodology, not a tool list

Whichever mix you choose, anchor testing to a published method so results are repeatable. The OWASP Web Security Testing Guide (WSTG) describes how to test each area, and the ASVS (next section) defines what passing looks like. A good test plan also starts from a threat model, so the riskiest flows get the most attention. For timing, our guide on how often to perform penetration testing covers release-driven and compliance-driven schedules.

OWASP ASVS 5.0: Choosing a Verification Level

The OWASP Top 10 is an awareness list. The OWASP Application Security Verification Standard (ASVS) is the opposite: a detailed list of testable security requirements you can design, build and verify against. It is the closest thing web application security has to a shared definition of "done."

The current version is ASVS 5.0.0, released May 30, 2025, replacing 4.0.3 (October 2021). Version 5.0 has 345 requirements across 17 chapters, from V1 Encoding and Sanitization through V17 WebRTC, including dedicated chapters for self-contained tokens (V9), OAuth and OIDC (V10) and WebRTC (V17). Because identifiers can change between versions, OWASP recommends citing requirements with the version, such as v5.0.0-3.4.3.

The three levels

Each level includes every requirement from the levels below it. Counts are from the 5.0.0 release files:

LevelNew requirementsCumulativeWhat OWASP says it is forExample fit
Level 17070 of 345 (about 20%)Minimum, first-layer defenses against common attacks that need no other flaw to exploitEarly-stage product with limited sensitive data; the starting point for everyone
Level 2183253 of 345The level most applications should strive to achieve; less common attacks and stronger protectionsMost SaaS and business applications handling customer or personal data
Level 392345 of 345The highest assurance; defense in depth and hard-to-implement controlsApplications whose users expect the strongest assurance; OWASP's own example is online banking
OWASP ASVS 5.0 levels: 70 Level 1, 183 Level 2 and 92 Level 3 requirements out of 345, with who each level fits

What changed from ASVS 4.0.3

Two changes matter if your team used the old standard:

The second point has a practical consequence: if you want a test to confirm an ASVS level, give testers documentation, code access or both. A pure black-box test cannot verify every Level 1 requirement.

How to use the ASVS

The full standard and machine-readable requirement lists are in the OWASP ASVS GitHub repository.

Where to Start: A Risk-Ordered Plan

If you are building a program from scratch, order the work by what the breach data says attackers use most. This sequence is DeepStrike's editorial recommendation, based on the Verizon 2026 Data Breach Investigations Report patterns and the ASVS levels above:

OrderFocusWhy firstDone when
1MFA for admins and sensitive roles; breached-password checks; login rate limitsStolen credentials are the top action in Basic Web Application AttacksNo privileged account can log in with a password alone
2Patch internet-facing software and dependencies against CISA KEVExploitation is now the top initial access vector at 31%Written patch deadlines exist and are met
3Move secrets into a vault; scan repos and historySecrets appear in 15% of these breachesSecret scanning runs in CI with zero open findings
4Server-side authorization on every object and functionBroken Access Control is OWASP's number-one categoryTwo-user tests pass for every sensitive endpoint
5Add SAST and SCA to CI; set headers and CSP in report-only modeCatches common flaws on every changeBuilds fail on critical findings; CSP enforced
6Logging and alerts for authentication and authorization failuresShortens detection timeAlerts fire in a simulated stuffing test
7Authenticated manual penetration test against your chosen ASVS levelFinds logic and access control flaws automation missesFindings fixed and re-tested

Web Application Security Best Practices Checklist

Use this checklist as a working baseline. ASVS 5.0 requirement numbers are given where a single requirement maps cleanly.

Identity and sessions

Authorization

Input, output and data

Secrets and supply chain

Browser and transport

Detection and resilience

Testing and governance

Frequently Asked Questions

What is web application security in simple terms?

It is the set of practices, controls and tests that stop people from using a website or web app in ways it was not meant to be used: logging in as someone else, reading data they should not see, running their own code or taking the service down. It covers code, configuration, identity, dependencies and the browser.

Why is web application security important?

Web applications are directly reachable from the internet and hold the data attackers want. In the Verizon 2026 Data Breach Investigations Report, the Basic Web Application Attacks pattern alone accounted for 2,281 confirmed breaches, and exploitation of vulnerabilities was the most common initial access vector across all breaches, at 31%.

What are the top 5 web application vulnerabilities?

Using the OWASP Top 10:2025 order, the first five categories are Broken Access Control, Security Misconfiguration, Software Supply Chain Failures, Cryptographic Failures and Injection. Our OWASP Top 10 guide explains each one with examples.

What is an example of a WAF, and is a WAF enough?

Managed cloud WAFs and the open-source ModSecurity engine running the OWASP Core Rule Set are common examples. A WAF is not enough on its own: it filters known attack patterns but cannot understand your authorization rules or business logic, so flaws such as IDOR pass straight through.

Is SonarQube a SAST or DAST tool?

SonarQube is a static analysis tool, so it belongs in the SAST category: it analyzes source code without running the application. DAST tools test the running application over HTTP. Most teams need both, plus SCA for dependencies.

What are the OWASP ASVS levels?

ASVS 5.0 has three levels. Level 1 (70 requirements) covers first-layer defenses for every application, Level 2 (183 more, 253 in total) is the level OWASP says most applications should strive for, and Level 3 (92 more, all 345) is for applications that need the highest assurance.

What is the difference between the OWASP Top 10 and the ASVS?

The Top 10 is an awareness document that ranks the most critical risk categories. The ASVS is a verification standard with specific, testable requirements grouped into levels. Use the Top 10 to understand what goes wrong and the ASVS to define and test what "secure enough" means for your application.

How often should a web application be security tested?

Run SAST, SCA and secrets scanning on every change and DAST on a regular schedule. Add an authenticated manual penetration test before major releases and at least once a year, and re-test after fixing significant findings. Compliance frameworks and customer contracts may set stricter schedules.

Next Step: Verify Your Controls the Way an Attacker Would

Web application security comes down to a short list done well: strong authentication, server-side authorization on every object, safe handling of input and output, managed secrets, patched dependencies, sensible headers and logs that someone watches. Automated tools keep those controls from slipping on each release. Proving that they hold together, across roles, tenants and real business flows, still takes a human tester.

DeepStrike's web application penetration testing uses rigorous manual testing based on how your application is supposed to work, with security checks from multiple users' perspectives and only vulnerabilities validated through exploitation. You get a detailed report with fix recommendations, a technical presentation for your engineers, a shared Slack channel during the engagement and re-testing to confirm fixes hold. To scope a test for your application, contact DeepStrike.

About The Author

Mohammed Khalil is a Cybersecurity Architect at DeepStrike, specializing in advanced penetration testing and offensive security operations. With certifications including CISSP, OSCP, and OSWE, he has led numerous red team engagements for Fortune 500 companies, focusing on cloud security, application vulnerabilities, and adversary emulation. His work involves dissecting complex attack chains and developing resilient defense strategies for clients in the finance, healthcare, and technology sectors.

Sources and References

background
Let's hack you before real hackers do

Stay secure with DeepStrike penetration testing services. Reach out for a quote or customized technical proposal today

Contact Us