Web security

Hand-drawn thick terracotta walls divide dense sand, umber and moss hatching into compartments, with pale strokes passing through narrow gaps in the walls.

Web security concerns the weaknesses that let software or a website visitor do something a web application did not intend, and the protections against them. An application can mistake outside data for instructions, accept requests users did not intend, or show controls whose real effect is hidden (OWASP Foundation, 2017; MITRE, n.d.b; MITRE, n.d.a). Browsers defend against these weaknesses by limiting what pages can read, run and embed, and sites can set some of those limits themselves (WHATWG, 2026b; West & Sartori, 2026; Vanderlinden & Franken, 2026). Historical studies found that many deployed content rules could be bypassed and some framing rules protected inconsistently. The counts used to track weaknesses each capture a different set of cases (Weichselbaum et al., 2016; Calzavara et al., 2020; OWASP Foundation, 2025c; Ezenwoye & Liu, 2022; Ayala et al., 2025).

Origins and permission to share

The same-origin policy limits access between pages from different origins. For an ordinary web address, the origin combines the scheme, such as HTTPS, the host name and the network port. Pages with the same origin share authority, while the browser isolates different origins from each other to varying degrees (WHATWG, 2026b).

Sites can give a different origin permission to read a response. Cross-Origin Resource Sharing (CORS) specifies that permission through HTTP headers, fields that accompany the web server’s response. The permission describes whether the browser may share the response with that origin (WHATWG, 2026a).

Data mistaken for instructions

The most familiar weaknesses arise when software treats outside data as part of a command.

Injection

Injection happens when software treats outside data as part of a command or query. In SQL injection, a database interprets a value as part of the instructions written in SQL, a language for querying and changing stored data. Specifying the query separately and binding each input as a parameter keeps the supplied value from changing those instructions (OWASP Foundation, 2017; MITRE, n.d.e; OWASP Cheat Sheets Series Team, n.d.c).

Cross-site scripting

Cross-site scripting (XSS) is the same failure in the browser. A web application incorporates untrusted data in a page, and the browser interprets it as code. Output encoding changes how the data is written so the browser treats it as data. Which encoding works depends on where the value appears in the page (MITRE, n.d.d; OWASP Cheat Sheets Series Team, n.d.a).

Browsers also enforce rules a site can set. Content Security Policy (CSP) lets a site specify which resources a page can load or execute. Trusted Types addresses a narrower problem: it can require designated kinds of values at certain browser interfaces in place of arbitrary text. This constrains how a page handles untrusted input and helps prevent cross-site scripting (West & Sartori, 2026; Kotowicz, 2026; OWASP Cheat Sheets Series Team, n.d.a).

What automatic escaping covers Weak evidence: few or small studies support this

One 2011 study found a gap between what frameworks could protect automatically and what the applications in its sample needed. Automatic escaping applies output encoding without requiring the developer to add it at each point where data appears. The protection depends on context, because a rule that is safe in one part of a page can be unsafe in another (Weinberger et al., 2011b).

A second family of weaknesses makes an application act on a request or a click the user did not mean.

Cross-site request forgery

Cross-site request forgery (CSRF) occurs when an application accepts a request that does not reflect the user’s intent. OWASP recommends that applications without built-in framework protection check a CSRF token on the server for any request that changes application data or settings. The token is a value the server can check when it receives the request (MITRE, n.d.b; OWASP Cheat Sheets Series Team, n.d.b).

Browsers also control when they send cookies, small values a site asks the browser to store, with requests from other sites. The SameSite setting distinguishes requests within a site from requests involving another site. With Strict, the browser sends the cookie only for same-site requests. Lax allows a cookie to accompany certain cross-site visits to a new page in the main browser window (Bingler et al., 2025).

Clickjacking and framing rules

Clickjacking misleads someone into taking an action by hiding what their interaction actually controls. The defence is a framing policy, which limits which other pages may display the protected page inside them (MITRE, n.d.a). A frame is an area of one page that displays another. The CSP rule named frame-ancestors limits which pages can embed the resource. The X-Frame-Options header can forbid embedding or restrict it to pages with the same origin (West & Sartori, 2026; Vanderlinden & Franken, 2026).

What deployed content and framing rules protect Strong evidence: many studies agree on this

A count of CSP headers says little about protection, because the rules serve different purposes. The 2025 Web Almanac, a yearly public crawl of websites, reported CSP headers on 21.9% of its sample, up from 18.5% in 2024. A study of archived pages from 2012 through 2018 had already documented a shift from restricting content toward other security goals. Its survey of over 100 site operators found that perceived complexity discouraged use of even simpler CSP features (Vanderlinden & Franken, 2026; Roth et al., 2020).

Early studies found gaps by examining individual policy rules. In 2016, researchers classified 94.72% of the 26,011 distinct CSP policies they examined as readily bypassable under their criteria. A 2020 study found that about 10% of distinct framing policies gave inconsistent protection across browsers. Both percentages count each distinct policy once, however many sites use it (Weichselbaum et al., 2016; Calzavara et al., 2020).

Browsers ignore framing rules supplied in a form they do not recognise. In the 2025 crawl, roughly half of observed CSP headers included the framing rule. The same crawl found 5,564 instances of X-Frame-Options in page markup, where browsers ignore it; each tag in the page’s source counts as one instance (Vanderlinden & Franken, 2026).

Encrypted connections

HTTPS uses encryption to keep messages private in transit and lets the browser check which server it reached. HTTP Strict Transport Security (HSTS) tells the browser to use a secure connection whenever it contacts a known host, for a period the rule specifies (Kerschbaumer et al., 2025; Hodges et al., 2012).

The 2025 Web Almanac found HTTPS on 97.3% of the mobile homepages in its crawl. It observed HSTS headers on 36% of the mobile pages it visited, up six percentage points from the previous edition (Vanderlinden & Franken, 2026).

Measurements from people’s browsers count connections made during use, and they vary by country. In January 2025, 92.1% of connections that loaded a main page in Firefox 134 were encrypted, with 98.0% in Denmark and 51.2% in Sudan. Each figure describes that release and month (Kerschbaumer et al., 2025).

What the rankings measure

The OWASP Top 10 is an awareness document that summarizes security risks for web applications. For the 2025 edition, OWASP selected eight categories from contributed test data and two from a community survey. Its call for data asked, for each weakness, how many applications were tested and how many had at least one finding. What contributors find largely reflects what they can test automatically at scale (OWASP Foundation, 2025b; OWASP Foundation, 2025c).

The same weakness can be grouped differently across editions. Injection ranked first in 2017, third in 2021 and fifth in 2025. In 2021, OWASP also moved cross-site scripting into the injection category. The change in what the category contains limits what its rank can say about changes in the underlying weaknesses (OWASP Foundation, 2017; OWASP Foundation, 2025c; OWASP Foundation, 2021).

OWASP’s Application Security Verification Standard (ASVS) sets requirements for designing, developing and testing web applications and services. Version 4.0 dates to 2019. Version 5.0.0, published in May 2025, kept three levels of verification requirements and updated their definitions (OWASP Foundation, n.d.; OWASP Foundation, 2025d).

What vulnerability records measure

Counts of disclosures describe the reports in a dataset. A preprint classifying 13,346 US National Vulnerability Database records for web applications from 2011 through 2020 found that 27.6% concerned XSS, 9.9% SQL injection and 5.8% cross-site request forgery. An open-source software study identified valid weaknesses in bounty reports and advisories that had no identifier in the system used to track publicly disclosed vulnerabilities (Ezenwoye & Liu, 2022; Ayala et al., 2025).

Archives offer a view of change in the pages themselves. A study of prominent sites from 1997 to 2016 found that injection weaknesses in browser code became more likely alongside the spread of JavaScript-driven applications in the early 2000s (Stock et al., 2017). A disclosure study from 2012 found that SQL injection reports shifted from more popular to less popular applications, with no corresponding shift for XSS (Scholte et al., 2012).

What scanners and bounties find Weak evidence: few or small studies support this

Automated security scanners can miss weaknesses even when evaluators know the full set of flaws. Five scanners tested on an e-commerce benchmark missed most of its known injection weaknesses in almost all modes tested. In an evaluation of 75 web applications, code-inspecting and running-software tools together reported no findings in one category of the 2021 OWASP Top 10 (Althunayyan et al., 2022; Qadir et al., 2025).

Scanners can disagree about the same applications. In a 2017 study, two scanners disagreed widely in their reports across 140 applications, yet four scanners showed no significant overall performance differences on benchmarks (Alsaleh et al., 2017).

Bug bounty programs, which pay outside researchers for eligible vulnerability reports, have supplied a share of the fixes in two browsers. A three-year study of Chrome and Firefox found that bounties accounted for 28% and 24%, respectively, of patched vulnerabilities listed in their security advisories (Finifter et al., 2013). A later study of HackerOne programs counted valid monthly reports, but lacked the data to adjust for their severity or for the scope of programs. These outcomes measure what was reported or fixed in the programs studied (Sridhar & Ng, 2021).

Further reading

  • The HTML and Fetch standards describe the origin boundary and how a server can allow a response to be shared outside it (WHATWG, 2026b; WHATWG, 2026a).
  • OWASP’s introduction to the 2025 Top 10 explains how the project combines test data and survey responses (OWASP Foundation, 2025c).
  • The 2025 Web Almanac security chapter tracks browser security headers and HTTPS in a public crawl (Vanderlinden & Franken, 2026).
  • Roth and colleagues trace changes in the uses of CSP and ask site operators how they decide which protections to deploy (Roth et al., 2020).
  • Althunayyan and colleagues report a scanner comparison using known weaknesses in one test application (Althunayyan et al., 2022).
  • Finifter and colleagues estimate the share of patched weaknesses that came from bounty programs in two browsers (Finifter et al., 2013).

Known gaps

What this article cannot tell you yet.

  1. The disclosure datasets do not estimate present-day prevalence across web applications or establish a comparable trend for all four weakness classes. The article gives no clickjacking prevalence estimate.
  2. The evidence on automatic escaping does not establish whether adopting it lowers the rate of reported cross-site scripting vulnerabilities in modern frameworks.
  3. The historical studies of content and framing policies use different samples and measures from the 2025 crawl. Their findings cannot establish a current rate of ineffective policies.
  4. The HTTPS traffic figures come from one browser release. Comparable visit-level estimates across other browsers are missing.
  5. The bounty studies covered here do not establish a general effect on breach rates.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 34 references