Advisory Database
  • Advisories
  • Dependency Scanning
  1. gem
  2. ›
  3. encoded_id-rails
  4. ›
  5. GMS-2023-3722

GMS-2023-3722: encoded_id-rails potential DOS vulnerability due to URIs with extremely long encoded IDs

October 24, 2023

Impact

The length of URIs and the various parts (eg path segments, query parameters) is usually limited by the webserver processing the incoming request. In the case of Puma the defaults are :

  • path segment length: 8192
  • Max URI length: 1024 * 12
  • Max query length: 1024 * 10

See https://github.com/puma/puma/blob/master/docs/compile_options.md

If too long Puma raises:

Puma caught this error: HTTP element REQUEST_PATH is longer than the (8192) allowed length (was 12503) (Puma::HttpParserError)

However due to the performance of hashids extremely long encoded IDs will consume a large amount of CPU and allocate a huge number of intermediate objects.

For example:

curl -vvv https://localhost.ssl:3000//dos?id=abcd-<'a' * 10077>

This causes the application to spend a huge amount of time decoding the ID and the allocation of > 200MB of objects.

Patches

Upgrade to 1.0.0.beta2

This introduces a new option to limit the length of IDs that can be decoded. A future release will also improve the performance and hugely reduce allocations in the underlying hashids implementation.

References

  • github.com/advisories/GHSA-3px7-jm2p-6h2c
  • github.com/stevegeek/encoded_id-rails/commit/afa495a77b8a21ad582611f9cdc2081dc4018b91
  • github.com/stevegeek/encoded_id-rails/security/advisories/GHSA-3px7-jm2p-6h2c

Code Behaviors & Features

Detect and mitigate GMS-2023-3722 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 1.0.0.beta2

Fixed versions

  • 1.0.0.beta2

Solution

Upgrade to version 1.0.0.beta2 or above.

Source file

gem/encoded_id-rails/GMS-2023-3722.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:15:00 +0000.