OWASP Top 10:2025 in Code

Each of the ten categories shown as a short Python program: the flaw, an attack that works against it, and a fix the same attack fails against. Every sample on this page was run, and the output blocks are what the programs printed.

The page is generated from the code. If a demo or a test changes, the page is built again from it; nothing on it is typed in twice.

Section 1

Purpose and method

The OWASP Top 10 is OWASP's awareness document on the most critical security risks to web applications. Its 2025 edition, the installment, is the current one. Every category on it is, in the end, a programming problem, so we show each one as a program: for every category a short Python module with a realistic flaw, an attack function that exploits it, and a fixed version of the same code. The text explains the code; the code and its output are the evidence. We set out to answer three questions:

  1. Can each of the ten 2025 categories be shown as a flaw in code, with an attack that works against it and a fix that the same attack fails against, without breaking the feature?
  2. What do the ten have in common as programming problems: where they enter, what goes wrong, what is lost, and how they are found?
  3. What do the fixes still not do?

Section 4 answers the first question category by category, section 3 the second, and each category's "What the fix does not do" the third. Section 8 sums up.

How every demo is checked

A fix only counts if it stops the attack without breaking the feature. Every scenario is therefore run three times, and the tests require all three outcomes below. The third rule matters most: deleting the feature, or rejecting every input, also "stops" an attack.

For every scenario
Vulnerable version
Fixed version
The attack
must succeedotherwise the demo shows no flaw
must failotherwise the fix does not work
Normal use
must still workotherwise the fix broke the feature
The three-way check. scenarios in ten demos, checked this way by three tests in test_demos.py, one for each rule. A fourth test checks that every category has a demo, and more check details such as lock-out timing, log format and the non-ASCII inputs fixed on 26 November. The page is only built when all tests pass. Section 5 shows a fix that the third rule rejects.

How this page is made

From the code to this page. The code samples are cut out of the demo files between marker comments, the output blocks are captured while the build runs the demos, and OWASP's figures come from a data file that a separate script fills from OWASP's pages and checks again on request. The lab in section 5 is generated from the same demo files.

Scope

  • Everything runs in one Python process with the standard library only. There is nothing to install.
  • The databases are real SQLite databases held in memory. The network in A01 and the package indexes in A03 are Python dictionaries, so no request leaves the machine and nothing is installed.
  • The pickle payload in A08 only sets a marker variable, so that the test can see that it ran. All people and account numbers in the demos are fictitious, and no address in them is ever contacted.

Section 2

The OWASP Top 10:2025

Compared with the 2021 edition there are two new categories, Software Supply Chain Failures and Mishandling of Exceptional Conditions, and one consolidation: server-side request forgery (SSRF), a category of its own in 2021, is now part of Broken Access Control. Three categories were renamed.

From 2021 to 2025. Each 2021 category, left, joined to the 2025 category it became, right. Thick lines: moved up, by three places each. Dashed line: rolled into another category (SSRF into A01). Vulnerable and Outdated Components was widened into Software Supply Chain Failures. On the right, "new" marks the new categories and "survey" the two places chosen by the community survey. Source: OWASP's 2021 list and the 2025 introduction.
Figures from the score table on each OWASP category page, read on ; the meanings follow OWASP's methodology page. Incidence rate: the share of the applications a contributor tested that had a given CWE. Avg. incidence: OWASP's average of these rates for the category; OWASP does not say exactly how it averages them. Occurrences: applications found to have the category's CWEs, not individual findings. CVEs: vulnerabilities in the US National Vulnerability Database mapped to those CWEs. A category with few CVEs is not a small risk: A03 has the highest exploit and impact scores of the ten.
2025CategoryIn 2021Chosen byCWEsAvg. incidenceOccurrencesCVEs

How OWASP builds the list

OWASP's contributors sent test results for . The results name weaknesses by their CWE number; different CWEs occur in this edition's data. The team grouped CWEs into categories of at most 40 CWEs each and ranked categories by the data; the ten on the list hold fewer than half of the CWEs. Eight of the ten places come from that ranking; the other two, A03 and A09, were chosen by a community survey of practitioners, because some risks are hard to find with automated tests and so stay rare in test data. OWASP calls the list "data-informed, but not blindly data-driven".

The ranking uses a formula that OWASP publishes on its methodology page:


      

We applied that formula to the score tables of the ten categories and of the two near misses that have one. The bars below are our arithmetic, not OWASP's.

Show the computation for every category
CategoryMax incidence × 1000Max coverage × 100Exploit × 10Impact × 20Occurrences ÷ 10,000Score

Where OWASP's own pages disagree

While checking every figure against OWASP's pages, we found places where the pages disagree, with each other or within one page: figures in the introduction that differ from the category page they describe, pages whose text, score table and list of CWEs do not agree, and names that differ. Where they differ, this report uses the category pages, because they carry the full score table and list each CWE.

AboutWhatOne place saysAnother place says

Three risks that came close

    Section 3 · our classification

    A mini taxonomy of the ten

    OWASP ranks the categories it takes from its data by a risk score and adds two from a survey. To see what the ten share as programming problems, we classified our ten demos by four questions. Strictly, this is a faceted classification rather than a hierarchy: four independent questions, each with a closed list of answers. The rule: a category gets every answer that at least one of its scenarios shows, so it describes the demo, not everything OWASP files under the category. The classification is ours, made by the two of us from the code; OWASP does not publish one. Hover over an answer for its definition, or open the list below.

    Definitions of the answers

    What the classification shows

      Where each demo sits in one application

      The ten demos placed in one web application. Six stages handle every request; five more parts surround it. Each marker is a link to that category's section, and the filter above dims the ones that do not match. A01 appears twice, for its two scenarios, and A02 twice, for its settings and its error page.

      Our ten fixes use six kinds of repair

      Two design principles of Saltzer and Schroeder (1975) meet in the first row: complete mediation, checking every access on the server, and fail-safe defaults, refusing unless access is allowed. The fifth and the last rows carry fail-safe defaults over from access decisions to settings and to failures.

      RepairIn our codeCategories

      Next to STRIDE

      Our question "what is lost" looks at the same thing as Microsoft's threat model STRIDE, from the other side: STRIDE names six kinds of threat, and each one threatens one security property. Five of the six line up with our answers. The sixth, elevation of privilege, threatens authorization, which our list leaves out on purpose: we record what the attack costs, so A01, where Mallory reads other people's invoices, counts as a loss of confidentiality.

      STRIDE threatProperty it threatensOur valueOur categories with that value

      Section 4

      The ten categories in code

      Each category below follows the same order: what the flaw is, a sequence diagram of the attack against both versions, the vulnerable code, the attack, the fix, the program's real output, what the fix still does not do, and the weaknesses involved. Red marks where an attack succeeds, green where a fix stops it.

      Results at a glance

      Each row was run while this page was built. Attack, vulnerable: the attack must succeed against the starting code. Attack, fixed: it must fail against the fix. Normal use: an honest user's request must still work with the fix.
      CategoryScenarioAttack, vulnerableAttack, fixedNormal use

      Section 5

      The interactive lab

      The same ten demos also became exercises. In the lab, a lesson explains the flaw, the learner runs the attack against the starting code, changes the code in an editor, and the page checks the change with the two rules from section 1 for the fixed version: the attack must fail, and normal use must still work. The Python runs inside the visitor's browser, so the website itself is only static files: there is no server that runs anyone's code.

      How the lab runs a learner's code. Nothing is executed on the server. The page carries its own content security policy; the worker gets a separate one only from a header that the server sends, as learn/serve.py does and a real host must be set up to do. A run that takes longer than seconds is stopped by terminating the worker.

      Screenshots

      What was tested

        Half-fixes the check refuses

        Each of these is a test in learn/test_runner.py: a plausible fix that stops part of the problem, and that the lab must not accept.

          Section 6

          Run it yourself

          The demos need Python 3.10 or later and nothing else, and they run offline.

          Commands

          Files

            Section 7

            Limitations

            • Each demo shows between and weaknesses, while each OWASP category maps between 5 and 40 CWEs. The demos show CWEs in all; of them are mapped by OWASP to the category they illustrate, and to another category. Each category's section says which.
            • The demos are Python only. Weaknesses that need a browser to show, such as cross-site scripting (part of A05) and cross-site request forgery (part of A01), are not demonstrated.
            • The network in A01 and the package indexes in A03 are simulated. The attacks show the logic of the flaw, not how it is exploited on a real network.
            • Each fix is the smallest change that makes the attack fail. None is a complete defence; each category's section lists what its fix does not do.
            • The OWASP figures were copied from the pages on . report/check_sources.py compares them with the pages again on request; it is the only part of the project that reads OWASP's pages. The risk scores in section 2 are our own arithmetic and do not match OWASP's stated scores exactly.
            • The classification in section 3 was made by the two authors together, without an independent second coding.
            • The tests were written by the same people as the fixes, so they check what we thought of. The lab's half-fix tests and the normal-use checks reduce this; they do not remove it.
            • The lab is a prototype. It has been tested in a Chromium-based browser and in Firefox, not in Safari, on phones or on a real hosting account.

            Corrected on 26 November 2026

            A review of the demos against this report's text found places where the code did less than the text said. Each was fixed; where tests were added with a fix, their number is given in brackets.

            • A02, A08 and A09: the fixed code crashed on input with non-ASCII characters, because hmac.compare_digest refuses such text. It now compares bytes (three tests). In A08 one character in a cookie's tag was enough to cause a server error.
            • A09: an unknown user could log in with an empty password (one test), and the printed count of log lines with a typed password counted one guess instead of all of them.
            • A04: the attacker's lookup table was always built with MD5, so the fix's result did not depend on the salt. The table is now built with the scheme under attack.
            • A01: the attack never reached the fix's second check, of the address. A fourth request now re-points an allowed name (three tests).
            • A10: the fix debited before it credited, so the transaction was not what stopped the attack. It now keeps the original order, and the rollback undoes the credit.
            • A02: the fix wrote the request path into the log unescaped, the same log forging that A09 shows. A03: the fixed resolver now refuses an unknown index instead of falling back to the public one (one test). A06: each misuse case is now tested on its own (two tests).
            • of the weaknesses listed are mapped by OWASP to another category; each category's section now says which. The lab's syntax check now also reports errors that Python finds only when compiling, such as return outside a function (one test of the lab).

            Section 8

            Conclusion

              Section 9

              Sources, and what is ours

              Category names, positions, score-table figures and the lists of mapped CWEs are OWASP's, read from the pages below on ; each category's full list is under "All CWEs that OWASP maps". OWASP publishes the Top 10 under the licence. The prevention lists are our summaries of OWASP's advice. The code, the tests, the lab, the figures, the explanations and the classification are our own work.

              OWASP Top 10

                Other references