GHSA-4fqr-96q8-xrfx

Suggest an improvement
Source
https://github.com/advisories/GHSA-4fqr-96q8-xrfx
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-4fqr-96q8-xrfx/GHSA-4fqr-96q8-xrfx.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-4fqr-96q8-xrfx
Aliases
Published
2026-11-13T18:57:58Z
Modified
2026-11-13T19:15:05Z
Severity
  • 4.8 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N CVSS Calculator
Summary
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
Details

Summary

sqlite3-ruby cast Ruby string lengths (long) to int before passing them to SQLite. On 64-bit platforms, a string of 4 GiB (2^32 bytes) or larger had its length wrap, so SQLite saw only the first length mod 2^32 bytes. An attacker who controls the length of a SQL string could truncate the query, for example dropping a trailing WHERE clause. The affected paths are:

  • the SQL passed to Database#prepare, #execute, and related methods
  • String and Blob values passed to Statement#bind_param and related methods
  • String and Blob values returned from SQL functions and aggregates defined in Ruby (Database#create_function, #create_aggregate, and related methods)

sqlite3 v2.10.2 raises RangeError when any of these strings is longer than INT_MAX bytes.

Severity

The sqlite3-ruby maintainers have evaluated this as medium severity (CVSS 4.8). Exploitation requires an attacker to get at least 4 GiB into a single SQL string or bound value. Most deployments reject a request body that large before the application sees it, and the server must hold several copies of the string in memory.

A truncated bound value is only a prefix of the attacker's input, so the bind paths matter only where the application validated the full value. A truncated SQL string is more serious: when the attacker's input is inlined into the SQL, the clauses that follow it are dropped. If a dropped clause contained a bind placeholder, binding raises SQLite3::RangeException instead of running the query.

Mitigation

Upgrade to sqlite3 v2.10.2 or later.

As a workaround for earlier versions, reject SQL strings and bound values of 4 GiB or larger before passing them to sqlite3-ruby, or limit request body size well below 4 GiB.

Credit

This issue was responsibly reported by Luke Jahnke from elttam.

Database specific
{
    "cwe_ids": [
        "CWE-681"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-13T18:57:58Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
}
References

Affected packages

RubyGems / sqlite3

Package

Name
sqlite3
Purl
pkg:gem/sqlite3

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
2.10.2

Affected versions

0.*
0.0.0
0.0.1
0.0.2
0.0.3
0.0.4
0.0.5
0.0.6
0.0.7
0.0.8
0.1.0
0.1.1
1.*
1.3.3.beta.1
1.3.3
1.3.4
1.3.5
1.3.6
1.3.7
1.3.8
1.3.9
1.3.10
1.3.11
1.3.12
1.3.13
1.4.0
1.4.1
1.4.2
1.4.3
1.4.4
1.5.0.rc1
1.5.0.rc2
1.5.0
1.5.1
1.5.2
1.5.3
1.5.4
1.6.0.rc1
1.6.0.rc2
1.6.0
1.6.1
1.6.2
1.6.3
1.6.4
1.6.5.rc1
1.6.5
1.6.6
1.6.7
1.6.8
1.6.9
1.7.0
1.7.1
1.7.2
1.7.3
2.*
2.0.0
2.0.1
2.0.2
2.0.3
2.0.4
2.1.0.rc1
2.1.0.rc2
2.1.0.rc3
2.1.0
2.1.1
2.2.0
2.3.0
2.3.1
2.4.0
2.4.1
2.5.0.rc1
2.5.0
2.6.0
2.7.0
2.7.1
2.7.2
2.7.3
2.7.4
2.8.0
2.8.1
2.9.0
2.9.1
2.9.2.rc2
2.9.2
2.9.3
2.9.4
2.9.5
2.9.6
2.10.0
2.10.1

Database specific

last_known_affected_version_range
"<= 2.10.1"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-4fqr-96q8-xrfx/GHSA-4fqr-96q8-xrfx.json"