SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Hacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdfHacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdfMatt Tesauro
 
Secure code practices
Secure code practicesSecure code practices
Secure code practicesHina Rawal
 
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
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing Priyanka Aash
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityMohammed Fazuluddin
 
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
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOWASP Delhi
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingAnurag Srivastava
 
Web application security & Testing
Web application security  & TestingWeb application security  & Testing
Web application security & TestingDeepu S Nath
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practicesScott Hurrey
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Codingbilcorry
 
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
 
Welcome to the Jungle: Pentesting AWS
Welcome to the Jungle: Pentesting AWSWelcome to the Jungle: Pentesting AWS
Welcome to the Jungle: Pentesting AWSMike Felch
 

Was ist angesagt? (20)

Hacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdfHacking and Defending APIs - Red and Blue make Purple.pdf
Hacking and Defending APIs - Red and Blue make Purple.pdf
 
Secure code practices
Secure code practicesSecure code practices
Secure code practices
 
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)
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
Deep-Dive: Secure API Management
Deep-Dive: Secure API ManagementDeep-Dive: Secure API Management
Deep-Dive: Secure API Management
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API Security
 
OWASP Top Ten
OWASP Top TenOWASP Top Ten
OWASP Top Ten
 
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
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilities
 
Security in NodeJS applications
Security in NodeJS applicationsSecurity in NodeJS applications
Security in NodeJS applications
 
API Security Lifecycle
API Security LifecycleAPI Security Lifecycle
API Security Lifecycle
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration Testing
 
Web application security & Testing
Web application security  & TestingWeb application security  & Testing
Web application security & Testing
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Coding
 
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
 
Welcome to the Jungle: Pentesting AWS
Welcome to the Jungle: Pentesting AWSWelcome to the Jungle: Pentesting AWS
Welcome to the Jungle: Pentesting AWS
 
Broken access controls
Broken access controlsBroken access controls
Broken access controls
 

Ähnlich wie 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
 
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
 
Checkmarx meetup API Security - API Security top 10 - Erez Yalon
Checkmarx meetup API Security -  API Security top 10 - Erez YalonCheckmarx meetup API Security -  API Security top 10 - Erez Yalon
Checkmarx meetup API Security - API Security top 10 - Erez YalonAdar Weidman
 

Ähnlich wie 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
 
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
 
Checkmarx meetup API Security - API Security top 10 - Erez Yalon
Checkmarx meetup API Security -  API Security top 10 - Erez YalonCheckmarx meetup API Security -  API Security top 10 - Erez Yalon
Checkmarx meetup API Security - API Security top 10 - Erez Yalon
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 

Kürzlich hochgeladen (20)

VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 

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