SlideShare a Scribd company logo
Ole Lensmar, @olensmar 
API SECURITY TESTING
What do these companies have in common?
Their APIs have been hacked!
If you wanted to hack an APIโ€ฆ 
HOW WOULD YOU DO IT?
Hacking an API โ€“the basics 
๏ต REST and SOAP APIs predominantly use 
HTTP as their protocol 
๏ต Arguments are sent as part of the URL, as 
HTTP Headers or in the request body 
๏ต Message payload is predominantly JSON for 
REST and XML for SOAP
Understanding HTTP Transactions 
Request 
Response
Security Standards for Web APIs 
๏ต SSL commonly used for transport-level encryption 
๏ต Message level encryption and signatures: 
โ€“ SOAP/XML: WS-Security and related standards 
โ€“ REST: JSON Web Algorithms 
๏ต Authentication 
โ€“ SOAP: WS-Security/SAML 
โ€“ REST: Oauth 1 + 2, OpenID Connect, SAML, 
custom
So, weโ€™re hackersโ€ฆ 
WHERE DO WE START?
API Attack Surface Detection 
๏ต We want to know as much as possible about 
an APIs endpoints, messages, parameters, 
behavior 
๏ต The more we know โ€“ the better we can target 
our attack! 
๏ต Unfortunately though โ€“ an API has no โ€œUIโ€ that 
can show is the attack surface
Attack Surface Detection: API Metadata 
The more we know, the easier it isโ€ฆ 
๏ต api-docs.json 
๏ต WSDL/XML Schema 
๏ต Swagger, RAML, API-Blueprint, ioDocs, etc 
๏ต Hypermedia (JSON-LD, Siren, etc) 
๏ต Documentation / Developer Portals 
Choosing between usability vs hackability
Attack Surface Detection: API Metadata 
the point of attack 
HTTP Method: Are other methods handled correctly? 
Oauth 2.0: are tokens enforced and validated correctly? 
Is access validated? Are ids sequential? Injection point?,etc 
What if we send multiple? Or none at all?
Attack Surface Detection: Other Methods 
๏ต Discovery 
โ€“ Record traffic via proxy or network sniffer to record 
and โ€œlearnโ€ an API 
๏ต Brute force 
โ€“ Try commonly used endpoints (/api, /api/v1, etc) 
โ€“ Use error messages to uncover possible paths
With an Attack Surface, we canโ€ฆ 
๏ต Fuzzing 
๏ต Injection attacks 
๏ต Invalid / Out-of bounds content 
๏ต Malicious content 
๏ต Cross Site Scripting 
๏ต Cross-site Request Forgery
Why Hack an API? 
๏ต Provoke error messages or responses that give 
us system details 
โ€“ Database names 
โ€“ File paths 
โ€“ Component versions 
โ€“ Etcโ€ฆ 
๏ต Find security holes that give us access to 
system resources 
๏ต Put the API in an unavailable or unstable state 
(DOS)
API Attack Methods 
HOW DO WE TEST FOR THEM?
API Fuzzing 
What is it? 
๏ต Send random content as 
input parameters 
๏ต Automation can help us 
send millions of 
permutations 
๏ต Recursive Fuzzing โ€“ try 
all possible values 
๏ต Replacive Fuzzing โ€“ try 
common attack vectors 
How do we test for it? 
๏ต Create automated fuzz 
tests that validate 
response messages to: 
โ€“ Not conceal system 
information 
โ€“ Return correct error messages 
/ status codes 
๏ต Run them for a long time 
๏ต Run them in parallel / as 
load tests
Injection Attacks 
What is it? 
๏ต Using SQL, XML, Xpath, 
JSON, JavaScript etc, 
attempt to inject code that is 
executed where it 
shouldnโ€™t be 
๏ต Primary injection: code is 
executed on the server 
๏ต Secondary injection: code is 
executed by 3rd party 
๏ต Example: 
"SELECT * FROM pets WHERE petID='" + petId +"'"; 
http://petstore.com/api/v1/pet/123 
-> SELECT * FROM pets WHERE petID = โ€˜123โ€™ 
http://petstore.com/api/v1/pet/' or '1'='1 
SELECT * FROM pets WHERE petID = โ€˜โ€™ or โ€˜1โ€™ = โ€˜1โ€™ 
How do we test for it? 
๏ต Understand how the API 
works: 
SQL? NoSQL? Other APIs? 
๏ต Use well known injection 
vectors โ€“ validate for 
โ€œunexpectedโ€ responses 
๏ต For example: validate that 
login call does not log you 
in 
๏ต Automate security tests
Invalid / Out-of-bounds attacks 
What is it? 
๏ต Send input that we know 
is invalid 
โ€“ Out of range numbers 
โ€“ Invalid dates 
โ€“ Invalid enumeration values 
โ€“ Invalid data-types / formatting 
๏ต Can be auto-generated if 
the API has โ€œgoodโ€ 
metadata 
How do we test for it? 
๏ต Send input that you know 
is invalid 
โ€“ Out of range numbers 
โ€“ Invalid dates 
โ€“ Random enumerations 
โ€“ Etc. 
๏ต Validate for: 
โ€“ Not displaying system 
information 
โ€“ Returning correct error 
messages / status codes
Malicious Content 
What is it? 
๏ต Where files/images are 
uploaded/โ€attachedโ€; attempt to 
upload executable files/scripts/etc 
๏ต Exploit server side parsing of 
content 
๏ต Example of XML Bomb: 
How do we test for it? 
๏ต Attempt to upload files that do no 
harm but indicate that they have 
incorrectly handled 
๏ต Both corrupt versions of accepted 
formats, and invalid formats. 
๏ต Validate that you get the right error 
messages! 
๏ต Test for parse vulnerabilities โ€“ use 
known Vectors 
Be careful with this oneโ€ฆ
Cross-Site Scripting 
What is it? 
๏ต Reflective XSS: Malicious script 
is included in link and โ€œreflectedโ€ 
back to user 
๏ต Persistent XSS: Malicious script 
is injected into backend system 
and retrieved by user 
How do we test for it? 
๏ต In either case โ€“ create functional 
API tests that upload common 
attack vectors 
๏ต For Reflective XSS tests: 
validate that they are escaped 
(or removed) in the response 
๏ต For Persistent XSS tests: 
create end-to-end test that 
simulates the โ€œother clientโ€ and 
validates correspondingly
Cross-Site Request Forgery (CSRF) 
What is it? How do we test for it? 
๏ต The common workaround is 
to include an unpredictable 
token with each request 
๏ต Create functional tests that 
validate: 
โ€“ The API call fails without that 
token 
โ€“ Tokens can not be re-used 
๏ต Run a fuzzing test on the 
token itself to validate that it 
canโ€™t be spoofed or 
bypassed 
Point of 
attack!
Insufficient SSL configurations 
What is it? 
๏ต Eavesdropping on API 
traffic 
๏ต APIs should always use 
SSL โ€“ but sometimes they 
donโ€™t, 
or it isnโ€™t enforced (HTTP 
works also) 
๏ต Is the SSL certificate self-signed? 
(browsers will warn 
you โ€“ but code in a native 
mobile apps might silently 
allow access) 
How do we test for it? 
๏ต Create simple tests that fail 
if HTTPS is not enforced 
๏ต Create simple tests that fail 
if certificates are self signed 
๏ต Run these in production as 
monitors โ€“ small system 
configuration 
changes/tweaks could have 
side effects
Insecure Direct Object References 
What is it? 
๏ต For parameters that are 
IDs and seem to be 
sequential, try submitting 
IDs to get access. 
๏ต In Query Parameters, 
Headers and Message 
Bodies 
๏ต Call methods/operations 
that you shouldnโ€™t have 
access to 
How do we test for it? 
๏ต Inspect actual API 
requests / metadata 
You should question usage of direct object 
references! 
๏ต Create functional tests 
that validate authorization 
enforcement 
๏ต Combine with fuzzing or 
boundary tests on IDs
Other things to think aboutโ€ฆ 
Bad Session/Authentication Handling 
๏ต Are session tokens re-used 
or sequential? 
๏ต Do session tokens 
timeout correctly? 
๏ต Are tokens exposed in 
unencrypted traffic? 
๏ต Are tokens added to URL 
when sending links? 
๏ต Are login endpoints 
restricted? 
Bad security configuration 
๏ต Based on error messages 
and system information 
exposed by previous 
attacks 
๏ต Target all layers 
โ€“ Network 
โ€“ Server 
โ€“ Application 
โ€“ Client 
๏ต Examples: 
โ€“ exposed management consoles 
โ€“ directory listings 
โ€“ stack-traces 
โ€“ default passwords
So where does this leave us? 
GENERAL CONCEPTS TO 
REMEMBER
API Security Testing requires you to 
๏ต Understand API Technologies 
๏ต Understand the API and its implementation 
๏ต Understand how Security Vulnerabilities work
Putting it into practice 
๏ต Automate Basic Security Tests using free tools 
๏ต Run automated Security Tests simultaneously 
as Load and Functional tests 
๏ต Stay up to date on Vulnerabilities
Resources 
OWASP: 
http://owasp.org 
WS-Attacks: 
http://ws-attacks.org/ 
Zed Attack Proxy (ZAP): 
https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project 
Ready! API Secure: 
http://smartbear.com/product/ready-api/secure/overview/
@olensmar 
ole.lensmar@smartbear.com

More Related Content

What's hot (20)

PPTX
Pentesting ReST API
Nutan Kumar Panda
ย 
PDF
Pentesting Rest API's by :- Gaurang Bhatnagar
OWASP Delhi
ย 
PPTX
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar
ย 
PDF
APISecurity_OWASP_MitigationGuide
Isabelle Mauny
ย 
PDF
Hacking Adobe Experience Manager sites
Mikhail Egorov
ย 
PDF
API Testing
Bikash Sharma
ย 
PDF
API Security Best Practices & Guidelines
Prabath Siriwardena
ย 
PDF
CSRF, ClickJacking & Open Redirect
Blueinfy Solutions
ย 
PPTX
Api Testing
Vishwanath KC
ย 
PDF
Web Application Security and Awareness
Abdul Rahman Sherzad
ย 
PDF
OWASP Top 10 A4 โ€“ Insecure Direct Object Reference
Narudom Roongsiriwong, CISSP
ย 
PDF
OWASP Top 10 Web Application Vulnerabilities
Software Guru
ย 
PDF
SSRF workshop
Ivan Novikov
ย 
PDF
OWASP API Security Top 10 Examples
42Crunch
ย 
PDF
OWASP API Security Top 10 - API World
42Crunch
ย 
PPTX
Bug Bounty 101
Shahee Mirza
ย 
PPTX
OWASP Top 10 2021 Presentation (Jul 2022)
TzahiArabov
ย 
PDF
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
ย 
PPTX
Security Testing Training With Examples
Alwin Thayyil
ย 
PDF
Broken access controls
Akansha Kesharwani
ย 
Pentesting ReST API
Nutan Kumar Panda
ย 
Pentesting Rest API's by :- Gaurang Bhatnagar
OWASP Delhi
ย 
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar
ย 
APISecurity_OWASP_MitigationGuide
Isabelle Mauny
ย 
Hacking Adobe Experience Manager sites
Mikhail Egorov
ย 
API Testing
Bikash Sharma
ย 
API Security Best Practices & Guidelines
Prabath Siriwardena
ย 
CSRF, ClickJacking & Open Redirect
Blueinfy Solutions
ย 
Api Testing
Vishwanath KC
ย 
Web Application Security and Awareness
Abdul Rahman Sherzad
ย 
OWASP Top 10 A4 โ€“ Insecure Direct Object Reference
Narudom Roongsiriwong, CISSP
ย 
OWASP Top 10 Web Application Vulnerabilities
Software Guru
ย 
SSRF workshop
Ivan Novikov
ย 
OWASP API Security Top 10 Examples
42Crunch
ย 
OWASP API Security Top 10 - API World
42Crunch
ย 
Bug Bounty 101
Shahee Mirza
ย 
OWASP Top 10 2021 Presentation (Jul 2022)
TzahiArabov
ย 
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
ย 
Security Testing Training With Examples
Alwin Thayyil
ย 
Broken access controls
Akansha Kesharwani
ย 

Viewers also liked (15)

PPTX
An introduction to api testing | David Tzemach
David Tzemach
ย 
PPTX
REST API testing with SpecFlow
Aiste Stikliute
ย 
PPTX
Testing Agile Web Services from soapUI
PLM Mechanic .
ย 
PPTX
Testing soapui
Shahid Shaik
ย 
PDF
Automate REST API Testing
TechWell
ย 
PPT
Presentation for soap ui
Anjali Rao
ย 
PPT
Soa testing soap ui (2)
Knoldus Inc.
ย 
PPT
SOAP-UI The Web service Testing
Ganesh Mandala
ย 
PPTX
Api testing
Keshav Kashyap
ย 
PDF
4 Major Advantages of API Testing
QASource
ย 
PPT
Ppt of soap ui
pkslide28
ย 
PPTX
Testing web services
Taras Lytvyn
ย 
PPTX
Learn SoapUI
David Ionut
ย 
PDF
Web Services Automated Testing via SoapUI Tool
Sperasoft
ย 
An introduction to api testing | David Tzemach
David Tzemach
ย 
REST API testing with SpecFlow
Aiste Stikliute
ย 
Testing Agile Web Services from soapUI
PLM Mechanic .
ย 
Testing soapui
Shahid Shaik
ย 
Automate REST API Testing
TechWell
ย 
Presentation for soap ui
Anjali Rao
ย 
Soa testing soap ui (2)
Knoldus Inc.
ย 
SOAP-UI The Web service Testing
Ganesh Mandala
ย 
Api testing
Keshav Kashyap
ย 
4 Major Advantages of API Testing
QASource
ย 
Ppt of soap ui
pkslide28
ย 
Testing web services
Taras Lytvyn
ย 
Learn SoapUI
David Ionut
ย 
Web Services Automated Testing via SoapUI Tool
Sperasoft
ย 
Ad

Similar to Getting Started with API Security Testing (20)

PDF
Black and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Matt Tesauro
ย 
PDF
apidays Hong Kong - Attack API Architecture, Alvin Tam, Hong Kong Computer So...
apidays
ย 
PDF
APIsecure 2023 - API First Hacking, Corey Ball, Author of Hacking APIs
apidays
ย 
PPTX
Web API Security
Stefaan
ย 
PDF
APIsecure 2023 - Time to Take the "F*^!" out of ShiFt Left, Christine Bevilac...
apidays
ย 
PDF
The API Primer (OWASP AppSec Europe, May 2015)
Greg Patton
ย 
PDF
Understanding and Mitigating Common Security Risks in API Testing.pdf
AmeliaJonas2
ย 
PDF
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
apidays
ย 
PDF
API testing methdology - OWASP Pune (1).pdf
zerocoool10
ย 
PDF
Outpost24 webinar Why API security matters and how to get it right.pdf
Outpost24
ย 
PDF
Landmines in the API Landscape
Matt Tesauro
ย 
PDF
API SECURITY
Tubagus Rizky Dharmawan
ย 
PPTX
Prevent Malicious Hacking Attacks on your APIs
SmartBear
ย 
PPTX
vogler good section Presentation.pptx
voglerazariah1
ย 
PPTX
Outpost24 webinar - Api security
Outpost24
ย 
PDF
Apidays Helsinki 2024 - Security Vulnerabilities in your APIs by Lukรกลก ฤŽurovs...
apidays
ย 
PDF
What Is API Security? Threats, Tools, and Best Practices in 2025 | USCSIยฎ
United States Cybersecurity Institute (USCSIยฎ)
ย 
PDF
Better API Security with Automation
42Crunch
ย 
PDF
Better API Security With A SecDevOps Approach
Nordic APIs
ย 
PPTX
How to get along with HATEOAS without letting the bad guys steal your lunch?
Graham Charters
ย 
Black and Blue APIs: Attacker's and Defender's View of API Vulnerabilities
Matt Tesauro
ย 
apidays Hong Kong - Attack API Architecture, Alvin Tam, Hong Kong Computer So...
apidays
ย 
APIsecure 2023 - API First Hacking, Corey Ball, Author of Hacking APIs
apidays
ย 
Web API Security
Stefaan
ย 
APIsecure 2023 - Time to Take the "F*^!" out of ShiFt Left, Christine Bevilac...
apidays
ย 
The API Primer (OWASP AppSec Europe, May 2015)
Greg Patton
ย 
Understanding and Mitigating Common Security Risks in API Testing.pdf
AmeliaJonas2
ย 
APIsecure 2023 - API Security - doing more with less, Nir Paz (Standard.ai)
apidays
ย 
API testing methdology - OWASP Pune (1).pdf
zerocoool10
ย 
Outpost24 webinar Why API security matters and how to get it right.pdf
Outpost24
ย 
Landmines in the API Landscape
Matt Tesauro
ย 
API SECURITY
Tubagus Rizky Dharmawan
ย 
Prevent Malicious Hacking Attacks on your APIs
SmartBear
ย 
vogler good section Presentation.pptx
voglerazariah1
ย 
Outpost24 webinar - Api security
Outpost24
ย 
Apidays Helsinki 2024 - Security Vulnerabilities in your APIs by Lukรกลก ฤŽurovs...
apidays
ย 
What Is API Security? Threats, Tools, and Best Practices in 2025 | USCSIยฎ
United States Cybersecurity Institute (USCSIยฎ)
ย 
Better API Security with Automation
42Crunch
ย 
Better API Security With A SecDevOps Approach
Nordic APIs
ย 
How to get along with HATEOAS without letting the bad guys steal your lunch?
Graham Charters
ย 
Ad

More from SmartBear (20)

PPTX
Enforcing Your Organization's API Design Standards with SwaggerHub
SmartBear
ย 
PPTX
Introducing OpenAPI Version 3.1
SmartBear
ย 
PPTX
IATA Open Air: How API Standardization Enables Innovation in the Airline Indu...
SmartBear
ย 
PPTX
The State of API 2020 Webinar โ€“ Exploring Trends, Tools & Takeaways to Drive ...
SmartBear
ย 
PPTX
How LISI Automotive Accelerated Application Delivery with SwaggerHub
SmartBear
ย 
PPTX
Standardising APIs: Powering the Platform Economy in Financial Services
SmartBear
ย 
PPTX
Getting Started with API Standardization in SwaggerHub
SmartBear
ย 
PPTX
Adopting a Design-First Approach to API Development with SwaggerHub
SmartBear
ย 
PPTX
Standardizing APIs Across Your Organization with Swagger and OAS | A SmartBea...
SmartBear
ย 
PPTX
Effective API Lifecycle Management
SmartBear
ย 
PDF
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
SmartBear
ย 
PDF
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
SmartBear
ย 
PPTX
Artificial intelligence for faster and smarter software testing - Galway Mee...
SmartBear
ย 
PDF
Successfully Implementing BDD in an Agile World
SmartBear
ย 
PPTX
The Best Kept Secrets of Code Review | SmartBear Webinar
SmartBear
ย 
PPTX
How Capital One Scaled API Design to Deliver New Products Faster
SmartBear
ย 
PPTX
Testing Without a GUI Using TestComplete
SmartBear
ย 
PPTX
Hidden Treasure - TestComplete Script Extensions
SmartBear
ย 
PDF
How Bdd Can Save Agile
SmartBear
ย 
PPTX
API Automation and TDD to Implement Master Data Survivorship Rules
SmartBear
ย 
Enforcing Your Organization's API Design Standards with SwaggerHub
SmartBear
ย 
Introducing OpenAPI Version 3.1
SmartBear
ย 
IATA Open Air: How API Standardization Enables Innovation in the Airline Indu...
SmartBear
ย 
The State of API 2020 Webinar โ€“ Exploring Trends, Tools & Takeaways to Drive ...
SmartBear
ย 
How LISI Automotive Accelerated Application Delivery with SwaggerHub
SmartBear
ย 
Standardising APIs: Powering the Platform Economy in Financial Services
SmartBear
ย 
Getting Started with API Standardization in SwaggerHub
SmartBear
ย 
Adopting a Design-First Approach to API Development with SwaggerHub
SmartBear
ย 
Standardizing APIs Across Your Organization with Swagger and OAS | A SmartBea...
SmartBear
ย 
Effective API Lifecycle Management
SmartBear
ย 
The API Lifecycle Series: Exploring Design-First and Code-First Approaches to...
SmartBear
ย 
The API Lifecycle Series: Evolving API Development and Testing from Open Sour...
SmartBear
ย 
Artificial intelligence for faster and smarter software testing - Galway Mee...
SmartBear
ย 
Successfully Implementing BDD in an Agile World
SmartBear
ย 
The Best Kept Secrets of Code Review | SmartBear Webinar
SmartBear
ย 
How Capital One Scaled API Design to Deliver New Products Faster
SmartBear
ย 
Testing Without a GUI Using TestComplete
SmartBear
ย 
Hidden Treasure - TestComplete Script Extensions
SmartBear
ย 
How Bdd Can Save Agile
SmartBear
ย 
API Automation and TDD to Implement Master Data Survivorship Rules
SmartBear
ย 

Recently uploaded (20)

PPTX
computer forensics encase emager app exp6 1.pptx
ssuser343e92
ย 
PDF
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
ย 
PPTX
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
ย 
PPTX
B2C EXTRANET | EXTRANET WEBSITE | EXTRANET INTEGRATION
philipnathen82
ย 
PDF
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
PPTX
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
PPTX
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
ย 
PPTX
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
PPTX
Seamless-Image-Conversion-From-Raster-to-wrt-rtx-rtx.pptx
Quick Conversion Services
ย 
PDF
IDM Crack with Internet Download Manager 6.42 Build 41
utfefguu
ย 
PDF
Laboratory Workflows Digitalized and live in 90 days with Scifeonยดs SAPPA P...
info969686
ย 
PPTX
declaration of Variables and constants.pptx
meemee7378
ย 
PDF
What Is an Internal Quality Audit and Why It Matters for Your QMS
BizPortals365
ย 
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
ย 
PDF
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
ย 
PPTX
Wondershare Filmora Crack 14.5.18 + Key Full Download [Latest 2025]
HyperPc soft
ย 
PDF
Difference Between Kubernetes and Docker .pdf
Kindlebit Solutions
ย 
PPTX
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
PPTX
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
PDF
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 
computer forensics encase emager app exp6 1.pptx
ssuser343e92
ย 
WholeClear Split vCard Software for Split large vCard file
markwillsonmw004
ย 
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
ย 
B2C EXTRANET | EXTRANET WEBSITE | EXTRANET INTEGRATION
philipnathen82
ย 
AI Software Development Process, Strategies and Challenges
Net-Craft.com
ย 
IObit Driver Booster Pro 12.4-12.5 license keys 2025-2026
chaudhryakashoo065
ย 
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
ย 
Avast Premium Security crack 25.5.6162 + License Key 2025
HyperPc soft
ย 
Seamless-Image-Conversion-From-Raster-to-wrt-rtx-rtx.pptx
Quick Conversion Services
ย 
IDM Crack with Internet Download Manager 6.42 Build 41
utfefguu
ย 
Laboratory Workflows Digitalized and live in 90 days with Scifeonยดs SAPPA P...
info969686
ย 
declaration of Variables and constants.pptx
meemee7378
ย 
What Is an Internal Quality Audit and Why It Matters for Your QMS
BizPortals365
ย 
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
ย 
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
ย 
Wondershare Filmora Crack 14.5.18 + Key Full Download [Latest 2025]
HyperPc soft
ย 
Difference Between Kubernetes and Docker .pdf
Kindlebit Solutions
ย 
IObit Driver Booster Pro Crack Download Latest Version
chaudhryakashoo065
ย 
IDM Crack with Internet Download Manager 6.42 [Latest 2025]
HyperPc soft
ย 
AWS Consulting Services: Empowering Digital Transformation with Nlineaxis
Nlineaxis IT Solutions Pvt Ltd
ย 

Getting Started with API Security Testing

  • 1. Ole Lensmar, @olensmar API SECURITY TESTING
  • 2. What do these companies have in common?
  • 3. Their APIs have been hacked!
  • 4. If you wanted to hack an APIโ€ฆ HOW WOULD YOU DO IT?
  • 5. Hacking an API โ€“the basics ๏ต REST and SOAP APIs predominantly use HTTP as their protocol ๏ต Arguments are sent as part of the URL, as HTTP Headers or in the request body ๏ต Message payload is predominantly JSON for REST and XML for SOAP
  • 7. Security Standards for Web APIs ๏ต SSL commonly used for transport-level encryption ๏ต Message level encryption and signatures: โ€“ SOAP/XML: WS-Security and related standards โ€“ REST: JSON Web Algorithms ๏ต Authentication โ€“ SOAP: WS-Security/SAML โ€“ REST: Oauth 1 + 2, OpenID Connect, SAML, custom
  • 8. So, weโ€™re hackersโ€ฆ WHERE DO WE START?
  • 9. API Attack Surface Detection ๏ต We want to know as much as possible about an APIs endpoints, messages, parameters, behavior ๏ต The more we know โ€“ the better we can target our attack! ๏ต Unfortunately though โ€“ an API has no โ€œUIโ€ that can show is the attack surface
  • 10. Attack Surface Detection: API Metadata The more we know, the easier it isโ€ฆ ๏ต api-docs.json ๏ต WSDL/XML Schema ๏ต Swagger, RAML, API-Blueprint, ioDocs, etc ๏ต Hypermedia (JSON-LD, Siren, etc) ๏ต Documentation / Developer Portals Choosing between usability vs hackability
  • 11. Attack Surface Detection: API Metadata the point of attack HTTP Method: Are other methods handled correctly? Oauth 2.0: are tokens enforced and validated correctly? Is access validated? Are ids sequential? Injection point?,etc What if we send multiple? Or none at all?
  • 12. Attack Surface Detection: Other Methods ๏ต Discovery โ€“ Record traffic via proxy or network sniffer to record and โ€œlearnโ€ an API ๏ต Brute force โ€“ Try commonly used endpoints (/api, /api/v1, etc) โ€“ Use error messages to uncover possible paths
  • 13. With an Attack Surface, we canโ€ฆ ๏ต Fuzzing ๏ต Injection attacks ๏ต Invalid / Out-of bounds content ๏ต Malicious content ๏ต Cross Site Scripting ๏ต Cross-site Request Forgery
  • 14. Why Hack an API? ๏ต Provoke error messages or responses that give us system details โ€“ Database names โ€“ File paths โ€“ Component versions โ€“ Etcโ€ฆ ๏ต Find security holes that give us access to system resources ๏ต Put the API in an unavailable or unstable state (DOS)
  • 15. API Attack Methods HOW DO WE TEST FOR THEM?
  • 16. API Fuzzing What is it? ๏ต Send random content as input parameters ๏ต Automation can help us send millions of permutations ๏ต Recursive Fuzzing โ€“ try all possible values ๏ต Replacive Fuzzing โ€“ try common attack vectors How do we test for it? ๏ต Create automated fuzz tests that validate response messages to: โ€“ Not conceal system information โ€“ Return correct error messages / status codes ๏ต Run them for a long time ๏ต Run them in parallel / as load tests
  • 17. Injection Attacks What is it? ๏ต Using SQL, XML, Xpath, JSON, JavaScript etc, attempt to inject code that is executed where it shouldnโ€™t be ๏ต Primary injection: code is executed on the server ๏ต Secondary injection: code is executed by 3rd party ๏ต Example: "SELECT * FROM pets WHERE petID='" + petId +"'"; http://petstore.com/api/v1/pet/123 -> SELECT * FROM pets WHERE petID = โ€˜123โ€™ http://petstore.com/api/v1/pet/' or '1'='1 SELECT * FROM pets WHERE petID = โ€˜โ€™ or โ€˜1โ€™ = โ€˜1โ€™ How do we test for it? ๏ต Understand how the API works: SQL? NoSQL? Other APIs? ๏ต Use well known injection vectors โ€“ validate for โ€œunexpectedโ€ responses ๏ต For example: validate that login call does not log you in ๏ต Automate security tests
  • 18. Invalid / Out-of-bounds attacks What is it? ๏ต Send input that we know is invalid โ€“ Out of range numbers โ€“ Invalid dates โ€“ Invalid enumeration values โ€“ Invalid data-types / formatting ๏ต Can be auto-generated if the API has โ€œgoodโ€ metadata How do we test for it? ๏ต Send input that you know is invalid โ€“ Out of range numbers โ€“ Invalid dates โ€“ Random enumerations โ€“ Etc. ๏ต Validate for: โ€“ Not displaying system information โ€“ Returning correct error messages / status codes
  • 19. Malicious Content What is it? ๏ต Where files/images are uploaded/โ€attachedโ€; attempt to upload executable files/scripts/etc ๏ต Exploit server side parsing of content ๏ต Example of XML Bomb: How do we test for it? ๏ต Attempt to upload files that do no harm but indicate that they have incorrectly handled ๏ต Both corrupt versions of accepted formats, and invalid formats. ๏ต Validate that you get the right error messages! ๏ต Test for parse vulnerabilities โ€“ use known Vectors Be careful with this oneโ€ฆ
  • 20. Cross-Site Scripting What is it? ๏ต Reflective XSS: Malicious script is included in link and โ€œreflectedโ€ back to user ๏ต Persistent XSS: Malicious script is injected into backend system and retrieved by user How do we test for it? ๏ต In either case โ€“ create functional API tests that upload common attack vectors ๏ต For Reflective XSS tests: validate that they are escaped (or removed) in the response ๏ต For Persistent XSS tests: create end-to-end test that simulates the โ€œother clientโ€ and validates correspondingly
  • 21. Cross-Site Request Forgery (CSRF) What is it? How do we test for it? ๏ต The common workaround is to include an unpredictable token with each request ๏ต Create functional tests that validate: โ€“ The API call fails without that token โ€“ Tokens can not be re-used ๏ต Run a fuzzing test on the token itself to validate that it canโ€™t be spoofed or bypassed Point of attack!
  • 22. Insufficient SSL configurations What is it? ๏ต Eavesdropping on API traffic ๏ต APIs should always use SSL โ€“ but sometimes they donโ€™t, or it isnโ€™t enforced (HTTP works also) ๏ต Is the SSL certificate self-signed? (browsers will warn you โ€“ but code in a native mobile apps might silently allow access) How do we test for it? ๏ต Create simple tests that fail if HTTPS is not enforced ๏ต Create simple tests that fail if certificates are self signed ๏ต Run these in production as monitors โ€“ small system configuration changes/tweaks could have side effects
  • 23. Insecure Direct Object References What is it? ๏ต For parameters that are IDs and seem to be sequential, try submitting IDs to get access. ๏ต In Query Parameters, Headers and Message Bodies ๏ต Call methods/operations that you shouldnโ€™t have access to How do we test for it? ๏ต Inspect actual API requests / metadata You should question usage of direct object references! ๏ต Create functional tests that validate authorization enforcement ๏ต Combine with fuzzing or boundary tests on IDs
  • 24. Other things to think aboutโ€ฆ Bad Session/Authentication Handling ๏ต Are session tokens re-used or sequential? ๏ต Do session tokens timeout correctly? ๏ต Are tokens exposed in unencrypted traffic? ๏ต Are tokens added to URL when sending links? ๏ต Are login endpoints restricted? Bad security configuration ๏ต Based on error messages and system information exposed by previous attacks ๏ต Target all layers โ€“ Network โ€“ Server โ€“ Application โ€“ Client ๏ต Examples: โ€“ exposed management consoles โ€“ directory listings โ€“ stack-traces โ€“ default passwords
  • 25. So where does this leave us? GENERAL CONCEPTS TO REMEMBER
  • 26. API Security Testing requires you to ๏ต Understand API Technologies ๏ต Understand the API and its implementation ๏ต Understand how Security Vulnerabilities work
  • 27. Putting it into practice ๏ต Automate Basic Security Tests using free tools ๏ต Run automated Security Tests simultaneously as Load and Functional tests ๏ต Stay up to date on Vulnerabilities
  • 28. Resources OWASP: http://owasp.org WS-Attacks: http://ws-attacks.org/ Zed Attack Proxy (ZAP): https://www.owasp.org/index.php/OWASP_Zed_Attack_Proxy_Project Ready! API Secure: http://smartbear.com/product/ready-api/secure/overview/