GHSA-mwm8-39rw-8826 sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array
A use-after-free in sqlite3-ruby allows attackers to cause crashes or incorrect data processing by influencing TEXT or BLOB column sizes in multi-argument aggregates.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is GHSA-mwm8-39rw-8826?
GHSA-mwm8-39rw-8826 is an use after free vulnerability in sqlite3, published on 2 Oct 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
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).
Which versions are affected by GHSA-mwm8-39rw-8826?
2 open source packages ship an affected version, including sqlite3.
| Package | Affected | Fixed in |
|---|---|---|
sqlite3 RubyGems | From 1.4.0 | 2.9.6 |
sqlite3 RubyGems | From 1.4.0 | 2.9.6 |
How do I fix GHSA-mwm8-39rw-8826?
Upgrade sqlite3 to 2.9.6 or later.
Upgrade to the fixed version. These bugs are found with fuzzing and sanitisers and avoided by memory-safe languages. More about Use after free.
Is GHSA-mwm8-39rw-8826 being exploited?
There is no known exploitation of GHSA-mwm8-39rw-8826 in the wild and no public exploit code.