<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr" -->

---
title: GHSA-5f8h-c2xc-j37j (graphql): Crafted query strings can...
description: A vulnerability in the graphql-ruby gem lets crafted query strings trigger exponential backtracking in the Ruby lexer, causing exponential CPU consumption....
canonical: https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: GHSA-5f8h-c2xc-j37j (graphql): Crafted query strings can cause exponential backtracking in the Ruby lexer on older Rubies | daily.dev
og:description: A vulnerability in the graphql-ruby gem lets crafted query strings trigger exponential backtracking in the Ruby lexer, causing exponential CPU consumption....
og:url: https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr
og:image: https://api.daily.dev/og/posts/ooJM3lvdR.png
og:image:alt: GHSA-5f8h-c2xc-j37j (graphql): Crafted query strings can cause exponential backtracking in the Ruby lexer on older Rubies
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# GHSA-5f8h-c2xc-j37j (graphql): Crafted query strings can cause exponential backtracking in the Ruby lexer on older Rubies

**[RUBYLAND](https://daily.dev/sources/rubyla)** · 1 min read · 0 upvotes · 0 comments

## Summary

A vulnerability in the graphql-ruby gem lets crafted query strings trigger exponential backtracking in the Ruby lexer, causing exponential CPU consumption. Newer Rubies are not vulnerable. The issue is patched in graphql-ruby 2.6.16 and later. It carries a CVSS v3.x score of 5.3 (Medium), tracked as GHSA-5f8h-c2xc-j37j.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://rubysec.com/advisories/GHSA-5f8h-c2xc-j37j>

## Questions this post answers

### Is graphql-ruby vulnerable to a denial of service attack through crafted query strings?

Yes, graphql-ruby versions up to 2.0.18 are vulnerable to exponential CPU consumption from crafted query strings due to exponential backtracking in the Ruby lexer, but only on Ruby 3.2.x and older. Newer Ruby versions are not affected. The fix is included in graphql-ruby 2.6.16 and later, tracked as GHSA-5f8h-c2xc-j37j with a CVSS score of 5.3 (Medium).

_Teams patching dependency CVEs can track graphql-ruby advisories like this one on daily.dev._

### What version of graphql-ruby fixes the exponential backtracking lexer vulnerability?

Upgrading to graphql-ruby 2.6.16 or later patches the exponential backtracking issue in the Ruby lexer. Versions up to 2.0.18 remain unaffected unless running on older Rubies (3.2.x or below), where crafted query strings can cause exponential CPU consumption. The advisory is identified as GHSA-5f8h-c2xc-j37j with a Medium severity CVSS score of 5.3.

_daily.dev helps Ruby maintainers stay on top of dependency patches like this graphql-ruby fix._

## Similar posts on daily.dev

- [GHSA-wqwf-8p4q-mwqj \(graphql\): Exponential time when calculating complexity](https://daily.dev/posts/ghsa-wqwf-8p4q-mwqj-graphql-exponential-time-when-calculating-complexity-mm1vzhktq) · RUBYLAND · 0 upvotes · 0 comments
- [GHSA-4rw8-495r-pf6j \(graphql\): Execution::Next renders objects whose authorized? check failed](https://daily.dev/posts/ghsa-4rw8-495r-pf6j-graphql-execution-next-renders-objects-whose-authorized-check-failed-0j2vrvyxg) · RUBYLAND · 0 upvotes · 0 comments
- [GHSA-4w5q-wg7v-w6gp \(addressable\): Regular Expression Denial of Service in Addressable templates with several exploded variables](https://daily.dev/posts/ghsa-4w5q-wg7v-w6gp-addressable-regular-expression-denial-of-service-in-addressable-templates-wit-ecd8aibab) · RUBYLAND · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#ruby](https://daily.dev/tags/ruby), [#graphql](https://daily.dev/tags/graphql)

[View this post on daily.dev](https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"GHSA-5f8h-c2xc-j37j (graphql): Crafted query strings can cause exponential backtracking in the Ruby lexer on older Rubies","url":"https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr"},"datePublished":"2026-11-21T16:22:23.831Z","dateModified":"2026-11-21T16:22:46.481Z","description":"A vulnerability in the graphql-ruby gem lets crafted query strings trigger exponential backtracking in the Ruby lexer, causing exponential CPU consumption....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5fa7bf38a8a9c178c1d458f9f735556c?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/5fa7bf38a8a9c178c1d458f9f735556c?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"RUBYLAND","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"RUBYLAND","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/rubyla","url":"https://daily.dev/sources/rubyla"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,ruby,graphql","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"RUBYLAND","item":"https://daily.dev/sources/rubyla"},{"@type":"ListItem","position":3,"name":"GHSA-5f8h-c2xc-j37j (graphql): Crafted query strings can cause exponential backtracking in the Ruby lexer on older Rubies"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/ghsa-5f8h-c2xc-j37j-graphql-crafted-query-strings-can-cause-exponential-backtracking-in-the-ruby--oojm3lvdr#faq","mainEntity":[{"@type":"Question","name":"Is graphql-ruby vulnerable to a denial of service attack through crafted query strings?","acceptedAnswer":{"@type":"Answer","text":"Yes, graphql-ruby versions up to 2.0.18 are vulnerable to exponential CPU consumption from crafted query strings due to exponential backtracking in the Ruby lexer, but only on Ruby 3.2.x and older. Newer Ruby versions are not affected. The fix is included in graphql-ruby 2.6.16 and later, tracked as GHSA-5f8h-c2xc-j37j with a CVSS score of 5.3 (Medium). Teams patching dependency CVEs can track graphql-ruby advisories like this one on daily.dev."}},{"@type":"Question","name":"What version of graphql-ruby fixes the exponential backtracking lexer vulnerability?","acceptedAnswer":{"@type":"Answer","text":"Upgrading to graphql-ruby 2.6.16 or later patches the exponential backtracking issue in the Ruby lexer. Versions up to 2.0.18 remain unaffected unless running on older Rubies (3.2.x or below), where crafted query strings can cause exponential CPU consumption. The advisory is identified as GHSA-5f8h-c2xc-j37j with a Medium severity CVSS score of 5.3. daily.dev helps Ruby maintainers stay on top of dependency patches like this graphql-ruby fix."}}]}
```

