Crash Course into the�OWASP API Security Top 10
Alan Shen
Lead Security Software Engineer at Alteryx
whoami
Lead Security Software Engineer at Alteryx
Agenda
�
Introducing APIs
Application Programming Interfaces �are contracts for communication between systems
For example:
Vending Machine Analogy
Why focus on APIs
crAPI
What’s new in the OWASP�API Top 10
Open Worldwide Application Security Project
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
“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/
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
Object Oriented Abstraction Levels
Broken Object/Function-level Authorization
Table from https://university.apisec.ai/products/api-penetration-testing/ (Exploiting API 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)
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-USD
>> changed to BTC-USD
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 Authentication
Accepted JWTs only required a valid Email, no password/signature required �
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)
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
Boundaries and Defense in Depth
(Kidwelly Castle)
~1275 AD
~1500 AD
Lack of Visibility/Awareness
Improper Inventory Management
Security Misconfiguration
Improper Inventory Management
Improper Inventory Management
Improper Inventory Management
Indicators of APIs/docs
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)
crapi: Improper Inventory Management (forced browsing)
Security Misconfiguration
“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
Falling into the 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
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:
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)
�https://twitter.com/TipsyBacchus/status/1560037721514672129