Kuboid
Open Luck·Kuboid.in
Security BSides2025
Open in YouTube ↗

Decoding GraphQL: How to Map Hidden Vulnerabilities at Internet Scale

Security BSides San Francisco464 views31:3610 months ago

This talk demonstrates advanced techniques for discovering and exploiting vulnerabilities in GraphQL APIs at scale, including schema leaks, denial-of-service via recursive fragments, and authentication bypasses. The speakers present a custom, reinforcement-learning-based DAST approach to navigate complex GraphQL graph structures and identify business logic flaws that traditional scanners miss. The presentation highlights the prevalence of these issues in production environments and provides a security-by-default checklist for developers and security engineers. The talk also introduces Goctopus, an open-source tool for GraphQL discovery and fingerprinting.

Why Your GraphQL Implementation Is Likely Leaking Your Entire Data Model

TLDR: GraphQL’s flexibility is its greatest security liability, as it allows attackers to bypass traditional rate limiting and map entire data structures through introspection and recursive queries. By using reinforcement learning to navigate the graph, researchers can identify business logic flaws and sensitive data exposure that standard DAST tools completely miss. Developers must move beyond simple endpoint protection and implement field-level authorization and strict depth limiting to secure their APIs.

Most security teams treat GraphQL like a standard REST API, slapping a WAF in front of it and calling it a day. That is a mistake. GraphQL is not just a transport layer; it is a query language that gives an attacker the keys to your internal data graph. When you expose a GraphQL endpoint, you are often exposing the entire schema of your application, including relationships between objects that were never intended to be public.

The core issue is that GraphQL allows for complex, nested queries in a single HTTP request. A standard DAST scanner, which expects a predictable request-response cycle, will often fail to understand the depth or the business logic implications of these queries. Attackers, however, have realized that they can use this to their advantage. By crafting specific queries, they can bypass rate limits that are enforced at the HTTP level, as a single request can contain multiple operations that perform heavy lifting on the backend.

The Mechanics of Graph-Based Exploitation

During recent research, it became clear that the most dangerous vulnerabilities in GraphQL are not the ones you find in the OWASP Top 10 for web applications, but those specific to the graph structure itself. One of the most effective techniques involves using recursive fragments to trigger a denial-of-service.

A fragment is a reusable piece of logic. If you define a fragment that references itself, you create a recursive loop. When the GraphQL engine attempts to resolve this query, it will continue to expand the fragment until it hits a stack overflow or exhausts server memory.

fragment NameParts on Person {
  firstName
  lastName
  ...NameParts
}

This is a simple example, but in a production environment, this can be used to crash the service with a single, small request. Because the request itself is tiny, it often bypasses size-based WAF rules.

Mapping the Attack Surface with Goctopus

Discovery is the first step of any engagement. If you are testing a target, you need to know what the schema looks like. Even when introspection is disabled, you can often reconstruct the schema by observing error messages and using tools like Clairvoyance.

To automate this at scale, the research team released Goctopus, a tool designed for GraphQL discovery and fingerprinting. It performs subdomain enumeration and then uses a reinforcement learning algorithm to intelligently probe the API. Unlike a dumb fuzzer, it learns from the responses it receives, allowing it to navigate the graph and identify endpoints that are not linked in the main schema.

When you are on an engagement, do not just look for the obvious endpoints. Use Goctopus to map the entire graph. Look for mutations that do not require authentication. We found that in many production environments, developers assume that because an endpoint is not linked in the documentation, it is "internal." That is security by obscurity, and it fails every time.

The Business Logic Trap

The most critical vulnerabilities we identified were related to broken access control. Because GraphQL is a graph, you have many different paths to the same resource. A developer might secure the User object, but forget to secure the Admin field that is reachable through a Settings object.

Standard scanners cannot verify if a user has permission to access a specific field because they do not understand the business logic. You need to manually verify these relationships. If you can query for a stripe_token or an access_token through a path that should be restricted, you have found a high-impact bug.

Hardening Your GraphQL Stack

Defending against these attacks requires a shift in mindset. You cannot rely on perimeter security. You must implement field-level authorization to ensure that every single field in your schema is protected by an explicit check.

For those looking for a quick win, GraphQL Armor provides a middleware layer that implements several security best practices, such as depth limiting and disabling introspection, with minimal configuration. It is a necessary baseline, but it is not a replacement for a well-designed authorization layer.

Stop treating your GraphQL API as a black box. If you are a pentester, start mapping the graph manually and look for the hidden paths that the developers forgot to secure. If you are a developer, assume that every field you expose is a potential entry point for an attacker. The graph is only as strong as its weakest link, and in most cases, that link is a field that someone thought no one would ever query.

Talk Type
research presentation
Difficulty
advanced
Category
web security
Has Demo Has Code Tool Released


BSidesSF 2025

94 talks · 2025
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in