1 GraphQL Attack Vectors
GraphQL APIs have unique security challenges beyond traditional REST APIs.
1. Introspection exposure:
# Attacker queries the entire schema
{ __schema { types { name fields { name type { name } } } } }
# Returns: all types, fields, mutations, and their arguments
# Enables targeted attack planning2. Missing field-level authorization:
query {
user(id: "123") {
email # Public — OK
passwordHash # Should be restricted — but is it?
adminNotes # Internal field exposed to all authenticated users!
}
}3. Query depth attacks (DoS):
{ user { friends { friends { friends { friends { posts { comments { author { friends { ... } } } } } } } } } }
# Exponentially complex query — can exhaust server memory4. Batching attacks: GraphQL allows multiple operations in one request, enabling enumeration attacks at scale.