GHSA-mwm8-39rw-8826: sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array
Summary Using Database#createaggregate, #createaggregatehandler, or Database#defineaggregator to define an aggregate function that takes two or more arguments, and then evaluating it over TEXT or BLOB column values, can free the Ruby objects holding those arguments while a later argument is still being converted, during ordinary garbage collection.
Published Oct 2, 2026
Affected packages
sqlite3
- Ecosystem
- RubyGems
- Affected
- >= 1.4.0, <= 2.9.5
- Fixed in
- 2.9.6
- Check
bundle info sqlite3
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Summary
Using Database#create_aggregate, #create_aggregate_handler, or Database#define_aggregator to define an aggregate function that takes two or more arguments, and then evaluating it over TEXT or BLOB column values, can free the Ruby objects holding those arguments while a later argument is still being converted, during ordinary garbage collection. The aggregate's step method then receives an incorrect object, or the process crashes with a segmentation fault.
Mitigation
Upgrade to sqlite3 gem v2.9.6 or later.
There is no reliable workaround. If you cannot upgrade, avoid defining aggregate functions that take two or more arguments. Restricting column value sizes is not a mitigation: smaller values make the defect fire less often but do not prevent it.
Severity
The sqlite3-ruby maintainers assess this as Medium severity (CVSS 4.0 score 6.3). It is reached through ordinary garbage collection without any unusual code structuring: an application is exposed whenever it evaluates a multi-argument aggregate over TEXT or BLOB values whose size an attacker can influence. The demonstrated impact is an incorrect value passed to the aggregate's step method, or a process crash; no controlled memory write or general denial-of-service exploit has been demonstrated.
Credits
Reported by Jeremy Daer (@jeremy).
Credited to jeremy.
References
- https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mwm8-39rw-8826
- https://github.com/sparklemotion/sqlite3-ruby/pull/733
- https://github.com/sparklemotion/sqlite3-ruby/commit/cc5ac0cdf05af8148f4363410da0ba32508d9c97
- https://github.com/sparklemotion/sqlite3-ruby/releases/tag/v2.9.6
- https://github.com/advisories/GHSA-mwm8-39rw-8826
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More RubyGems vulnerabilities
All RubyGems entriesCVE-2026-128084
sqlite3-ruby: Possible SQL query truncation when a string is 4 GiB or larger
medium4.8Nov 13, 2026CVE-2026-54619
sqlite3-ruby has Use-After-Free When Redefining SQLite Functions with Different Arity
low2.0Jul 28, 2026CVE-2026-54620
sqlite3-ruby has Use-After-Free in SQLite Aggregate Function Callbacks
low2.0Jul 28, 2026
