# CVE-2025-27407: Remote code execution when loading a crafted GraphQL schema

> Attackers can achieve remote code execution by loading a malicious GraphQL schema from an untrusted source using the graphql-ruby library.

- **Severity:** Critical 9.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Mar 2025
- **Updated:** 3 Nov 2025
- **Also known as:** DEBIAN-CVE-2025-27407, DLA-4263-1, GHSA-q92j-grw3-h492, UBUNTU-CVE-2025-27407

## What is CVE-2025-27407?

CVE-2025-27407 is a critical code injection vulnerability in rmosolgo graphql-ruby, published on 12 Mar 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

graphql-ruby is a Ruby implementation of GraphQL. Starting in version 1.11.5 and prior to versions 1.11.8, 1.12.25, 1.13.24, 2.0.32, 2.1.14, 2.2.17, and 2.3.21, loading a malicious schema definition in `GraphQL::Schema.from_introspection` (or `GraphQL::Schema::Loader.load`) can result in remote code execution. Any system which loads a schema by JSON from an untrusted source is vulnerable, including those that use GraphQL::Client to load external schemas via GraphQL introspection. Versions 1.11.8, 1.12.25, 1.13.24, 2.0.32, 2.1.14, 2.2.17, and 2.3.21 contain a patch for the issue.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2025-27407?

16 open source packages ship an affected version, including graphql.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `graphql` | RubyGems | From 1.11.5 | 1.11.11 |
| `graphql` | RubyGems | From 1.11.5 | 1.11.11 |
| `graphql` | RubyGems | From 1.12.0 | 1.12.25 |
| `graphql` | RubyGems | From 1.12.0 | 1.12.25 |
| `graphql` | RubyGems | From 1.13.0 | 1.13.24 |
| `graphql` | RubyGems | From 1.13.0 | 1.13.24 |
| `graphql` | RubyGems | From 2.0.0 | 2.0.32 |
| `graphql` | RubyGems | From 2.0.0 | 2.0.32 |
| `graphql` | RubyGems | From 2.1.0 | 2.1.15 |
| `graphql` | RubyGems | From 2.1.0 | 2.1.15 |
| `graphql` | RubyGems | From 2.2.0 | 2.2.17 |
| `graphql` | RubyGems | From 2.2.0 | 2.2.17 |
| `graphql` | RubyGems | From 2.3.0 | 2.3.21 |
| `graphql` | RubyGems | From 2.3.0 | 2.3.21 |
| `graphql` | RubyGems | From 2.4.0 | 2.4.13 |
| `graphql` | RubyGems | From 2.4.0 | 2.4.13 |

## How do I fix CVE-2025-27407?

Upgrade graphql to a fixed version for your release line: 1.11.11, 1.12.25, 1.13.24 or 2.0.32.

## Is CVE-2025-27407 being exploited?

There is no known exploitation of CVE-2025-27407 in the wild and no public exploit code.

Public exploit code:

- https://github.com/LoGGGG2402/CVE-2025-27407 (github_poc): https://github.com/LoGGGG2402/CVE-2025-27407

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-27407 and fix it if it is affected.

What it is: CVE-2025-27407 is a critical code injection vulnerability in rmosolgo graphql-ruby, published on 12 Mar 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-27407 in the wild and no public exploit code.

Affected packages and fixed versions:
- graphql (RubyGems): affected from 1.11.5; fixed in 1.11.11
- graphql (RubyGems): affected from 1.11.5; fixed in 1.11.11
- graphql (RubyGems): affected from 1.12.0; fixed in 1.12.25
- graphql (RubyGems): affected from 1.12.0; fixed in 1.12.25
- graphql (RubyGems): affected from 1.13.0; fixed in 1.13.24
- graphql (RubyGems): affected from 1.13.0; fixed in 1.13.24
- graphql (RubyGems): affected from 2.0.0; fixed in 2.0.32
- graphql (RubyGems): affected from 2.0.0; fixed in 2.0.32
- graphql (RubyGems): affected from 2.1.0; fixed in 2.1.15
- graphql (RubyGems): affected from 2.1.0; fixed in 2.1.15
- graphql (RubyGems): affected from 2.2.0; fixed in 2.2.17
- graphql (RubyGems): affected from 2.2.0; fixed in 2.2.17

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-27407/ (Markdown: https://insights.sbomify.com/CVE-2025-27407/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-27407
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-27407
- OSV: https://osv.dev/vulnerability/CVE-2025-27407

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-27407/
Summaries are generated and may contain mistakes; the official description above is the record.
