SlideShare a Scribd company logo
The Darkside of GraphQL
GraphQL is so query-ous, it's bound to
leave you REST-less.
02.28.2023
Why GraphQL ?
➔Increased efficiency
- Request exact data you need. Nothing More, Nothing Less
➔Better flexibility
- Evolve and iterate on the API without impacting clients
➔Facilitates collaboration
- GraphQL provides a common language for both frontend and backend
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
PUN
Why settle for the
simplicity of REST
when you can spend
your days writing
complex GraphQL
schemas that
nobody understands?
How is GraphQL Different from REST ?
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Common GraphQL Endpoints
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
TIP
I would rather create a
wordlist of common
GraphQL Endpoints
and pass it to FFUF,
DirBuster, etc
1./graphql
2./graphql.php
3./graphiql
4./v1/explorer
5./v1/graphiql
6./v2/graphql/console
List of Common API Endpoints
DIFFERENT TYPES OF
QUERIES IN GRAPHQL
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
PUN
"A GraphQL query is like
a conversation with a
waiter at a restaurant.
You tell the waiter what
you want to eat (i.e., the
data you want to
retrieve), and the waiter
brings it to your table. But
unlike a restaurant, you
don't have to leave a tip!"
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
QUERY
A query is used to retrieve
data from a GraphQL server. It
is analogous to a GET request in
a REST API. A query consists of
a set of fields that define the
data that the client wants to
fetch from the server.
A mutation is used to modify
data on a GraphQL server. It is
analogous to a POST, PUT, or
DELETE request in a REST API. A
mutation consists of a set of
input arguments and fields that
define the data that the client
wants to change on the server.
A subscription is used to receive
real-time updates from a
GraphQL server. It is similar to a
query, but instead of returning a
single result, a subscription
returns a stream of data that is
sent to the client whenever the
server's data changes.
MUTATION SUBSCRIPTION
ATTACKER'S PERSPECTIVE TO
GRAPHQL
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
PUN
Why did the GraphQL
developer refuse to use
REST?
Because they didn't want
to get caught up in a
"REST-riction" when it
came to querying data!
THE INTROSPECTION
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
PUN
Why did the GraphQL
schema go to
therapy? Because it
needed some
introspecc-tion!
GraphQL introspection is a feature that allows a
GraphQL client to query the GraphQL schema at
runtime to get information about the available
types, fields, and directives that the schema
supports. This information can be used to
understand the schema's structure, generate
documentation, or even to dynamically generate
GraphQL queries and mutations.
INTROSPECTION QUERY
Introspection can reveal
sensitive information about
the application's underlying
data model.
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Why is Introspection a vulnerability?
TIP
The output of
Introspection might not
be readable. To view in
much better way use
“apis.guru/graphql-
voyager/”
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
why we use
graphql-
voyager?
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
I call it "The Voyager Magic"
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Batching is a technique used
in GraphQL to optimize
queries by allowing multiple
queries to be sent in a single
HTTP request
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Can we exploit Batching in GraphQL?
TIP
GraphQL batching is not
inherently a vulnerability
but … let's find out
EXPLOIT FOR BATCHING
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
TIP
Use “BatchQL” tool
by AssetNote.
The most common attack for batching is Denial
of Service (DoS) attack. If an attacker sends a
large number of batched queries that require
significant processing, it could cause the server
to become overwhelmed and result in a denial-
of-service attack.
PoC in Next Slide
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Note the
Execution
Time
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Ahm...
Ahm...
Authentication Bypass with
the help of Batching.
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
TIP
Majorly works where 2Fa
is present.
BYPASSING 2FA
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
TIP
Use “BatchQL” tool
by AssetNote.
We can see that we pass 3 different verification
code and even if one code is correct, we will get
the successful response.
Credit: Assetnote
Testing for Directive
Overloading
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
TIP
Directive overloading is
neglected because
developers and hackers
are concentrating on
Batching.
Let's see a Live PoC
WHAT ARE RUNTIME DIRECTIVES?
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
The purpose of runtime directives is to modify
the execution.
There are two main runtime directives in
GraphQL: @skip and @include
• @skip(if: ...)
skips the selection if
the if: ... value is
truthy
• @include(if: ...)
includes the selection if
the if: ... value is
truthy
Note the
Execution
Time
TIP
Multiple errors
confirms that
server is
vulnerable to
directive
overloading.
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
POSSIBLE MITIGATIONS
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
• Implement depth limiting for incoming GraphQL queries
• Perform query cost analysis to limit expensive queries
• Enforce rate-limiting for incoming requests per API client
• Add timeouts for both the infrastructure and API layer
• Disable introspection queries in public APIs
• Use a whitelist for allowed characters
• Add pagination to limit the amount of information that can be accessed by a single
request
To Succeed, Security Teams Need Unified API Protection
An Integrated Solution Across the Entire API Protection Lifecycle
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Continuous API
Protection Lifecycle
Discovery
Identify Public Facing APIs
Inventory
Provide Unified Inventory
of ALL APIs
Compliance
Ensure Adherence to Security
and Governance Best Practices
Testing
Secure New APIs
Before Go-Live
Prevention
Block Attacks Natively
in Real Time
Detection
Detect Attacks as They Happen
Thank You
Merci
Gracias
Danke
Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
Did someone mention that
Cequence can provide you with free
security assessment?
Grazie
Dhanyavaad
Shukraan
Arigato
Ad

More Related Content

Similar to APIsecure 2023 - Learn how to attack and mitigate vulnerabilities in GraphQL, Parth Shukla (Cequence Security) (20)

Openshift serverless Solution
Openshift serverless SolutionOpenshift serverless Solution
Openshift serverless Solution
Ryan ZhangCheng
 
Graphql
GraphqlGraphql
Graphql
Niv Ben David
 
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Thien Ly
 
Scaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships MatterScaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships Matter
Joel Bowen
 
2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion
mnriem
 
Why and How to Monitor Application Performance in Azure
Why and How to Monitor Application Performance in AzureWhy and How to Monitor Application Performance in Azure
Why and How to Monitor Application Performance in Azure
Riverbed Technology
 
Why and How to Monitor App Performance in Azure
Why and How to Monitor App Performance in AzureWhy and How to Monitor App Performance in Azure
Why and How to Monitor App Performance in Azure
Ian Downard
 
API Management for GraphQL
API Management for GraphQLAPI Management for GraphQL
API Management for GraphQL
WSO2
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
Rob Crowley
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays
 
Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014
cornelia davis
 
Understanding and Developing Web Services: For DBAs and Database Developers
Understanding and Developing Web Services: For DBAs and Database DevelopersUnderstanding and Developing Web Services: For DBAs and Database Developers
Understanding and Developing Web Services: For DBAs and Database Developers
Revelation Technologies
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)
Knoldus Inc.
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL Presentation
Knoldus Inc.
 
Understanding and Developing Web Services - For DBAs and Developers
Understanding and Developing Web Services - For DBAs and DevelopersUnderstanding and Developing Web Services - For DBAs and Developers
Understanding and Developing Web Services - For DBAs and Developers
Revelation Technologies
 
Create API for your Databases
Create API for your DatabasesCreate API for your Databases
Create API for your Databases
Cédrick Lunven
 
Attacking GraphQL
Attacking GraphQLAttacking GraphQL
Attacking GraphQL
KavishaSheth1
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
Tim Burks
 
Comparing three data ingestion approaches where Apache Kafka integrates with ...
Comparing three data ingestion approaches where Apache Kafka integrates with ...Comparing three data ingestion approaches where Apache Kafka integrates with ...
Comparing three data ingestion approaches where Apache Kafka integrates with ...
HostedbyConfluent
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2
 
Openshift serverless Solution
Openshift serverless SolutionOpenshift serverless Solution
Openshift serverless Solution
Ryan ZhangCheng
 
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
Thien Ly
 
Scaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships MatterScaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships Matter
Joel Bowen
 
2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion2015 UJUG, Servlet 4.0 portion
2015 UJUG, Servlet 4.0 portion
mnriem
 
Why and How to Monitor Application Performance in Azure
Why and How to Monitor Application Performance in AzureWhy and How to Monitor Application Performance in Azure
Why and How to Monitor Application Performance in Azure
Riverbed Technology
 
Why and How to Monitor App Performance in Azure
Why and How to Monitor App Performance in AzureWhy and How to Monitor App Performance in Azure
Why and How to Monitor App Performance in Azure
Ian Downard
 
API Management for GraphQL
API Management for GraphQLAPI Management for GraphQL
API Management for GraphQL
WSO2
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
Rob Crowley
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays
 
Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014Running your Spring Apps in the Cloud Javaone 2014
Running your Spring Apps in the Cloud Javaone 2014
cornelia davis
 
Understanding and Developing Web Services: For DBAs and Database Developers
Understanding and Developing Web Services: For DBAs and Database DevelopersUnderstanding and Developing Web Services: For DBAs and Database Developers
Understanding and Developing Web Services: For DBAs and Database Developers
Revelation Technologies
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)
Knoldus Inc.
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL Presentation
Knoldus Inc.
 
Understanding and Developing Web Services - For DBAs and Developers
Understanding and Developing Web Services - For DBAs and DevelopersUnderstanding and Developing Web Services - For DBAs and Developers
Understanding and Developing Web Services - For DBAs and Developers
Revelation Technologies
 
Create API for your Databases
Create API for your DatabasesCreate API for your Databases
Create API for your Databases
Cédrick Lunven
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
Tim Burks
 
Comparing three data ingestion approaches where Apache Kafka integrates with ...
Comparing three data ingestion approaches where Apache Kafka integrates with ...Comparing three data ingestion approaches where Apache Kafka integrates with ...
Comparing three data ingestion approaches where Apache Kafka integrates with ...
HostedbyConfluent
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2
 

More from apidays (20)

apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...
apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...
apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...
apidays
 
apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...
apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...
apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...
apidays
 
apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...
apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...
apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...
apidays
 
apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...
apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...
apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...
apidays
 
Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...
Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...
Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...
apidays
 
apidays Paris 2024 - Project API Forge, Naresh Jain, Specmatic
apidays Paris 2024 - Project API Forge, Naresh Jain, Specmaticapidays Paris 2024 - Project API Forge, Naresh Jain, Specmatic
apidays Paris 2024 - Project API Forge, Naresh Jain, Specmatic
apidays
 
apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...
apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...
apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...
apidays
 
Green IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBS
Green IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBSGreen IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBS
Green IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBS
apidays
 
apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...
apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...
apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...
apidays
 
Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...
Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...
Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...
apidays
 
apidays Paris 2024 - Governance of Event-Driven Distributed Systems, Omid Ei...
apidays Paris 2024 - Governance of Event-Driven Distributed Systems,  Omid Ei...apidays Paris 2024 - Governance of Event-Driven Distributed Systems,  Omid Ei...
apidays Paris 2024 - Governance of Event-Driven Distributed Systems, Omid Ei...
apidays
 
apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...
apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...
apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...
apidays
 
apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...
apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...
apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...
apidays
 
apidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consulting
apidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consultingapidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consulting
apidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consulting
apidays
 
apidays Paris 2024 - Advanced API Management and Operations A Develope
apidays Paris 2024 - Advanced API Management and Operations A Developeapidays Paris 2024 - Advanced API Management and Operations A Develope
apidays Paris 2024 - Advanced API Management and Operations A Develope
apidays
 
apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...
apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...
apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...
apidays
 
apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...
apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...
apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...
apidays
 
apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...
apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...
apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...
apidays
 
apidays Paris 2024 - Establishing a Specification Framework for API Managemen...
apidays Paris 2024 - Establishing a Specification Framework for API Managemen...apidays Paris 2024 - Establishing a Specification Framework for API Managemen...
apidays Paris 2024 - Establishing a Specification Framework for API Managemen...
apidays
 
Green IO Conference at apidays Paris 2024 - The Internet is Getting Emptier;...
Green IO Conference at apidays Paris 2024 -  The Internet is Getting Emptier;...Green IO Conference at apidays Paris 2024 -  The Internet is Getting Emptier;...
Green IO Conference at apidays Paris 2024 - The Internet is Getting Emptier;...
apidays
 
apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...
apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...
apidays Paris 2024 - AI-Enhanced API Documentation Bridging Knowledge Gaps an...
apidays
 
apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...
apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...
apidays Paris 2024 - AI Adoption - Engaging Minds, Developing Skills, Deliver...
apidays
 
apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...
apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...
apidays Paris 2024 - Design, Debug, Test and Mock APIs with Kong Insomnia, Pi...
apidays
 
apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...
apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...
apidays Paris 2024 - Generate OpenAPI Schema from Golang Code with the Fuego ...
apidays
 
Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...
Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...
Green IO Conference at apidays Paris 2024 - Meeting or Missing Targets? Data ...
apidays
 
apidays Paris 2024 - Project API Forge, Naresh Jain, Specmatic
apidays Paris 2024 - Project API Forge, Naresh Jain, Specmaticapidays Paris 2024 - Project API Forge, Naresh Jain, Specmatic
apidays Paris 2024 - Project API Forge, Naresh Jain, Specmatic
apidays
 
apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...
apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...
apidays Paris 2024 - How API Help to Better Serve Clients at Allianz Trade, M...
apidays
 
Green IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBS
Green IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBSGreen IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBS
Green IO Conference at apidays Paris 2024 - TOSS In Some AI, Pindy Bhullar, UBS
apidays
 
apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...
apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...
apidays Paris 2024 - Embeddings: Core Concepts for Developers, Jocelyn Matthe...
apidays
 
Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...
Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...
Green IO Conference at apidays Paris 2024 - What's Behind Avoided Emissions, ...
apidays
 
apidays Paris 2024 - Governance of Event-Driven Distributed Systems, Omid Ei...
apidays Paris 2024 - Governance of Event-Driven Distributed Systems,  Omid Ei...apidays Paris 2024 - Governance of Event-Driven Distributed Systems,  Omid Ei...
apidays Paris 2024 - Governance of Event-Driven Distributed Systems, Omid Ei...
apidays
 
apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...
apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...
apidays Paris 2024 - Contract-Driven Development for Event-Driven Architectur...
apidays
 
apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...
apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...
apidays Paris 2024 - 7 Rules for Crafting Developer-Friendly API Libraries, B...
apidays
 
apidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consulting
apidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consultingapidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consulting
apidays Paris 2024 - Tackling OpenAPI Drift, Ikenna Nwaiwu, Ikenna Consulting
apidays
 
apidays Paris 2024 - Advanced API Management and Operations A Develope
apidays Paris 2024 - Advanced API Management and Operations A Developeapidays Paris 2024 - Advanced API Management and Operations A Develope
apidays Paris 2024 - Advanced API Management and Operations A Develope
apidays
 
apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...
apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...
apidays Paris 2024 - Develop in Parallel and Ship Earlier with OpenAPI and Mo...
apidays
 
apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...
apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...
apidays Paris 2024 - Make Your LLM Infrastructure Serverless, Guillaume Blaqu...
apidays
 
apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...
apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...
apidays Paris 2024 - Modularizing your API with Domain Storytelling Henning S...
apidays
 
apidays Paris 2024 - Establishing a Specification Framework for API Managemen...
apidays Paris 2024 - Establishing a Specification Framework for API Managemen...apidays Paris 2024 - Establishing a Specification Framework for API Managemen...
apidays Paris 2024 - Establishing a Specification Framework for API Managemen...
apidays
 
Green IO Conference at apidays Paris 2024 - The Internet is Getting Emptier;...
Green IO Conference at apidays Paris 2024 -  The Internet is Getting Emptier;...Green IO Conference at apidays Paris 2024 -  The Internet is Getting Emptier;...
Green IO Conference at apidays Paris 2024 - The Internet is Getting Emptier;...
apidays
 
Ad

Recently uploaded (20)

Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
How to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any DowntimeHow to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any Downtime
steve198109
 
data science data stoger Presentation1.pptx
data science data stoger Presentation1.pptxdata science data stoger Presentation1.pptx
data science data stoger Presentation1.pptx
sandeepsherkhane830
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
Virtualization Trends Streamlining Operations in Telecom with David Bernard ...
Virtualization Trends  Streamlining Operations in Telecom with David Bernard ...Virtualization Trends  Streamlining Operations in Telecom with David Bernard ...
Virtualization Trends Streamlining Operations in Telecom with David Bernard ...
David Bernard Ezell
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
final project for icpna b08 if someone want.pptx
final project for icpna b08 if someone want.pptxfinal project for icpna b08 if someone want.pptx
final project for icpna b08 if someone want.pptx
ESTEFANOANDREYGARCIA
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
What's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff HustonWhat's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff Huston
APNIC
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
Understanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep WebUnderstanding the Tor Network and Exploring the Deep Web
Understanding the Tor Network and Exploring the Deep Web
nabilajabin35
 
How to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any DowntimeHow to Switch Hosting Providers in Vancouver Without Any Downtime
How to Switch Hosting Providers in Vancouver Without Any Downtime
steve198109
 
data science data stoger Presentation1.pptx
data science data stoger Presentation1.pptxdata science data stoger Presentation1.pptx
data science data stoger Presentation1.pptx
sandeepsherkhane830
 
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHostingTop Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
Top Vancouver Green Business Ideas for 2025 Powered by 4GoodHosting
steve198109
 
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 SupportReliable Vancouver Web Hosting with Local Servers & 24/7 Support
Reliable Vancouver Web Hosting with Local Servers & 24/7 Support
steve198109
 
Virtualization Trends Streamlining Operations in Telecom with David Bernard ...
Virtualization Trends  Streamlining Operations in Telecom with David Bernard ...Virtualization Trends  Streamlining Operations in Telecom with David Bernard ...
Virtualization Trends Streamlining Operations in Telecom with David Bernard ...
David Bernard Ezell
 
IT Services Workflow From Request to Resolution
IT Services Workflow From Request to ResolutionIT Services Workflow From Request to Resolution
IT Services Workflow From Request to Resolution
mzmziiskd
 
Best web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you businessBest web hosting Vancouver 2025 for you business
Best web hosting Vancouver 2025 for you business
steve198109
 
Perguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolhaPerguntas dos animais - Slides ilustrados de múltipla escolha
Perguntas dos animais - Slides ilustrados de múltipla escolha
socaslev
 
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC -Policy Development Process, presented at Local APIGA Taiwan 2025
APNIC
 
final project for icpna b08 if someone want.pptx
final project for icpna b08 if someone want.pptxfinal project for icpna b08 if someone want.pptx
final project for icpna b08 if someone want.pptx
ESTEFANOANDREYGARCIA
 
5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx5-Proses-proses Akuisisi Citra Digital.pptx
5-Proses-proses Akuisisi Citra Digital.pptx
andani26
 
Computers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers NetworksComputers Networks Computers Networks Computers Networks
Computers Networks Computers Networks Computers Networks
Tito208863
 
(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security(Hosting PHising Sites) for Cryptography and network security
(Hosting PHising Sites) for Cryptography and network security
aluacharya169
 
White and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptxWhite and Red Clean Car Business Pitch Presentation.pptx
White and Red Clean Car Business Pitch Presentation.pptx
canumatown
 
Determining Glass is mechanical textile
Determining  Glass is mechanical textileDetermining  Glass is mechanical textile
Determining Glass is mechanical textile
Azizul Hakim
 
highend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptxhighend-srxseries-services-gateways-customer-presentation.pptx
highend-srxseries-services-gateways-customer-presentation.pptx
elhadjcheikhdiop
 
What's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff HustonWhat's going on with IPv6? presented by Geoff Huston
What's going on with IPv6? presented by Geoff Huston
APNIC
 
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation TemplateSmart Mobile App Pitch Deck丨AI Travel App Presentation Template
Smart Mobile App Pitch Deck丨AI Travel App Presentation Template
yojeari421237
 
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...Mobile database for your company telemarketing or sms marketing campaigns. Fr...
Mobile database for your company telemarketing or sms marketing campaigns. Fr...
DataProvider1
 
Ad

APIsecure 2023 - Learn how to attack and mitigate vulnerabilities in GraphQL, Parth Shukla (Cequence Security)

  • 1. The Darkside of GraphQL GraphQL is so query-ous, it's bound to leave you REST-less. 02.28.2023
  • 2. Why GraphQL ? ➔Increased efficiency - Request exact data you need. Nothing More, Nothing Less ➔Better flexibility - Evolve and iterate on the API without impacting clients ➔Facilitates collaboration - GraphQL provides a common language for both frontend and backend Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED PUN Why settle for the simplicity of REST when you can spend your days writing complex GraphQL schemas that nobody understands?
  • 3. How is GraphQL Different from REST ? Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
  • 4. Common GraphQL Endpoints Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED TIP I would rather create a wordlist of common GraphQL Endpoints and pass it to FFUF, DirBuster, etc 1./graphql 2./graphql.php 3./graphiql 4./v1/explorer 5./v1/graphiql 6./v2/graphql/console List of Common API Endpoints
  • 5. DIFFERENT TYPES OF QUERIES IN GRAPHQL Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED PUN "A GraphQL query is like a conversation with a waiter at a restaurant. You tell the waiter what you want to eat (i.e., the data you want to retrieve), and the waiter brings it to your table. But unlike a restaurant, you don't have to leave a tip!"
  • 6. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED QUERY A query is used to retrieve data from a GraphQL server. It is analogous to a GET request in a REST API. A query consists of a set of fields that define the data that the client wants to fetch from the server. A mutation is used to modify data on a GraphQL server. It is analogous to a POST, PUT, or DELETE request in a REST API. A mutation consists of a set of input arguments and fields that define the data that the client wants to change on the server. A subscription is used to receive real-time updates from a GraphQL server. It is similar to a query, but instead of returning a single result, a subscription returns a stream of data that is sent to the client whenever the server's data changes. MUTATION SUBSCRIPTION
  • 7. ATTACKER'S PERSPECTIVE TO GRAPHQL Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED PUN Why did the GraphQL developer refuse to use REST? Because they didn't want to get caught up in a "REST-riction" when it came to querying data!
  • 8. THE INTROSPECTION Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED PUN Why did the GraphQL schema go to therapy? Because it needed some introspecc-tion! GraphQL introspection is a feature that allows a GraphQL client to query the GraphQL schema at runtime to get information about the available types, fields, and directives that the schema supports. This information can be used to understand the schema's structure, generate documentation, or even to dynamically generate GraphQL queries and mutations. INTROSPECTION QUERY
  • 9. Introspection can reveal sensitive information about the application's underlying data model. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED Why is Introspection a vulnerability? TIP The output of Introspection might not be readable. To view in much better way use “apis.guru/graphql- voyager/”
  • 10. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED why we use graphql- voyager?
  • 11. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED I call it "The Voyager Magic"
  • 12. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
  • 13. Batching is a technique used in GraphQL to optimize queries by allowing multiple queries to be sent in a single HTTP request Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED Can we exploit Batching in GraphQL? TIP GraphQL batching is not inherently a vulnerability but … let's find out
  • 14. EXPLOIT FOR BATCHING Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED TIP Use “BatchQL” tool by AssetNote. The most common attack for batching is Denial of Service (DoS) attack. If an attacker sends a large number of batched queries that require significant processing, it could cause the server to become overwhelmed and result in a denial- of-service attack. PoC in Next Slide
  • 15. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED Note the Execution Time
  • 16. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED Ahm... Ahm...
  • 17. Authentication Bypass with the help of Batching. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED TIP Majorly works where 2Fa is present.
  • 18. BYPASSING 2FA Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED TIP Use “BatchQL” tool by AssetNote. We can see that we pass 3 different verification code and even if one code is correct, we will get the successful response. Credit: Assetnote
  • 19. Testing for Directive Overloading Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED TIP Directive overloading is neglected because developers and hackers are concentrating on Batching. Let's see a Live PoC
  • 20. WHAT ARE RUNTIME DIRECTIVES? Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED The purpose of runtime directives is to modify the execution. There are two main runtime directives in GraphQL: @skip and @include • @skip(if: ...) skips the selection if the if: ... value is truthy • @include(if: ...) includes the selection if the if: ... value is truthy Note the Execution Time TIP Multiple errors confirms that server is vulnerable to directive overloading.
  • 21. Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED
  • 22. POSSIBLE MITIGATIONS Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED • Implement depth limiting for incoming GraphQL queries • Perform query cost analysis to limit expensive queries • Enforce rate-limiting for incoming requests per API client • Add timeouts for both the infrastructure and API layer • Disable introspection queries in public APIs • Use a whitelist for allowed characters • Add pagination to limit the amount of information that can be accessed by a single request
  • 23. To Succeed, Security Teams Need Unified API Protection An Integrated Solution Across the Entire API Protection Lifecycle Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED Continuous API Protection Lifecycle Discovery Identify Public Facing APIs Inventory Provide Unified Inventory of ALL APIs Compliance Ensure Adherence to Security and Governance Best Practices Testing Secure New APIs Before Go-Live Prevention Block Attacks Natively in Real Time Detection Detect Attacks as They Happen
  • 24. Thank You Merci Gracias Danke Copyright ©2023 Cequence Security | ALL RIGHTS RESERVED Did someone mention that Cequence can provide you with free security assessment? Grazie Dhanyavaad Shukraan Arigato