SlideShare una empresa de Scribd logo
1 de 63
Descargar para leer sin conexión
Seattle | September 16-17, 2019
Attacking and defending GraphQL
applications: a hands-on approach
DAVIDE CIOCCIA
STEFAN PETRUSHEVSKI
Seattle | September 16-17, 2019
$id
Davide Cioccia
@davide107
david3107
Stefan Petrushevski
@ztefan
theztefan
Seattle | September 16-17, 2019
Agenda
• GraphQL basics: Query, Mutation, Subscription
• Security Implications in GraphQL
• Lab1: Introspection
• Lab2: DoS
• Lab3: Mutations
• Lab4: IDOR and Authorization bypass
• Lab5: Injections
Seattle | September 16-17, 2019
GraphQL
https://graphql.org/
A query language for your API
GraphQL is a query language for APIs and a runtime for fulfilling those
queries with your existing data. GraphQL provides a complete and
understandable description of the data in your API, gives clients the power
to ask for exactly what they need and nothing more,
makes it easier to evolve APIs over time, and enables powerful
developer tools.
Seattle | September 16-17, 2019
GraphQL
Optimizing the data fetching problem by
switching from imperative to declarative
data fetching
Seattle | September 16-17, 2019
GraphQL vs REST API
Seattle | September 16-17, 2019
GraphQL vs REST API
Seattle | September 16-17, 2019
REST API GraphQL
vs
Seattle | September 16-17, 2019
Common use-case
Seattle | September 16-17, 2019
GraphQL basics
Seattle | September 16-17, 2019
Create a schema
Seattle | September 16-17, 2019
Define an operation
• Query
• Mutation
• Subscription
Seattle | September 16-17, 2019
GraphQL query
Seattle | September 16-17, 2019
GraphQL mutation
Seattle | September 16-17, 2019
GraphQL subscription
Seattle | September 16-17, 2019
LAB: GraphQL basics
Seattle | September 16-17, 2019
Repo
git clone https://github.com/david3107/graphql-security-labs
cd lab3-mutation
docker build . -t graphql/mutation && docker run -ti -p 5000:5000
graphql/mutation
Seattle | September 16-17, 2019
Security Implications in GraphQL
Seattle | September 16-17, 2019
What can go wrong
• Introspection
• DoS
• Injections
• Broken Authorization
• Insecure Direct Object Reference (IDOR)
Seattle | September 16-17, 2019
Introspection
Seattle | September 16-17, 2019
What’s introspection
• Allows us to ask a GraphQL schema for information about:
• Queries
• Mutations
• Subscriptions
• Types
• Directives
Seattle | September 16-17, 2019
What can we ask for
• Querying all available types in a schema
• __type
• __typename
• All available queries
• queryType
• deprecations
• List of enumerator values
• __type(name: "<ENUM TYPE>")
• All types associated with an Interface or Union
• __type(name: "<INTERFACE OR UNION TYPE>")
Seattle | September 16-17, 2019
Ask for available types and queries
Seattle | September 16-17, 2019
How can we abuse it?
• Information disclosure
• Sensitive information related to the objects
• Retrieve “hidden” queries to bypass controls
• Use it as a steppingstone for further attacks
Seattle | September 16-17, 2019
How do we prevent it?
• Disable introspection. D’oh!
• Npm module
• https://www.npmjs.com/package/graphql-disable-introspection
• One Python hack
class NoIntrospection(ValidationRule):
def enter_Field(self, node, key, parent, path, ancestors):
field_name = node.name.value
if field_name == "__schema" or field_name == "__type":
self.context.report_error(
GraphQLError(u"GraphQL introspection is not allowed", [node])
)
Seattle | September 16-17, 2019
LAB: Introspection
Seattle | September 16-17, 2019
Repo
git clone https://github.com/david3107/graphql-security-labs
cd lab1-info-introspection
docker build . -t graphql/intro && docker run -ti -p 5000:5000
graphql/intro
Seattle | September 16-17, 2019
Challenges: DefDev social network
Seattle | September 16-17, 2019
Architecture
+ +
Seattle | September 16-17, 2019
DoS: Nested queries
Seattle | September 16-17, 2019
Nested queries
• Let’s consider the following schema
Seattle | September 16-17, 2019
Nested queries
Seattle | September 16-17, 2019
Nested queries: complexity calculation
9999 messages x 1 thread
+
9999 messages x 1 thread
+
9999 messages x 1 thread
Seattle | September 16-17, 2019
Result
Seattle | September 16-17, 2019
How do we prevent it?
• Limit Maximum Query Depth
• Calculate Query Complexity
• Throttling Based on Server Time
• Audit your query before production
Seattle | September 16-17, 2019
Limit Maximum Query Depth
Seattle | September 16-17, 2019
Limit Maximum Query Depth
• Pros
• Because the AST (Abstract Syntax
Tree) is statically analyzed the
query is never executed
• Cons
• It’s very difficult to cover all the
possible query combinations
Seattle | September 16-17, 2019
Calculate Query Complexity
Allow only LOW query complexity. If we set query complexity to 4 this query would fail
Seattle | September 16-17, 2019
Calculate Query Complexity
• Pros
• Covers more scenarios
• Do not execute the query
• Cons
• Hard to maintain
• Difficult to calculate
• Mutations can be tricky :/
Seattle | September 16-17, 2019
Audit your query before production
• https://www.npmjs.com/package/graphql-validation-complexity
• https://github.com/4Catalyzer/graphql-validation-complexity
• https://github.com/slicknode/graphql-query-complexity
Seattle | September 16-17, 2019
LAB: DoS
Seattle | September 16-17, 2019
Repo
git clone https://github.com/david3107/graphql-security-labs
cd lab2-dos-resource-exhaustion
docker build . -t graphql/dos && docker run -ti -p 5000:5000
graphql/dos
Seattle | September 16-17, 2019
Goal
• Take down that social network
Seattle | September 16-17, 2019
Broken Authorization & Insecure
Direct Object Reference (IDOR)
Seattle | September 16-17, 2019
Quick recap on IDOR
Seattle | September 16-17, 2019
So IDOR is a GraphQL problem
….but wrong implementation of GraphQL filtering functions can lead to
IDOR vulnerabilities.
Seattle | September 16-17, 2019
What can go wrong?
• Mutations containing predictable IDs
• Perform action on behalf of other users
• Query to retrieve data about single elements
• Retrieve other users' data
Seattle | September 16-17, 2019
How do we discover IDOR? Step 1
• Use introspection to find all the available queries
Seattle | September 16-17, 2019
How do we discover IDOR? Step 2
• For each query detect the associated Type
• For each object print out the available Fields
Seattle | September 16-17, 2019
How do we discover IDOR? Step 3
• For each object detect predictable element (Int, Enum, etc)
Seattle | September 16-17, 2019
How do we discover IDOR? Step 4
• Try different values and see what happens :)
Seattle | September 16-17, 2019
LAB: IDOR
Seattle | September 16-17, 2019
Repo
git clone https://github.com/david3107/graphql-security-labs
cd lab4-IDOR
docker build . -t graphql/idor && docker run -ti -p 5000:5000
graphql/idor
Seattle | September 16-17, 2019
Goal
• Use IDOR vulnerabilities to retrieve other users' private info
• Authenticate as another user
Seattle | September 16-17, 2019
Injections
Seattle | September 16-17, 2019
Are Injections possible?
• Yes, injections vulnerabilities are present
• Yes, because of bad implementation (bad coding)
• All web vulnerabilities are potentially present in GraphQL
Seattle | September 16-17, 2019
How do we prevent Injections (and other)?
• Use secure coding principles and practices
Seattle | September 16-17, 2019
LAB: Injections
Seattle | September 16-17, 2019
Repo
git clone https://github.com/david3107/graphql-security-labs
cd lab5-injections
docker build . -t graphql/injection && docker run -ti –p
5000:5000 –p 1337:1337 graphql/injection
Seattle | September 16-17, 2019
Architecture
+ +
Seattle | September 16-17, 2019
Goal
• Use the knowledge from previous labs (hint: introspection)
• There are two different injection vulnerabilities in the lab. Exploit them to:
• Get a remote shell on the machine (use port 1337)
• Get the passwords of all administrator users
Seattle | September 16-17, 2019
Thank you!
Seattle | September 16-17, 2019
About defdev.eu
• Defensive development – hardening developers
• Hi-end secure development and S/SDLC trainings
• handsons/labs, DIY testing/hacking, exams, certification
• senior security testers and enterprise developers on stage
• from mobile to mainframe
• from C#, JS and Java to Go, Swift and Kotlin
• from practical cybersec to security in CI/CD

Más contenido relacionado

La actualidad más candente

Getting Started with API Security Testing
Getting Started with API Security TestingGetting Started with API Security Testing
Getting Started with API Security TestingSmartBear
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs RESTGreeceJS
 
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
 
REST API Pentester's perspective
REST API Pentester's perspectiveREST API Pentester's perspective
REST API Pentester's perspectiveSecuRing
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug BountiesOWASP Nagpur
 
Manual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A BugManual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A BugLewis Ardern
 
Learn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAPLearn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAPPaul Ionescu
 
Secure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryDaniel Miessler
 
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...Garage4hackers.com
 
Security Exploit of Business Logic Flaws, Business Logic Attacks
Security Exploit of Business Logic Flaws, Business Logic AttacksSecurity Exploit of Business Logic Flaws, Business Logic Attacks
Security Exploit of Business Logic Flaws, Business Logic AttacksMarco Morana
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applicationsNiyas Nazar
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsHTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsneexemil
 

La actualidad más candente (20)

Getting Started with API Security Testing
Getting Started with API Security TestingGetting Started with API Security Testing
Getting Started with API Security Testing
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs REST
 
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
 
REST API Pentester's perspective
REST API Pentester's perspectiveREST API Pentester's perspective
REST API Pentester's perspective
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 
Manual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A BugManual JavaScript Analysis Is A Bug
Manual JavaScript Analysis Is A Bug
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
XSS - Attacks & Defense
XSS - Attacks & DefenseXSS - Attacks & Defense
XSS - Attacks & Defense
 
Learn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAPLearn to pen-test with OWASP ZAP
Learn to pen-test with OWASP ZAP
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
Secure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injectionSecure Code Warrior - CRLF injection
Secure Code Warrior - CRLF injection
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request Forgery
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
Garage4Hackers Ranchoddas Webcast Series - Bypassing Modern WAF's Exemplified...
 
Security Exploit of Business Logic Flaws, Business Logic Attacks
Security Exploit of Business Logic Flaws, Business Logic AttacksSecurity Exploit of Business Logic Flaws, Business Logic Attacks
Security Exploit of Business Logic Flaws, Business Logic Attacks
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
 
HTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versionsHTTP Request Smuggling via higher HTTP versions
HTTP Request Smuggling via higher HTTP versions
 
Dive in burpsuite
Dive in burpsuiteDive in burpsuite
Dive in burpsuite
 
Pentesting ReST API
Pentesting ReST APIPentesting ReST API
Pentesting ReST API
 
Burp suite
Burp suiteBurp suite
Burp suite
 

Similar a Attacking and defending GraphQL applications: a hands-on approach

DevSecCon Seattle 2019: Containerizing IT Security Knowledge
DevSecCon Seattle 2019: Containerizing IT Security KnowledgeDevSecCon Seattle 2019: Containerizing IT Security Knowledge
DevSecCon Seattle 2019: Containerizing IT Security KnowledgeDevSecCon
 
Banfootguns devseccon 2019
Banfootguns devseccon 2019Banfootguns devseccon 2019
Banfootguns devseccon 2019Morgan Roman
 
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...Erkang Zheng
 
VSSML18. REST API and Bindings
VSSML18. REST API and BindingsVSSML18. REST API and Bindings
VSSML18. REST API and BindingsBigML, Inc
 
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Chetan Khatri
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open StandardsAPIsecure_ Official
 
CodeOne 2019: "Continuous Delivery with Docker and Java"
CodeOne 2019: "Continuous Delivery with Docker and Java"CodeOne 2019: "Continuous Delivery with Docker and Java"
CodeOne 2019: "Continuous Delivery with Docker and Java"Daniel Bryant
 
DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...
DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...
DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...DevSecCon
 
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data LakeITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data LakeITCamp
 
UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...
UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...
UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...Karen Cannell
 
Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...
Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...
Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...Vaticle
 
Sharing Blockchain Performance Knowledge for Edge Service Development
Sharing Blockchain Performance Knowledge for Edge Service DevelopmentSharing Blockchain Performance Knowledge for Edge Service Development
Sharing Blockchain Performance Knowledge for Edge Service DevelopmentHong-Linh Truong
 
InfoSphere Optim archive for archive/purge of application data
InfoSphere Optim archive for archive/purge of application dataInfoSphere Optim archive for archive/purge of application data
InfoSphere Optim archive for archive/purge of application dataBharath Nunepalli
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web ServicesTechWell
 
apidays LIVE Australia 2020 - From micro to macro-coordination through domain...
apidays LIVE Australia 2020 - From micro to macro-coordination through domain...apidays LIVE Australia 2020 - From micro to macro-coordination through domain...
apidays LIVE Australia 2020 - From micro to macro-coordination through domain...apidays
 
APIs and Restful APIs
APIs and Restful APIsAPIs and Restful APIs
APIs and Restful APIsijtsrd
 
You got database in my cloud!
You got database  in my cloud!You got database  in my cloud!
You got database in my cloud!Liz Frost
 

Similar a Attacking and defending GraphQL applications: a hands-on approach (20)

DevSecCon Seattle 2019: Containerizing IT Security Knowledge
DevSecCon Seattle 2019: Containerizing IT Security KnowledgeDevSecCon Seattle 2019: Containerizing IT Security Knowledge
DevSecCon Seattle 2019: Containerizing IT Security Knowledge
 
Banfootguns devseccon 2019
Banfootguns devseccon 2019Banfootguns devseccon 2019
Banfootguns devseccon 2019
 
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
 
VSSML18. REST API and Bindings
VSSML18. REST API and BindingsVSSML18. REST API and Bindings
VSSML18. REST API and Bindings
 
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
Demystify Information Security & Threats for Data-Driven Platforms With Cheta...
 
2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards2022 APIsecure_Securing APIs with Open Standards
2022 APIsecure_Securing APIs with Open Standards
 
CodeOne 2019: "Continuous Delivery with Docker and Java"
CodeOne 2019: "Continuous Delivery with Docker and Java"CodeOne 2019: "Continuous Delivery with Docker and Java"
CodeOne 2019: "Continuous Delivery with Docker and Java"
 
DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...
DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...
DevSecCon Seattle 2019: Decentralized Authorization - Implementing Fine Grain...
 
Decentralized Authorization
Decentralized AuthorizationDecentralized Authorization
Decentralized Authorization
 
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data LakeITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
 
UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...
UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...
UTOUG Training Days 2019 APEX Interactive Grids: API Essentials, the Stuff Yo...
 
Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...
Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...
Building a Cyber Threat Intelligence Knowledge Management System (Paris Augus...
 
Api Testing
Api TestingApi Testing
Api Testing
 
Api Testing
Api TestingApi Testing
Api Testing
 
Sharing Blockchain Performance Knowledge for Edge Service Development
Sharing Blockchain Performance Knowledge for Edge Service DevelopmentSharing Blockchain Performance Knowledge for Edge Service Development
Sharing Blockchain Performance Knowledge for Edge Service Development
 
InfoSphere Optim archive for archive/purge of application data
InfoSphere Optim archive for archive/purge of application dataInfoSphere Optim archive for archive/purge of application data
InfoSphere Optim archive for archive/purge of application data
 
Testing RESTful Web Services
Testing RESTful Web ServicesTesting RESTful Web Services
Testing RESTful Web Services
 
apidays LIVE Australia 2020 - From micro to macro-coordination through domain...
apidays LIVE Australia 2020 - From micro to macro-coordination through domain...apidays LIVE Australia 2020 - From micro to macro-coordination through domain...
apidays LIVE Australia 2020 - From micro to macro-coordination through domain...
 
APIs and Restful APIs
APIs and Restful APIsAPIs and Restful APIs
APIs and Restful APIs
 
You got database in my cloud!
You got database  in my cloud!You got database  in my cloud!
You got database in my cloud!
 

Más de Davide Cioccia

Avoiding GraphQL insecurities with OWASP SKF - OWASP HU meetup
Avoiding GraphQL insecurities with OWASP SKF - OWASP HU meetupAvoiding GraphQL insecurities with OWASP SKF - OWASP HU meetup
Avoiding GraphQL insecurities with OWASP SKF - OWASP HU meetupDavide Cioccia
 
DevSecCon Boston2018 - advanced mobile security automation with bdd
DevSecCon Boston2018 - advanced mobile security automation with bddDevSecCon Boston2018 - advanced mobile security automation with bdd
DevSecCon Boston2018 - advanced mobile security automation with bddDavide Cioccia
 
Black Hat Europe 2018 Arsenal Tools - Squatm3
Black Hat Europe 2018 Arsenal Tools - Squatm3Black Hat Europe 2018 Arsenal Tools - Squatm3
Black Hat Europe 2018 Arsenal Tools - Squatm3Davide Cioccia
 
BH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gator
BH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gatorBH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gator
BH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gatorDavide Cioccia
 
BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)
BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)
BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)Davide Cioccia
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin Davide Cioccia
 
Inside TorrentLocker (Cryptolocker) Malware C&C Server
Inside TorrentLocker (Cryptolocker) Malware C&C Server Inside TorrentLocker (Cryptolocker) Malware C&C Server
Inside TorrentLocker (Cryptolocker) Malware C&C Server Davide Cioccia
 
Windows Mobile 6.5: Client for a multimedia conferencing platform
Windows Mobile 6.5:  Client for a multimedia conferencing platform Windows Mobile 6.5:  Client for a multimedia conferencing platform
Windows Mobile 6.5: Client for a multimedia conferencing platform Davide Cioccia
 
A statistical framework to evaluate the "diversity" impact against Advanced P...
A statistical framework to evaluate the "diversity" impact against Advanced P...A statistical framework to evaluate the "diversity" impact against Advanced P...
A statistical framework to evaluate the "diversity" impact against Advanced P...Davide Cioccia
 

Más de Davide Cioccia (10)

Avoiding GraphQL insecurities with OWASP SKF - OWASP HU meetup
Avoiding GraphQL insecurities with OWASP SKF - OWASP HU meetupAvoiding GraphQL insecurities with OWASP SKF - OWASP HU meetup
Avoiding GraphQL insecurities with OWASP SKF - OWASP HU meetup
 
DevSecCon Boston2018 - advanced mobile security automation with bdd
DevSecCon Boston2018 - advanced mobile security automation with bddDevSecCon Boston2018 - advanced mobile security automation with bdd
DevSecCon Boston2018 - advanced mobile security automation with bdd
 
Black Hat Europe 2018 Arsenal Tools - Squatm3
Black Hat Europe 2018 Arsenal Tools - Squatm3Black Hat Europe 2018 Arsenal Tools - Squatm3
Black Hat Europe 2018 Arsenal Tools - Squatm3
 
BH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gator
BH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gatorBH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gator
BH ASIA 2019 Arsenal Tools - Squatm3 and Squatm3gator
 
BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)
BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)
BDD Mobile Security Testing (OWASP AppSec Bucharest 2017)
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
 
Inside TorrentLocker (Cryptolocker) Malware C&C Server
Inside TorrentLocker (Cryptolocker) Malware C&C Server Inside TorrentLocker (Cryptolocker) Malware C&C Server
Inside TorrentLocker (Cryptolocker) Malware C&C Server
 
One shot eight banks
One shot eight banksOne shot eight banks
One shot eight banks
 
Windows Mobile 6.5: Client for a multimedia conferencing platform
Windows Mobile 6.5:  Client for a multimedia conferencing platform Windows Mobile 6.5:  Client for a multimedia conferencing platform
Windows Mobile 6.5: Client for a multimedia conferencing platform
 
A statistical framework to evaluate the "diversity" impact against Advanced P...
A statistical framework to evaluate the "diversity" impact against Advanced P...A statistical framework to evaluate the "diversity" impact against Advanced P...
A statistical framework to evaluate the "diversity" impact against Advanced P...
 

Último

Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.CarlotaBedoya1
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.soniya singh
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 

Último (20)

Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 

Attacking and defending GraphQL applications: a hands-on approach

  • 1. Seattle | September 16-17, 2019 Attacking and defending GraphQL applications: a hands-on approach DAVIDE CIOCCIA STEFAN PETRUSHEVSKI
  • 2. Seattle | September 16-17, 2019 $id Davide Cioccia @davide107 david3107 Stefan Petrushevski @ztefan theztefan
  • 3. Seattle | September 16-17, 2019 Agenda • GraphQL basics: Query, Mutation, Subscription • Security Implications in GraphQL • Lab1: Introspection • Lab2: DoS • Lab3: Mutations • Lab4: IDOR and Authorization bypass • Lab5: Injections
  • 4. Seattle | September 16-17, 2019 GraphQL https://graphql.org/ A query language for your API GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
  • 5. Seattle | September 16-17, 2019 GraphQL Optimizing the data fetching problem by switching from imperative to declarative data fetching
  • 6. Seattle | September 16-17, 2019 GraphQL vs REST API
  • 7. Seattle | September 16-17, 2019 GraphQL vs REST API
  • 8. Seattle | September 16-17, 2019 REST API GraphQL vs
  • 9. Seattle | September 16-17, 2019 Common use-case
  • 10. Seattle | September 16-17, 2019 GraphQL basics
  • 11. Seattle | September 16-17, 2019 Create a schema
  • 12. Seattle | September 16-17, 2019 Define an operation • Query • Mutation • Subscription
  • 13. Seattle | September 16-17, 2019 GraphQL query
  • 14. Seattle | September 16-17, 2019 GraphQL mutation
  • 15. Seattle | September 16-17, 2019 GraphQL subscription
  • 16. Seattle | September 16-17, 2019 LAB: GraphQL basics
  • 17. Seattle | September 16-17, 2019 Repo git clone https://github.com/david3107/graphql-security-labs cd lab3-mutation docker build . -t graphql/mutation && docker run -ti -p 5000:5000 graphql/mutation
  • 18. Seattle | September 16-17, 2019 Security Implications in GraphQL
  • 19. Seattle | September 16-17, 2019 What can go wrong • Introspection • DoS • Injections • Broken Authorization • Insecure Direct Object Reference (IDOR)
  • 20. Seattle | September 16-17, 2019 Introspection
  • 21. Seattle | September 16-17, 2019 What’s introspection • Allows us to ask a GraphQL schema for information about: • Queries • Mutations • Subscriptions • Types • Directives
  • 22. Seattle | September 16-17, 2019 What can we ask for • Querying all available types in a schema • __type • __typename • All available queries • queryType • deprecations • List of enumerator values • __type(name: "<ENUM TYPE>") • All types associated with an Interface or Union • __type(name: "<INTERFACE OR UNION TYPE>")
  • 23. Seattle | September 16-17, 2019 Ask for available types and queries
  • 24. Seattle | September 16-17, 2019 How can we abuse it? • Information disclosure • Sensitive information related to the objects • Retrieve “hidden” queries to bypass controls • Use it as a steppingstone for further attacks
  • 25. Seattle | September 16-17, 2019 How do we prevent it? • Disable introspection. D’oh! • Npm module • https://www.npmjs.com/package/graphql-disable-introspection • One Python hack class NoIntrospection(ValidationRule): def enter_Field(self, node, key, parent, path, ancestors): field_name = node.name.value if field_name == "__schema" or field_name == "__type": self.context.report_error( GraphQLError(u"GraphQL introspection is not allowed", [node]) )
  • 26. Seattle | September 16-17, 2019 LAB: Introspection
  • 27. Seattle | September 16-17, 2019 Repo git clone https://github.com/david3107/graphql-security-labs cd lab1-info-introspection docker build . -t graphql/intro && docker run -ti -p 5000:5000 graphql/intro
  • 28. Seattle | September 16-17, 2019 Challenges: DefDev social network
  • 29. Seattle | September 16-17, 2019 Architecture + +
  • 30. Seattle | September 16-17, 2019 DoS: Nested queries
  • 31. Seattle | September 16-17, 2019 Nested queries • Let’s consider the following schema
  • 32. Seattle | September 16-17, 2019 Nested queries
  • 33. Seattle | September 16-17, 2019 Nested queries: complexity calculation 9999 messages x 1 thread + 9999 messages x 1 thread + 9999 messages x 1 thread
  • 34. Seattle | September 16-17, 2019 Result
  • 35. Seattle | September 16-17, 2019 How do we prevent it? • Limit Maximum Query Depth • Calculate Query Complexity • Throttling Based on Server Time • Audit your query before production
  • 36. Seattle | September 16-17, 2019 Limit Maximum Query Depth
  • 37. Seattle | September 16-17, 2019 Limit Maximum Query Depth • Pros • Because the AST (Abstract Syntax Tree) is statically analyzed the query is never executed • Cons • It’s very difficult to cover all the possible query combinations
  • 38. Seattle | September 16-17, 2019 Calculate Query Complexity Allow only LOW query complexity. If we set query complexity to 4 this query would fail
  • 39. Seattle | September 16-17, 2019 Calculate Query Complexity • Pros • Covers more scenarios • Do not execute the query • Cons • Hard to maintain • Difficult to calculate • Mutations can be tricky :/
  • 40. Seattle | September 16-17, 2019 Audit your query before production • https://www.npmjs.com/package/graphql-validation-complexity • https://github.com/4Catalyzer/graphql-validation-complexity • https://github.com/slicknode/graphql-query-complexity
  • 41. Seattle | September 16-17, 2019 LAB: DoS
  • 42. Seattle | September 16-17, 2019 Repo git clone https://github.com/david3107/graphql-security-labs cd lab2-dos-resource-exhaustion docker build . -t graphql/dos && docker run -ti -p 5000:5000 graphql/dos
  • 43. Seattle | September 16-17, 2019 Goal • Take down that social network
  • 44. Seattle | September 16-17, 2019 Broken Authorization & Insecure Direct Object Reference (IDOR)
  • 45. Seattle | September 16-17, 2019 Quick recap on IDOR
  • 46. Seattle | September 16-17, 2019 So IDOR is a GraphQL problem ….but wrong implementation of GraphQL filtering functions can lead to IDOR vulnerabilities.
  • 47. Seattle | September 16-17, 2019 What can go wrong? • Mutations containing predictable IDs • Perform action on behalf of other users • Query to retrieve data about single elements • Retrieve other users' data
  • 48. Seattle | September 16-17, 2019 How do we discover IDOR? Step 1 • Use introspection to find all the available queries
  • 49. Seattle | September 16-17, 2019 How do we discover IDOR? Step 2 • For each query detect the associated Type • For each object print out the available Fields
  • 50. Seattle | September 16-17, 2019 How do we discover IDOR? Step 3 • For each object detect predictable element (Int, Enum, etc)
  • 51. Seattle | September 16-17, 2019 How do we discover IDOR? Step 4 • Try different values and see what happens :)
  • 52. Seattle | September 16-17, 2019 LAB: IDOR
  • 53. Seattle | September 16-17, 2019 Repo git clone https://github.com/david3107/graphql-security-labs cd lab4-IDOR docker build . -t graphql/idor && docker run -ti -p 5000:5000 graphql/idor
  • 54. Seattle | September 16-17, 2019 Goal • Use IDOR vulnerabilities to retrieve other users' private info • Authenticate as another user
  • 55. Seattle | September 16-17, 2019 Injections
  • 56. Seattle | September 16-17, 2019 Are Injections possible? • Yes, injections vulnerabilities are present • Yes, because of bad implementation (bad coding) • All web vulnerabilities are potentially present in GraphQL
  • 57. Seattle | September 16-17, 2019 How do we prevent Injections (and other)? • Use secure coding principles and practices
  • 58. Seattle | September 16-17, 2019 LAB: Injections
  • 59. Seattle | September 16-17, 2019 Repo git clone https://github.com/david3107/graphql-security-labs cd lab5-injections docker build . -t graphql/injection && docker run -ti –p 5000:5000 –p 1337:1337 graphql/injection
  • 60. Seattle | September 16-17, 2019 Architecture + +
  • 61. Seattle | September 16-17, 2019 Goal • Use the knowledge from previous labs (hint: introspection) • There are two different injection vulnerabilities in the lab. Exploit them to: • Get a remote shell on the machine (use port 1337) • Get the passwords of all administrator users
  • 62. Seattle | September 16-17, 2019 Thank you!
  • 63. Seattle | September 16-17, 2019 About defdev.eu • Defensive development – hardening developers • Hi-end secure development and S/SDLC trainings • handsons/labs, DIY testing/hacking, exams, certification • senior security testers and enterprise developers on stage • from mobile to mainframe • from C#, JS and Java to Go, Swift and Kotlin • from practical cybersec to security in CI/CD