OWASP API Security Top 10
| Published by | OWASP API Security Project |
|---|---|
| First edition | 2019 |
| Current edition | 2023, the second |
| Scope | 10 risks specific to APIs |
| Identifier form | API1:2023 |
| Website | owasp.org/www-project-api-security |
The OWASP API Security Top 10 is a list of ten security risks that apply to APIs, the addresses a web frontend, a mobile app or another server calls to read and change data. The first edition came out in 2019 and the second, current one in 2023.1 An item is cited by number and edition: API1:2023 is Broken Object Level Authorization in the 2023 list, and the same number can stand for a different risk in 2019.23
Risks that behave the same in any application are left off. Injection and outdated components do occur in APIs, but they are found and exploited there in the same way as elsewhere, so the project did not repeat them.4 Half of the 2023 items are about which records, fields and functions a caller may reach (API1, API3, API5) or how much of a service one client may use up (API4, API6).2
The 2023 list
| Item | Name | What fails |
|---|---|---|
| API1 | Broken Object Level Authorization | A route loads a record by an ID the client sends and does not check that the caller may use that record. See Insecure direct object reference. |
| API2 | Broken Authentication | Flaws in sign-in or token handling let an attacker take over tokens or act as someone else. See Authentication. |
| API3 | Broken Object Property Level Authorization | A response carries fields the user should not see, or a request may change fields the user should not touch. See Mass assignment. |
| API4 | Unrestricted Resource Consumption | Nothing caps CPU, memory, storage, bandwidth or paid services such as text messages, so one client can stop the service or raise its bill. See Rate limiting, Denial of wallet and Database dumping. |
| API5 | Broken Function Level Authorization | An ordinary account can call an administrative function, or one meant for another role. |
| API6 | Unrestricted Access to Sensitive Business Flows | A flow such as buying a ticket or posting a comment can be run by a script at a scale that hurts the business. See API scraping. |
| API7 | Server Side Request Forgery | The API fetches a URL supplied by the user without checking where it points. See Server-side request forgery. |
| API8 | Security Misconfiguration | Settings of the API, or of the systems beneath it, left in an insecure state. |
| API9 | Improper Inventory Management | Old API versions, forgotten hosts and debug endpoints that nobody keeps track of. See Exposed API documentation and debug endpoints. |
| API10 | Unsafe Consumption of APIs | Data from a third-party API gets more trust than input from users. |
Changes from 2019
Excessive Data Exposure (API3:2019) and Mass Assignment (API6:2019) became a single item, API3:2023. Both come from a missing check on individual properties of an object: one in what the API sends out, the other in what it accepts.51
Lack of Resources & Rate Limiting (API4:2019) was renamed Unrestricted Resource Consumption. The new name moves the weight from how fast resources run out to how much of them a client uses, and the 2023 item counts outside services billed per request, such as email and text messages, among those resources.12 A new item, API6:2023, takes in newer threats, among them most of those a rate limit can stop, and its cause need not be a bug in the code.1
API10:2023 is also new. The team added it after seeing attackers go after the services a target integrates with, in place of the target's own API.1 Server Side Request Forgery entered as API7. Injection (API8:2019) and Insufficient Logging & Monitoring (API10:2019) are gone, and Improper Assets Management became Improper Inventory Management.32
How the order was set
The 2023 edition is not ranked from measured data. A public call for data ran from 1 September to 30 November 2022 and nobody contributed any.41 The team started from public incident reports and Bug bounty program findings from 2019 to 2022, wrote a draft, had API security specialists review it and published a release candidate for comment.4
Each risk was scored with the OWASP Risk Rating Methodology: exploitability, prevalence, detectability and technical impact on a scale of 1 to 3, with business impact left to each organisation. Prevalence was set by consensus within the team.6 The order reflects that judgement of APIs in general. The likelihood of an attack on a particular application and the cost to its business are left to the organisation that runs it.6
Object level and function level
API1 and API5 are both Authorization failures, and they differ in what the check is about. A function level check asks whether this user may call this operation at all. It fails when an ordinary account reaches a route such as /api/v1/users/export_all, or deletes a record by sending DELETE in place of GET as the HTTP method of a request.7 An object level check asks whether this user may use this particular record. A route that lets every customer read their orders passes the function check, and fails the object check if customer A gets order 1002, which belongs to customer B, by asking for it.
APIs are prone to the object level failure because the server keeps little state about the client and picks the record from an ID the client sends.8 Comparing the user ID in the session token, such as a JWT, with an ID in the request covers only a small share of cases.8 The fix is a check, in every function that loads a record from client input, that the user may perform the action on that record. Random, hard-to-guess record IDs and tests that block a deploy when the check fails are listed as well.8
Function level failures tend to follow from how routes are laid out. Administrative routes are commonly found next to regular ones under paths like /api/users, so a path does not show which routes need a role check.7 One authorization module called from every business function keeps the checks the same everywhere and easier to review.7
Data from other APIs
API10 points the other way, at the responses an API receives from services it calls. Developers tend to trust a well-known provider's data more than user input.9 In the item's first scenario, an API passes a user's business address to an outside service to add details. An attacker takes over that service and has it answer 308 Permanent Redirect with a server the attacker runs. The API follows redirects without checking them and sends the same request, with the user's data, to the attacker.9 The listed measures are TLS on every call, validation of the data that comes back and an allowlist of places a redirect may lead to. An API that sets no timeout or resource limit on third-party responses also counts as exposed.9
Breach at T-Mobile US
On 5 January 2023 T-Mobile US found that someone had been pulling customer data through a single API without authorization, and cut off the activity within a day. Its filing with the US Securities and Exchange Commission dated the first retrieval to about 25 November 2022 and put the number of affected accounts at about 37 million. The API returned names, billing addresses, email addresses, phone numbers, dates of birth, account numbers and plan details. It gave no access to payment cards, social security numbers or passwords.10 The filing does not say which weakness was used.
In SecFlash
SecFlash tests API1 with two test accounts: when account B asks for a record that belongs to account A and gets it, it reports SF-EXP-501 on the Exposure page. Code that copies every field of a request into a database record, the write side of API3, is SF-SEC-740 on the Security page. API calls with no rate limit are SF-EXP-208, and a public OpenAPI or Swagger file that lists every route is SF-EXP-204, both on the Exposure page.
See also
- OWASP Top 10
- OWASP
- Insecure direct object reference
- Mass assignment
- Rate limiting
- GraphQL security
- Business logic flaws
- Category: Testing and standards
References
- a b c d e f OWASP API Security Project (2023). "Release Notes". OWASP API Security Top 10, 2023 edition.
- a b c d e OWASP API Security Project (2023). "OWASP Top 10 API Security Risks, 2023". OWASP API Security Top 10.
- a b OWASP API Security Project (2019). "OWASP Top 10 API Security Risks, 2019". OWASP API Security Top 10.
- a b c OWASP API Security Project (2023). "Methodology and Data". OWASP API Security Top 10, 2023 edition.
- back "API3:2023 Broken Object Property Level Authorization". OWASP API Security Top 10. OWASP Foundation.
- a b OWASP API Security Project (2023). "API Security Risks". OWASP API Security Top 10, 2023 edition.
- a b c OWASP API Security Project (2023). "API5:2023 Broken Function Level Authorization". OWASP API Security Top 10.
- a b c "API1:2023 Broken Object Level Authorization". OWASP API Security Top 10. OWASP Foundation.
- a b c OWASP API Security Project (2023). "API10:2023 Unsafe Consumption of APIs". OWASP API Security Top 10.
- back T-Mobile US, Inc. (19 January 2023). "Form 8-K, Item 8.01: Other Events". US Securities and Exchange Commission, EDGAR.
External links
- OWASP API Security Project, OWASP Foundation
- OWASP/API-Security, GitHub repository of the list