GraphQL Field Suggestions Enabled
The GraphQL server's error messages suggest valid field and type names for misspelt ones, which lets the schema be reconstructed even when introspection is disabled.
| Severity | Informational |
| CVSS 3.1 | 0 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N Open in the calculator |
| CVSS 4.0 | 0 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-209: Generation of Error Message Containing Sensitive Information |
| OWASP Top 10 | A10:2025 Mishandling of Exceptional Conditions |
| MITRE ATT&CK | T1595.003 Wordlist Scanning |
| Category | Information Disclosure |
Description
When a query names a field, argument or type that does not exist, many GraphQL servers, including those built on the reference implementation graphql-js, return a validation error that states the name cannot be queried and then suggests similar valid names, introduced by 'Did you mean'. The feature helps developers, but in production it tells anyone who sends queries which names exist.
By sending queries with candidate names from a wordlist and collecting the suggestions, an attacker can recover the names of fields, arguments and operations that introspection would otherwise reveal, and so rebuild much of the schema, including fields and operations the client never uses, even where introspection has been disabled; Clairvoyance is a widely used tool for this. Disabling introspection alone therefore does not hide the schema. As with introspection, this helps an attacker find operations to test but gives no access to data or functions by itself, so it is a hardening matter unless the recovered schema leads to an exploitable operation.
The weakness is identified by sending a query with a deliberately misspelt field name, such as a known field with one letter changed, and checking whether the error response contains suggestions.
Remediation
Remove schema hints from error messages in production:
- Use the server's option to disable suggestions where one exists. Where there is none, use its error formatting hook (for example
formatErrorin Apollo Server) to remove the suggestion text from validation errors before they are returned. - Return generic validation errors to clients in production, and log the detail on the server instead.
- Disable introspection in production as well, since removing one source of schema information without the other has little effect.
- Enforce authorisation on every sensitive field and operation, so that knowledge of the schema gives no access.
Confirm the fix by sending queries with misspelt field and type names and checking that the errors no longer contain suggestions.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.