{"id":"GHSA-mwm8-39rw-8826","title":"sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array","summary":"sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array","severity":"medium","cwe":["CWE-416"],"vendor":"sqlite3","product":"sqlite3","ecosystem":"rubygems","affected":["sqlite3 >= 1.4.0, <= 2.9.5"],"patched":["sqlite3 2.9.6"],"published":"2026-10-02","updated":"2026-10-02","sourceUpdated":"2026-10-02T23:11:52Z","source":"GHSA","sourceUrl":"https://github.com/advisories/GHSA-mwm8-39rw-8826","references":[{"url":"https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mwm8-39rw-8826"},{"url":"https://github.com/sparklemotion/sqlite3-ruby/pull/733"},{"url":"https://github.com/sparklemotion/sqlite3-ruby/commit/cc5ac0cdf05af8148f4363410da0ba32508d9c97"},{"url":"https://github.com/sparklemotion/sqlite3-ruby/releases/tag/v2.9.6"},{"url":"https://github.com/advisories/GHSA-mwm8-39rw-8826"}],"tags":["ghsa","rubygems"],"ingestedAt":"2026-10-02T23:34:57.394Z","slug":"GHSA-mwm8-39rw-8826","body":"## Overview\n\n## Summary\n\nUsing `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.\n\n## Mitigation\n\nUpgrade to sqlite3 gem v2.9.6 or later.\n\nThere 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.\n\n## Severity\n\nThe 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.\n\n## Credits\n\nReported by Jeremy Daer ([@jeremy](https://github.com/jeremy)).\n\n## Affected packages\n\n- `sqlite3 >= 1.4.0, <= 2.9.5`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `sqlite3 2.9.6`","depth":"sunlit","depthScore":28,"depthScoreParts":{"impact":27.5,"likelihood":0,"exploitation":0,"ransomware":0},"changes":[]}