CVE-2021-41248: GraphiQL Introspection Schema Template Injection Attack

graphiql Updated 02 Oct 2025

Summary

08/11/2021
Yes i
High
7.1

CVE-2021-41248: GraphiQL introspection schema template injection attack. Affects graphiql versions >= 0.5.0, < 1.4.7. Fixed in 1.4.7. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

GraphiQL is an open-source interactive development environment for GraphQL. It provides a user-friendly interface for exploring and testing GraphQL APIs. The vulnerability affects all versions of GraphiQL prior to 1.4.7. It allows for compromised HTTP schema introspection responses or schema prop values with malicious GraphQL type names, leading to a dynamic XSS attack surface. This can enable code injection on operation autocomplete. The vulnerability can be exploited if a user loads a vulnerable schema in GraphiQL, which can occur through complex attack vectors or custom implementations that allow the schema URL to be set dynamically. The impact of this vulnerability is the potential exfiltration of user credentials and data through arbitrary malicious scripts.

Vulnerability Detail

The vulnerability in GraphiQL arises from a lack of proper HTML-escaping of text and inadequate schema validation. By escaping text that should be treated as text rather than HTML, the known vulnerability is fixed. Additionally, validating the schema upon receiving introspection responses or schema changes prevents the loading of schemas with names that violate the GraphQL spec. This validation also fixes the known vulnerability. The web app also ensures that user-generated HTML is safe by using the markdown-it library without enabling HTML rendering. The vulnerability affects all versions of GraphiQL and its forks, including GraphQL Playground and the GraphQL Playground fork distributed by Apollo Server.

How To Fix

Latest published version: 5.4.0 as of 22 Oct 2026

npm install graphiql@5.4.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.4.7

This is the first release that contains the fix.

npm install graphiql@1.4.7

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating GraphiQL is not feasible, the following workarounds can be implemented:

  • Always use a static URL to a trusted server that serves a trusted GraphQL schema.
  • If using a custom implementation that allows user-provided schema URLs, either disable this customization or only allow trusted URLs.

Conclusion

The vulnerability in GraphiQL can lead to a dynamic XSS attack surface, enabling code injection on operation autocomplete. It is crucial to update GraphiQL to version 1.4.7 or later to mitigate this vulnerability. If updating is not feasible, implementing the recommended workarounds can help protect against potential attacks. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for graphiql →

Share this vulnerability

FAQ

GraphiQL is an open-source interactive development environment for GraphQL. It provides a user-friendly interface for exploring and testing GraphQL APIs.

All versions of GraphiQL prior to 1.4.7 are vulnerable to this XSS attack.

The vulnerability can be exploited by loading a vulnerable schema in GraphiQL. This can occur through complex attack vectors or custom implementations that allow the schema URL to be set dynamically.

The vulnerability exposes an XSS attack surface, allowing a threat actor to execute arbitrary malicious scripts. This can lead to the exfiltration of user credentials and data without the user's knowledge.

Yes, if updating GraphiQL is not possible, it is recommended to use a static URL to a trusted server that serves a trusted GraphQL schema. If using a custom implementation, either disable the customization or only allow trusted URLs.

How To Fix

Latest published version: 5.4.0 as of 22 Oct 2026

npm install graphiql@5.4.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

1.4.7

This is the first release that contains the fix.

npm install graphiql@1.4.7

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback