Intro to the OWASP
API Security Top 10 (2023)
Alan Shen
Senior Security Software Engineer at Alteryx
whoami
Senior Security Software Engineer at Alteryx
Amateur speaker at Denhac/DC303����
�
dc303.org
meetup.com/denhac-hackerspace/ meetup.com/dc303denver/
Agenda
Target audience: �You want to learn more about what’s new in the 2023 update of the OWASP API Top 10
�By the end of this talk, the audience should be able to recognize categories �of the OWASP API Top 10. �They will also be aware of where to find additional learning resources �for specific implementation needs.
Introducing APIs
Remember this from Def Con 30?
https://twitter.com/TipsyBacchus/status/1560037721514672129
APIs are contracts for communication between systems
Why look at APIs
crAPI
What’s new in the OWASP�API Top 10
OWASP API Security Top 10
(2023)
(2019)
OWASP API Security Top 10
What stayed the same:
(2023)
(2019)
Naming tweaks for [User] Authentication and Assets/Inventory Management�to make those categories more broadly applicable (but still essentially the same lessons)
OWASP API Security Top 10
(2023)��
(2019)
Excessive Data Exposure and Mass Assignment were combined into their root cause: �Errors with validating Object Property Level Authorization
OWASP API Security Top 10
(2023)
(2019)
More emphasis on resource consumption, and emphasizes less the “rate”
OWASP API Security Top 10
(2023 - new)
(2019 - removed)
��� The two 2019 categories not specific to APIs
Anything in the general OWASP Top 10 is also potentially applicable!
Common threads from the 2023 top 10
Allowing Unreasonable
Client Access
Unrestricted Resource Consumption
Unrestricted Access to Sensitive Business Flows
Attacker approaches to bypass individual access limits
Controlling unreasonable client access
Forgetting to validate Authorization
Authentication vs. Authorization
Broken Object Property Level Authorization
When a user can read/write object properties that they should not have access to
Excessive Data Exposure
(API 2019)
Example anti-pattern:
Redactle solution exposure
https://redactle-unlimited.com/
Mass Assignment (API 2019)
Broken Object/Function-level Authorization
Table from https://university.apisec.ai/products/api-penetration-testing/ (Exploiting API Authorization)
Coinbase Unlimited Trading Exploit�(Feb 2022) Bounty: $250,000
https://twitter.com/Tree_of_Alpha/status/1495014907028422662
What pops out from this request?
>> changed to BTC
>> changed to BTC
changed to account with SHIB
https://blog.coinbase.com/retrospective-recent-coinbase-bug-bounty-award-9f127e04f060
crAPI BOLA Example
GET /community/api/v2/community/posts/recent
(forum excessive disclosure)
Response
Authorization is hard
Further reading: https://www.osohq.com/post/why-authorization-is-hard by Sam Scott
Boundaries being bypassed
Broken User Authentication
Generating a JWT, and using gspimsAccessToken in a Cookie�completely bypassing the various corporate login flows (e.g. two-factor authentication)
Impact: Internal API access allowed researching who had greater privileges�while JWT generation ability for any employees allowed increasing privilege escalation
SSRF Preamble: What separates the “internal” side?
Potential barriers:
The
“DMZ”
GET /api/kitchen/make_sandwich {
"recipe_url": "https://sandwich.com/turkey"
}
Server Side Request Forgery
(1)
(2)
(3)
(4)
(Public)
(Internal)
Potential requests to forge:
GET /api/kitchen/make_sandwich {
"recipe_url": "file:///etc/passwd"
}
SSRF: Indicators of success
Two types of results:
GET /api/kitchen/make_sandwich {
"recipe_url": � "https://webhook.site/[generated_guid]"
}
Unsafe Consumption �of APIs
With “trusted” APIs, relaxed security could allow:
Boundaries and Defense in Depth
(Kidwelly Castle)
~1275 AD
~1500 AD
Lack of Visibility/Awareness
Improper Inventory Management
Security Misconfiguration
Improper Inventory Management
"Don't put credentials in your source code," says Chris Anley, chief scientist at NCC Group. "And certainly don't then publish that source code."
(According to GitGuardian)
Indicators of APIs/docs
crapi: Improper Inventory Management (forced browsing)
Security Misconfiguration
Lack of security hardening can involve:
Vulnerability scanners can help flag �insecure configurations for review
“The OAuth misconfigurations could have allowed for both large-scale account takeover (ATO) on customers’ accounts and server compromise”
https://www.itsecurityguru.org/2023/03/02/serious-api-security-flaws-now-fixed-in-booking-com-could-affect-many-more-websites/
Falling into the Pit of Despair / Pit of Success
Takeaways
Monitor for and limit suspicious access patterns
Enforce authorization consistently across the �system architecture
Build defense in depth to cover leakages in architectural/security boundaries
Automate inventory management, make secure by default, or at last resort have well-defined processes and checklists to minimize human error.
Where to learn more
Questions?
sunzenshen.github.io
Overflow
Welcome to OWASP
The Open Worldwide Application Security Project (OWASP) �is a nonprofit foundation that works to improve the security of software.
Example alternative API style: GraphQL
APIs do not necessarily follow the server/client model of architectures like REST
GraphQL instead follows a query-centric model
crapi: Comparing OTP API versions
(Improper Inventory Management)
API Security Trends
https://www.imperva.com/resources/reports/Imperva-Marsh-McLennan-Report-2022.pdf
In order to quantify the cost of API insecurity, Imperva partnered with the Marsh McLennan Global Cyber Risk Analytics Center to analyze API-related incident data. Their research suggests that the lack of secure APIs could have the following impact:
In order to develop the estimated amount of loss attributed to API-related events, researchers combined the Marsh McLennan incident data, the raw API-related incident proportion, and the underreporting factor to develop an estimated API-related frequency range of 4.1-7.5%. Researchers then applied the percentage range of events from API issues to develop the following annual API-related loss estimates:
“It’s obvious from recent news about mega breaches involving APIs, such as Optus and T-Mobile, that the API threat landscape is becoming more dangerous,” said Ivan Novikov, CEO of Wallarm�
https://www.helpnetsecurity.com/2023/03/08/api-threat-landscape/
Example Newsworthy�API Vulnerabilities
Experian Partner API (April 2021)
https://krebsonsecurity.com/2021/04/experian-api-exposed-credit-scores-of-most-americans/
Peloton (May 2021)
USPS Informed Visibility API �(November 2018)