|
| 1 | +--- |
| 2 | +layout: advisory |
| 3 | +title: 'CVE-2026-54297 (faraday): Faraday - Uncontrolled recursion in NestedParamsEncoder |
| 4 | + allows stack exhaustion DoS via deeply nested query parameters' |
| 5 | +comments: false |
| 6 | +categories: |
| 7 | +- faraday |
| 8 | +advisory: |
| 9 | + gem: faraday |
| 10 | + cve: 2026-54297 |
| 11 | + ghsa: 98m9-hrrm-r99r |
| 12 | + url: https://www.cve.org/CVERecord/SearchResults?query=CVE-2026-54297 |
| 13 | + title: Faraday - Uncontrolled recursion in NestedParamsEncoder allows stack exhaustion |
| 14 | + DoS via deeply nested query parameters |
| 15 | + date: 2026-06-19 |
| 16 | + description: |- |
| 17 | + # Uncontrolled Recursion in NestedParamsEncoder Allows Stack |
| 18 | + Exhaustion DoS via Deeply Nested Query Parameters |
| 19 | +
|
| 20 | + ## Summary |
| 21 | +
|
| 22 | + `Faraday::NestedParamsEncoder`, the default nested query parameter |
| 23 | + encoder/decoder in Faraday, decodes nested query strings without |
| 24 | + enforcing a maximum nesting depth. |
| 25 | +
|
| 26 | + A crafted query string such as: |
| 27 | +
|
| 28 | + ```text |
| 29 | + a[x][x][x][x]...[x]=1 |
| 30 | + ``` |
| 31 | +
|
| 32 | + causes Faraday to build a deeply nested Ruby `Hash` structure. The |
| 33 | + internal `dehash` routine then recursively walks this attacker-controlled |
| 34 | + structure without a depth limit. At sufficient depth, Ruby raises an |
| 35 | + uncaught `SystemStackError` (`stack level too deep`), crashing the |
| 36 | + calling thread or worker. |
| 37 | +
|
| 38 | + This can lead to denial of service in applications that pass |
| 39 | + attacker-controlled query strings to Faraday's nested query parsing |
| 40 | + or URL-building paths. |
| 41 | +
|
| 42 | + ## Impact |
| 43 | +
|
| 44 | + A relatively small query string can trigger a `SystemStackError` and |
| 45 | + crash the calling Ruby thread or worker. |
| 46 | +
|
| 47 | + In my local test environment, a payload of approximately 9.4 KB |
| 48 | + was sufficient: |
| 49 | +
|
| 50 | + ```text |
| 51 | + depth=3119 |
| 52 | + bytes=9360 |
| 53 | + result=SystemStackError |
| 54 | + message="stack level too deep" |
| 55 | + ``` |
| 56 | +
|
| 57 | + Repeated requests with such payloads may cause a denial of service |
| 58 | + against applications whose request path forwards, parses, or rebuilds |
| 59 | + attacker-controlled query strings through Faraday. |
| 60 | +
|
| 61 | + This issue does not provide remote code execution, authentication |
| 62 | + bypass, or data disclosure. The confirmed impact is availability loss. |
| 63 | +
|
| 64 | + ## Reporter |
| 65 | +
|
| 66 | + Reported by: Emre Koca |
| 67 | + cvss_v3: 7.5 |
| 68 | + patched_versions: |
| 69 | + - ">= 2.14.3" |
| 70 | + related: |
| 71 | + url: |
| 72 | + - https://www.cve.org/CVERecord/SearchResults?query=CVE-2026-54297 |
| 73 | + - https://rubygems.org/gems/faraday/versions/2.14.3 |
| 74 | + - https://github.com/lostisland/faraday/releases/tag/v2.14.3 |
| 75 | + - https://github.com/lostisland/faraday/compare/v2.14.2...v2.14.3 |
| 76 | + - https://test.osv.dev/vulnerability/GHSA-98m9-hrrm-r99r |
| 77 | + - https://advisories.gitlab.com/gem/faraday/CVE-2026-54297 |
| 78 | + - https://github.com/lostisland/faraday/security/advisories/GHSA-98m9-hrrm-r99r |
| 79 | + - https://github.com/advisories/GHSA-98m9-hrrm-r99r |
| 80 | + notes: | |
| 81 | + - cvss_v3 from GHSA |
| 82 | + - cve is reserved, but no cve at nvd.nist.gov, so no cvss_v2 or cvss_v4 |
| 83 | + - Removed a lot of text from description field. See reference for details. |
| 84 | +--- |
0 commit comments