Vulnerabilities in pkg:gem/sqlite3
PACKAGEGHSA-mwm8-39rw-8826 is a MODERATE use-after-free vulnerability (CWE-416: Use After Free) affecting sqlite3-ruby libraries in the RubyGems ecosystem. The issue involves use-after-free in sqlite aggregate arguments in heap-allocated argument array. Remediation is available by upgrading affected packages to version 2.9.6.
pkg:gem/sqlite3
Vulnerability advisories affecting package pkg:gem/sqlite3. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-mwm8-39rw-8826 | - | MODERATE | sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array |
| GHSA-j7fr-3v8c-3qc3 | CVE-2026-54620 | LOW | sqlite3-ruby has Use-After-Free in SQLite Aggregate Function Callbacks |
| GHSA-28hh-pr2h-2w89 | CVE-2026-54619 | LOW | sqlite3-ruby has Use-After-Free When Redefining SQLite Functions with Different Arity |
| GHSA-mgvv-5mxp-xq67 | - | LOW | SQLite3 addresses vulnerability in packaged version of libsqlite |
GHSA-mwm8-39rw-8826 at a Glance
How to Fix GHSA-mwm8-39rw-8826
To remediate this vulnerability, upgrade all affected sqlite3-ruby dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade sqlite3 to 2.9.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for sqlite3
How to Check if You Are Affected
To determine whether your application is affected by GHSA-mwm8-39rw-8826, inspect your project dependencies for sqlite3-ruby:
inspect dependencies for sqlite3
Analyze the terminal output to locate any version of sqlite3-ruby in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.9.6), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-416: Use After Free, where the product reuses or references memory after it has been freed. at some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. any operations using the original pointer are no longer valid because the memory "belongs" to the code that operates on the new pointer. In sqlite3-ruby, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-mwm8-39rw-8826 Affected sqlite3-ruby Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
sqlite3
|
RubyGems |
≥ 1.4.0
< 2.9.6
|
2.9.6
|
References
Frequently Asked Questions
What is GHSA-mwm8-39rw-8826?
Which sqlite3-ruby versions are affected?
What version fixes GHSA-mwm8-39rw-8826?
Is sqlite3 affected?
What CWE is associated with GHSA-mwm8-39rw-8826?
How can I check RubyGems dependencies for GHSA-mwm8-39rw-8826?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mwm8-39rw-8826",
"modified" : "2026-10-02T23:11:51Z",
"published" : "2026-10-02T23:11:51Z",
"aliases" : [ ],
"summary" : "sqlite3-ruby: Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array",
"details" : "## 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)).",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "sqlite3"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.4.0"
}, {
"fixed" : "2.9.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.9.5"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mwm8-39rw-8826"
}, {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/sqlite3-ruby/pull/733"
}, {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/sqlite3-ruby/commit/cc5ac0cdf05af8148f4363410da0ba32508d9c97"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/sparklemotion/sqlite3-ruby"
}, {
"type" : "WEB",
"url" : "https://github.com/sparklemotion/sqlite3-ruby/releases/tag/v2.9.6"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-416" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-02T23:11:51Z",
"nvd_published_at" : null
}
}