SlideShare a Scribd company logo
1 of 26
Download to read offline
1
OWASP API SECURITY TOP 10
This work is licensed under a Creative Commons Attribution-NonCommercial-
ShareAlike 4.0 International License.
APIS ARE THE NEW ATTACKS VECTOR!
Data breaches via APIs are on the rise
✓ 150+ issues reported on
apisecurity.io since Oct. 2018
✓ And those are just the public ones!
Most recurrent causes:
✓ Input validation issues
✓ Bad security configuration
✓ Data/Exception leakage
2
FINALLY! OWASP API SECURITY TOP 10
A recognition that API Security is not Web Application Security
✓ Different attack vectors
✓ Data centric (lots of attacks come from mishandling API data)
3
https://github.com/OWASP/API-Security/blob/develop/2019/en/dist/owasp-api-security-top-10.pdf
MEET PIXI !
An API that exposes all the issues APIs can have!
Totally vulnerable! So don’t deploy it with your stuff
Part of an OWASP Project called DevSlop
4
EXTRACTION VIA ENUMERATION
APIs relies on public IDs to retrieve information, for example
✓ GET /shops/shop1/revenue_data.json
✓ Returns info from shop1 if you’re authenticated
✓ What happens if I call GET /shops/shop2/revenue_data.json?
In 2017, a major flaw was discovered in a T-mobile API which
would have allowed to retrieve any T-mobile customer
information from their phone number. All you needed was a
valid token.
What can you do ?
✓ Use non-guessable IDs (UUIDs)
✓ Implement authorization checks to validate the user actually owns the
data they are trying to retrieve
✓ Don’t expose internal IDs externally - Instead use a non-guessable ID you
then map to internal IDs.
5
A1: OBJECT LEVEL ACCESS CONTROL
USERS IDS EXPOSED BY PIXI
GET {{42c_url}}/api/user/info
Data is coming straight from database, which uses
enumeration to create unique IDs for users
6
A1 AND A7 COMBINED EFFECT
Let’s forge a JWT token
(I know the secret, see
A7!)
Specify an ID which is
the user identifier and
you can get the user
information passing that
JWT as access-token.
7
ACCESS TOKENS MISUSE
Access tokens are used for authentication purposes
A single token allows to access many APIs and operations
API Keys and OAuth secrets are leaking all over Github
✓ A very easy mistake!
What you should do
✓ Restrict access token usage
• Google APIs example (restrictions on referrers, APIs list, IPs).
• OAuth scopes
• Fine-grained authorization (attribute-based for example)
✓ Don’t rely on access tokens to authenticate a user (use OpenID
Connect instead) - Remember the hotel card analogy!
✓ Use short-lived access tokens
✓ Authenticate your apps (so you know who is talking to you)
8
A2:BROKEN AUTHENTICATION
PREVENT DATA LEAKAGE
Developers tend to create generic APIs which
expose lots of information and let client UIs filter
what they need.
APIs return excessive information
APIs leak exception information (exposing server
internals)
What you can do
✓ Describe precisely the response structure and block
anything not matching the specification
✓ Use a controller layer to filter the data an API can expose
externally
9
A3: EXCESSIVE DATA EXPOSURE
A3 AND PIXI
GET {{42c_url}}/api/user/info
10
N26 EXAMPLE
11
LIMIT ACCESS TO APIS
APIs are subject to abuse (brute force attacks for
example) if calls rate is not limited properly
DOS type attacks exhaust system resources
Things to watch for
✓ Don’t base rate limiting just on IP address : not sufficient as
cloud platforms can be used by hackers to spawn thousands of
instances that all have different IPs.
✓ Rate limiting should use request information to count requests,
for example user identity inside a JWT or APIKey passed in a
header
✓ Use intervals to limit how quickly calls can be made (i.e. leave
150 ms across 2 calls from same identified client)
✓ Limit resources an API server can use: for example, in Docker/
K8s use CPU/Mem/threads limits.
12
A4: LACK OF RESOURCES
AND RATE LIMITING
A MORE INTERESTING SAMPLE THAN PIXI
Brute force attack on Instagram to guess 6-digit password reset code
Rate limiting of 200 attempts / minute ! per IP
Hackers circumvented this by renting AWS machines, all with different
IPs.
13
BLOCKING UN-AUTHORIZED CALLS
Example:
✓ Developers mix admin operation together with non-admin ones
in same API
✓ Developers leave sensitive verbs (PATCH/DELETE) in API
implementation that can be exploited to update/delete data
with no further authorization
Hackers use bots to guess which potential paths are
open (say GET /admin/user or PUT /user) and get
access to information that should be hidden.
What you can do
✓ Detect whether verbs not specified in API contract can be used
✓ Systematically reject any path not described in the API contract
✓ Validate that the user has proper access rights
14
A5: RESOURCE LEVEL ACCESS CONTROL
A5 AND PIXI
Administrative
operations
blocked via
*app* checks
(not API
checks)
15
CONTROLLING DATA UPDATES
APIs support changing data via mass assignment,
leading for example to an hacker updating their
role or updating a resource
Related to A3 (exposing too much data)
What you can do
✓ OpenAPI contract describes exactly which information can be
passed for each operation/verb
✓ Systematically rejects any request not conforming to the
contract
✓ Support PATCH operations
16
A6: MASS ASSIGNMENT
A6 AND PIXI
17
Making myself an admin!
SECURITY MISCONFIGURATION
Known API breaches:
✓ Equifax breach was due to a crafted Content-Type header - This Apache Struts
vulnerability had been reported and fixed, but not deployed at Equifax.
Misconfigured environment
✓ Security is only as strong as its weakest link!
Detect vulnerable libraries
✓ Use solutions that can analyze dependencies and report on vulnerable libraries
✓ Particularly critical for Node.js, as dependency graph can be huge (you basically have
no idea what you are using)
✓ Docker images vulnerability scanners
What you can do
✓ Limit external dependencies
✓ Continuously assess system security configuration
✓ Use known and trusted libraries!
✓ Don’t code your own security stack …
18
A7: MISCONFIGURED SECURITY
A7 AND PIXI
Direct access to server.conf file
✓ http://localhost:8000/server.conf
✓ Leaks session secret! now we can create
JWTs!
Unprotected MongoDB admin console
✓ http://localhost:28017
19
USING NODE.JS ? READ THIS !
20
https://hackernoon.com/im-harvesting-credit-card-numbers-and-
passwords-from-your-site-here-s-how-9a8cb347c5b5
PIXI VULNERABILITIES
14 includes (require) , 598 dependencies!
21
PREVENTING TYPICAL INJECTIONS
This is a common issue across web applications
and APIs.
Remote code injection, SQL injection, noSQL
injection all fall in this category
Samsung Smarthings is a good example of JSON
injection leading to crashing the video server
What you need to do:
✓ Sanitize inputs
22
A8: INJECTION
A8 AND PIXI
NoSQL MongoDb injection
23
IMPROPER ASSETS MANAGEMENT
Document all APIs with OpenAPI/RAML
Implement APIs governance
Make sure API versions are tracked (deprecated,
retired, etc.)
Adopt DevSecOps so that security is considered as
early as possible. This way, even Dev APIs are
protected.
API deployment can be blocked via CI/CD pipelines
to prevent unsecured APIs from being deployed,
even in Dev/QA.
24
A9:IMPROPER ASSETS MANAGEMENT
API SECURITY VISIBILITY
Abuse of APIs goes un-noticed … i.e. you realize weeks
later that you had a breach.
Produce transaction logs which can be exported to 3rd
party systems, such as SIEMs for further analysis and
exploitation
Protect Logs !
✓ Make sure you’re not vulnerable to log injection!
Watch what you write in logs!
✓ Token and keys passed in URL versus HTTP Headers
✓ Tokens and Keys written from code
✓ Use Redaction whenever possible (
• For example, redact 50% of the strings, so they are still useful for debugging, but
useless for hacking, for example DFETEHD-xxxxxxxx
25
A10: INSUFFICIENT LOGGING
AND MONITORING
A10 AND PIXI
Leaking information in logs
26
pixiapp | token
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Il9pZCI6MzMsImVtYWlsIjoiaGFja2VyQGdldG1l
mluIiwicGFzc3dvcmQiOiJoZWxsb3BpeGkiLCJuYW1lIjoiaW52b2x2ZWRwbHVzIiwicGljIjoiaHR0cHM6Ly9zMy5
bWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci90aGlhZ292ZXJuZXR0aS8xMjguanBnIiwiaXNfYWRtaW
iOmZhbHNlLCJhY2NvdW50X2JhbGFuY2UiOjUwLCJhbGxfcGljdHVyZXMiOltdfSwiaWF0IjoxNTY4MjE2OTc3fQ.Ld
9xT1Q2JqbrnPBe395kFrny3vgg9BKxRQ-OTa6f6U"
pixiapp | owaspbrokenwebapps
pixiapp | my user {"user":{"_id":
33,"email":"hacker@getme.in","password":"hellopixi","name":"involvedplus","pic":"https://
s3.amazonaws.com/uifaces/faces/twitter/thiagovernetti/
128.jpg","is_admin":false,"account_balance":50,"all_pictures":[]},"iat":1568216977}
pixiapp | user id 33

More Related Content

What's hot

OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)TzahiArabov
 
OWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksOWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksIndusfacePvtLtd
 
Pentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarOWASP Delhi
 
OWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewOWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewMichael Furman
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
 
OWASP Top Ten API Project 2019
OWASP Top Ten API Project 2019OWASP Top Ten API Project 2019
OWASP Top Ten API Project 2019Fernando Galves
 
Anatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilitiesAnatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilitiesDaveEdwards12
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...Lenur Dzhemiliev
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesMarco Morana
 
Getting Started with API Security Testing
Getting Started with API Security TestingGetting Started with API Security Testing
Getting Started with API Security TestingSmartBear
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing TechniquesAvinash Thapa
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Brian Huff
 
Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...Codemotion
 
Secure code practices
Secure code practicesSecure code practices
Secure code practicesHina Rawal
 

What's hot (20)

OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)
 
OWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksOWASP Top 10 API Security Risks
OWASP Top 10 API Security Risks
 
Pentesting ReST API
Pentesting ReST APIPentesting ReST API
Pentesting ReST API
 
Pentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang BhatnagarPentesting Rest API's by :- Gaurang Bhatnagar
Pentesting Rest API's by :- Gaurang Bhatnagar
 
OWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewOWASP Top 10 2021 What's New
OWASP Top 10 2021 What's New
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
Sql injection
Sql injectionSql injection
Sql injection
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
API Security Lifecycle
API Security LifecycleAPI Security Lifecycle
API Security Lifecycle
 
OWASP Top Ten API Project 2019
OWASP Top Ten API Project 2019OWASP Top Ten API Project 2019
OWASP Top Ten API Project 2019
 
Anatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilitiesAnatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilities
 
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
OWASP Top 10 Vulnerabilities - A5-Broken Access Control; A6-Security Misconfi...
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root Causes
 
Getting Started with API Security Testing
Getting Started with API Security TestingGetting Started with API Security Testing
Getting Started with API Security Testing
 
OWASP Top Ten
OWASP Top TenOWASP Top Ten
OWASP Top Ten
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...Secure Coding principles by example: Build Security In from the start - Carlo...
Secure Coding principles by example: Build Security In from the start - Carlo...
 
Secure code practices
Secure code practicesSecure code practices
Secure code practices
 

Similar to OWASP API Security Top 10 Examples

apidays LIVE Paris - Protecting financial grade API: adopting the right secur...
apidays LIVE Paris - Protecting financial grade API: adopting the right secur...apidays LIVE Paris - Protecting financial grade API: adopting the right secur...
apidays LIVE Paris - Protecting financial grade API: adopting the right secur...apidays
 
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...apidays
 
Guidelines to protect your APIs from threats
Guidelines to protect your APIs from threatsGuidelines to protect your APIs from threats
Guidelines to protect your APIs from threatsIsabelle Mauny
 
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...apidays
 
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...apidays
 
Protecting Microservices APIs with 42Crunch API Firewall
Protecting Microservices APIs with 42Crunch API FirewallProtecting Microservices APIs with 42Crunch API Firewall
Protecting Microservices APIs with 42Crunch API Firewall42Crunch
 
APISecurity_OWASP_MitigationGuide
APISecurity_OWASP_MitigationGuide APISecurity_OWASP_MitigationGuide
APISecurity_OWASP_MitigationGuide Isabelle Mauny
 
Top API Security Issues Found During POCs
Top API Security Issues Found During POCsTop API Security Issues Found During POCs
Top API Security Issues Found During POCs42Crunch
 
APIDays Paris Security Workshop
APIDays Paris Security WorkshopAPIDays Paris Security Workshop
APIDays Paris Security Workshop42Crunch
 
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...apidays
 
London Adapt or Die: Securing your APIs the Right Way!
London Adapt or Die: Securing your APIs the Right Way!London Adapt or Die: Securing your APIs the Right Way!
London Adapt or Die: Securing your APIs the Right Way!Apigee | Google Cloud
 
API Security Best Practices and Guidelines
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and GuidelinesWSO2
 
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...apidays
 
The ultimate api checklist by Blendr.io
The ultimate api checklist by Blendr.ioThe ultimate api checklist by Blendr.io
The ultimate api checklist by Blendr.ioBlendr.io
 
API Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersAPI Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersInon Shkedy
 
Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack CA API Management
 
APIConnect Security Best Practice
APIConnect Security Best PracticeAPIConnect Security Best Practice
APIConnect Security Best PracticeShiu-Fun Poon
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsApigee | Google Cloud
 

Similar to OWASP API Security Top 10 Examples (20)

apidays LIVE Paris - Protecting financial grade API: adopting the right secur...
apidays LIVE Paris - Protecting financial grade API: adopting the right secur...apidays LIVE Paris - Protecting financial grade API: adopting the right secur...
apidays LIVE Paris - Protecting financial grade API: adopting the right secur...
 
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
apidays LIVE LONDON - Protecting financial-grade APIs - Getting the right API...
 
Guidelines to protect your APIs from threats
Guidelines to protect your APIs from threatsGuidelines to protect your APIs from threats
Guidelines to protect your APIs from threats
 
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
APIdays Paris 2019 - API Security Tips for Developers by Isabelle Mauny, 42Cr...
 
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
APIdays London 2019 - API Security Tips for Developers with Isabelle Mauny, 4...
 
Protecting Microservices APIs with 42Crunch API Firewall
Protecting Microservices APIs with 42Crunch API FirewallProtecting Microservices APIs with 42Crunch API Firewall
Protecting Microservices APIs with 42Crunch API Firewall
 
APISecurity_OWASP_MitigationGuide
APISecurity_OWASP_MitigationGuide APISecurity_OWASP_MitigationGuide
APISecurity_OWASP_MitigationGuide
 
Top API Security Issues Found During POCs
Top API Security Issues Found During POCsTop API Security Issues Found During POCs
Top API Security Issues Found During POCs
 
APIDays Paris Security Workshop
APIDays Paris Security WorkshopAPIDays Paris Security Workshop
APIDays Paris Security Workshop
 
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
apidays LIVE Paris 2021 - Addressing OWASP API Security Top 10 by Isabelle Ma...
 
London Adapt or Die: Securing your APIs the Right Way!
London Adapt or Die: Securing your APIs the Right Way!London Adapt or Die: Securing your APIs the Right Way!
London Adapt or Die: Securing your APIs the Right Way!
 
API Security Best Practices and Guidelines
API Security Best Practices and GuidelinesAPI Security Best Practices and Guidelines
API Security Best Practices and Guidelines
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
apidays LIVE New York 2021 - Top 10 API security threats every API team shoul...
 
The ultimate api checklist by Blendr.io
The ultimate api checklist by Blendr.ioThe ultimate api checklist by Blendr.io
The ultimate api checklist by Blendr.io
 
API Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentestersAPI Security - OWASP top 10 for APIs + tips for pentesters
API Security - OWASP top 10 for APIs + tips for pentesters
 
Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack
 
APIConnect Security Best Practice
APIConnect Security Best PracticeAPIConnect Security Best Practice
APIConnect Security Best Practice
 
Securing RESTful API
Securing RESTful APISecuring RESTful API
Securing RESTful API
 
API Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIsAPI Services: Building State-of-the-Art APIs
API Services: Building State-of-the-Art APIs
 

More from 42Crunch

REST API Security by Design with Azure Pipelines
REST API Security by Design with Azure PipelinesREST API Security by Design with Azure Pipelines
REST API Security by Design with Azure Pipelines42Crunch
 
Are You Properly Using JWTs?
Are You Properly Using JWTs?Are You Properly Using JWTs?
Are You Properly Using JWTs?42Crunch
 
OWASP API Security Top 10 - Austin DevSecOps Days
OWASP API Security Top 10 - Austin DevSecOps DaysOWASP API Security Top 10 - Austin DevSecOps Days
OWASP API Security Top 10 - Austin DevSecOps Days42Crunch
 
WEBINAR: Positive Security for APIs: What it is and why you need it!
 WEBINAR: Positive Security for APIs: What it is and why you need it! WEBINAR: Positive Security for APIs: What it is and why you need it!
WEBINAR: Positive Security for APIs: What it is and why you need it!42Crunch
 
WEBINAR: OWASP API Security Top 10
WEBINAR: OWASP API Security Top 10WEBINAR: OWASP API Security Top 10
WEBINAR: OWASP API Security Top 1042Crunch
 
The Dev, Sec and Ops of API Security - NordicAPIs
The Dev, Sec and Ops of API Security - NordicAPIsThe Dev, Sec and Ops of API Security - NordicAPIs
The Dev, Sec and Ops of API Security - NordicAPIs42Crunch
 
The Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API WorldThe Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API World42Crunch
 
API Security in a Microservices World
API Security in a Microservices WorldAPI Security in a Microservices World
API Security in a Microservices World42Crunch
 
Applying API Security at Scale
Applying API Security at ScaleApplying API Security at Scale
Applying API Security at Scale42Crunch
 
Better API Security with Automation
Better API Security with Automation Better API Security with Automation
Better API Security with Automation 42Crunch
 
Advanced API Security Patterns
Advanced API Security PatternsAdvanced API Security Patterns
Advanced API Security Patterns42Crunch
 
SecDevOps for API Security
SecDevOps for API SecuritySecDevOps for API Security
SecDevOps for API Security42Crunch
 
42crunch-API-security-workshop
42crunch-API-security-workshop42crunch-API-security-workshop
42crunch-API-security-workshop42Crunch
 
Why you need API Security Automation
Why you need API Security AutomationWhy you need API Security Automation
Why you need API Security Automation42Crunch
 
API Security: the full story
API Security: the full storyAPI Security: the full story
API Security: the full story42Crunch
 

More from 42Crunch (15)

REST API Security by Design with Azure Pipelines
REST API Security by Design with Azure PipelinesREST API Security by Design with Azure Pipelines
REST API Security by Design with Azure Pipelines
 
Are You Properly Using JWTs?
Are You Properly Using JWTs?Are You Properly Using JWTs?
Are You Properly Using JWTs?
 
OWASP API Security Top 10 - Austin DevSecOps Days
OWASP API Security Top 10 - Austin DevSecOps DaysOWASP API Security Top 10 - Austin DevSecOps Days
OWASP API Security Top 10 - Austin DevSecOps Days
 
WEBINAR: Positive Security for APIs: What it is and why you need it!
 WEBINAR: Positive Security for APIs: What it is and why you need it! WEBINAR: Positive Security for APIs: What it is and why you need it!
WEBINAR: Positive Security for APIs: What it is and why you need it!
 
WEBINAR: OWASP API Security Top 10
WEBINAR: OWASP API Security Top 10WEBINAR: OWASP API Security Top 10
WEBINAR: OWASP API Security Top 10
 
The Dev, Sec and Ops of API Security - NordicAPIs
The Dev, Sec and Ops of API Security - NordicAPIsThe Dev, Sec and Ops of API Security - NordicAPIs
The Dev, Sec and Ops of API Security - NordicAPIs
 
The Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API WorldThe Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API World
 
API Security in a Microservices World
API Security in a Microservices WorldAPI Security in a Microservices World
API Security in a Microservices World
 
Applying API Security at Scale
Applying API Security at ScaleApplying API Security at Scale
Applying API Security at Scale
 
Better API Security with Automation
Better API Security with Automation Better API Security with Automation
Better API Security with Automation
 
Advanced API Security Patterns
Advanced API Security PatternsAdvanced API Security Patterns
Advanced API Security Patterns
 
SecDevOps for API Security
SecDevOps for API SecuritySecDevOps for API Security
SecDevOps for API Security
 
42crunch-API-security-workshop
42crunch-API-security-workshop42crunch-API-security-workshop
42crunch-API-security-workshop
 
Why you need API Security Automation
Why you need API Security AutomationWhy you need API Security Automation
Why you need API Security Automation
 
API Security: the full story
API Security: the full storyAPI Security: the full story
API Security: the full story
 

Recently uploaded

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noidabntitsolutionsrishis
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 

Recently uploaded (20)

What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in NoidaBuds n Tech IT Solutions: Top-Notch Web Services in Noida
Buds n Tech IT Solutions: Top-Notch Web Services in Noida
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 

OWASP API Security Top 10 Examples

  • 1. 1 OWASP API SECURITY TOP 10 This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
  • 2. APIS ARE THE NEW ATTACKS VECTOR! Data breaches via APIs are on the rise ✓ 150+ issues reported on apisecurity.io since Oct. 2018 ✓ And those are just the public ones! Most recurrent causes: ✓ Input validation issues ✓ Bad security configuration ✓ Data/Exception leakage 2
  • 3. FINALLY! OWASP API SECURITY TOP 10 A recognition that API Security is not Web Application Security ✓ Different attack vectors ✓ Data centric (lots of attacks come from mishandling API data) 3 https://github.com/OWASP/API-Security/blob/develop/2019/en/dist/owasp-api-security-top-10.pdf
  • 4. MEET PIXI ! An API that exposes all the issues APIs can have! Totally vulnerable! So don’t deploy it with your stuff Part of an OWASP Project called DevSlop 4
  • 5. EXTRACTION VIA ENUMERATION APIs relies on public IDs to retrieve information, for example ✓ GET /shops/shop1/revenue_data.json ✓ Returns info from shop1 if you’re authenticated ✓ What happens if I call GET /shops/shop2/revenue_data.json? In 2017, a major flaw was discovered in a T-mobile API which would have allowed to retrieve any T-mobile customer information from their phone number. All you needed was a valid token. What can you do ? ✓ Use non-guessable IDs (UUIDs) ✓ Implement authorization checks to validate the user actually owns the data they are trying to retrieve ✓ Don’t expose internal IDs externally - Instead use a non-guessable ID you then map to internal IDs. 5 A1: OBJECT LEVEL ACCESS CONTROL
  • 6. USERS IDS EXPOSED BY PIXI GET {{42c_url}}/api/user/info Data is coming straight from database, which uses enumeration to create unique IDs for users 6
  • 7. A1 AND A7 COMBINED EFFECT Let’s forge a JWT token (I know the secret, see A7!) Specify an ID which is the user identifier and you can get the user information passing that JWT as access-token. 7
  • 8. ACCESS TOKENS MISUSE Access tokens are used for authentication purposes A single token allows to access many APIs and operations API Keys and OAuth secrets are leaking all over Github ✓ A very easy mistake! What you should do ✓ Restrict access token usage • Google APIs example (restrictions on referrers, APIs list, IPs). • OAuth scopes • Fine-grained authorization (attribute-based for example) ✓ Don’t rely on access tokens to authenticate a user (use OpenID Connect instead) - Remember the hotel card analogy! ✓ Use short-lived access tokens ✓ Authenticate your apps (so you know who is talking to you) 8 A2:BROKEN AUTHENTICATION
  • 9. PREVENT DATA LEAKAGE Developers tend to create generic APIs which expose lots of information and let client UIs filter what they need. APIs return excessive information APIs leak exception information (exposing server internals) What you can do ✓ Describe precisely the response structure and block anything not matching the specification ✓ Use a controller layer to filter the data an API can expose externally 9 A3: EXCESSIVE DATA EXPOSURE
  • 10. A3 AND PIXI GET {{42c_url}}/api/user/info 10
  • 12. LIMIT ACCESS TO APIS APIs are subject to abuse (brute force attacks for example) if calls rate is not limited properly DOS type attacks exhaust system resources Things to watch for ✓ Don’t base rate limiting just on IP address : not sufficient as cloud platforms can be used by hackers to spawn thousands of instances that all have different IPs. ✓ Rate limiting should use request information to count requests, for example user identity inside a JWT or APIKey passed in a header ✓ Use intervals to limit how quickly calls can be made (i.e. leave 150 ms across 2 calls from same identified client) ✓ Limit resources an API server can use: for example, in Docker/ K8s use CPU/Mem/threads limits. 12 A4: LACK OF RESOURCES AND RATE LIMITING
  • 13. A MORE INTERESTING SAMPLE THAN PIXI Brute force attack on Instagram to guess 6-digit password reset code Rate limiting of 200 attempts / minute ! per IP Hackers circumvented this by renting AWS machines, all with different IPs. 13
  • 14. BLOCKING UN-AUTHORIZED CALLS Example: ✓ Developers mix admin operation together with non-admin ones in same API ✓ Developers leave sensitive verbs (PATCH/DELETE) in API implementation that can be exploited to update/delete data with no further authorization Hackers use bots to guess which potential paths are open (say GET /admin/user or PUT /user) and get access to information that should be hidden. What you can do ✓ Detect whether verbs not specified in API contract can be used ✓ Systematically reject any path not described in the API contract ✓ Validate that the user has proper access rights 14 A5: RESOURCE LEVEL ACCESS CONTROL
  • 15. A5 AND PIXI Administrative operations blocked via *app* checks (not API checks) 15
  • 16. CONTROLLING DATA UPDATES APIs support changing data via mass assignment, leading for example to an hacker updating their role or updating a resource Related to A3 (exposing too much data) What you can do ✓ OpenAPI contract describes exactly which information can be passed for each operation/verb ✓ Systematically rejects any request not conforming to the contract ✓ Support PATCH operations 16 A6: MASS ASSIGNMENT
  • 17. A6 AND PIXI 17 Making myself an admin!
  • 18. SECURITY MISCONFIGURATION Known API breaches: ✓ Equifax breach was due to a crafted Content-Type header - This Apache Struts vulnerability had been reported and fixed, but not deployed at Equifax. Misconfigured environment ✓ Security is only as strong as its weakest link! Detect vulnerable libraries ✓ Use solutions that can analyze dependencies and report on vulnerable libraries ✓ Particularly critical for Node.js, as dependency graph can be huge (you basically have no idea what you are using) ✓ Docker images vulnerability scanners What you can do ✓ Limit external dependencies ✓ Continuously assess system security configuration ✓ Use known and trusted libraries! ✓ Don’t code your own security stack … 18 A7: MISCONFIGURED SECURITY
  • 19. A7 AND PIXI Direct access to server.conf file ✓ http://localhost:8000/server.conf ✓ Leaks session secret! now we can create JWTs! Unprotected MongoDB admin console ✓ http://localhost:28017 19
  • 20. USING NODE.JS ? READ THIS ! 20 https://hackernoon.com/im-harvesting-credit-card-numbers-and- passwords-from-your-site-here-s-how-9a8cb347c5b5
  • 21. PIXI VULNERABILITIES 14 includes (require) , 598 dependencies! 21
  • 22. PREVENTING TYPICAL INJECTIONS This is a common issue across web applications and APIs. Remote code injection, SQL injection, noSQL injection all fall in this category Samsung Smarthings is a good example of JSON injection leading to crashing the video server What you need to do: ✓ Sanitize inputs 22 A8: INJECTION
  • 23. A8 AND PIXI NoSQL MongoDb injection 23
  • 24. IMPROPER ASSETS MANAGEMENT Document all APIs with OpenAPI/RAML Implement APIs governance Make sure API versions are tracked (deprecated, retired, etc.) Adopt DevSecOps so that security is considered as early as possible. This way, even Dev APIs are protected. API deployment can be blocked via CI/CD pipelines to prevent unsecured APIs from being deployed, even in Dev/QA. 24 A9:IMPROPER ASSETS MANAGEMENT
  • 25. API SECURITY VISIBILITY Abuse of APIs goes un-noticed … i.e. you realize weeks later that you had a breach. Produce transaction logs which can be exported to 3rd party systems, such as SIEMs for further analysis and exploitation Protect Logs ! ✓ Make sure you’re not vulnerable to log injection! Watch what you write in logs! ✓ Token and keys passed in URL versus HTTP Headers ✓ Tokens and Keys written from code ✓ Use Redaction whenever possible ( • For example, redact 50% of the strings, so they are still useful for debugging, but useless for hacking, for example DFETEHD-xxxxxxxx 25 A10: INSUFFICIENT LOGGING AND MONITORING
  • 26. A10 AND PIXI Leaking information in logs 26 pixiapp | token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7Il9pZCI6MzMsImVtYWlsIjoiaGFja2VyQGdldG1l mluIiwicGFzc3dvcmQiOiJoZWxsb3BpeGkiLCJuYW1lIjoiaW52b2x2ZWRwbHVzIiwicGljIjoiaHR0cHM6Ly9zMy5 bWF6b25hd3MuY29tL3VpZmFjZXMvZmFjZXMvdHdpdHRlci90aGlhZ292ZXJuZXR0aS8xMjguanBnIiwiaXNfYWRtaW iOmZhbHNlLCJhY2NvdW50X2JhbGFuY2UiOjUwLCJhbGxfcGljdHVyZXMiOltdfSwiaWF0IjoxNTY4MjE2OTc3fQ.Ld 9xT1Q2JqbrnPBe395kFrny3vgg9BKxRQ-OTa6f6U" pixiapp | owaspbrokenwebapps pixiapp | my user {"user":{"_id": 33,"email":"hacker@getme.in","password":"hellopixi","name":"involvedplus","pic":"https:// s3.amazonaws.com/uifaces/faces/twitter/thiagovernetti/ 128.jpg","is_admin":false,"account_balance":50,"all_pictures":[]},"iat":1568216977} pixiapp | user id 33