CVE-2026-119371: SQLite before 3.54.0 Stack Exhaustion via CTE Chain in selectExpander()
SQLite before 3.54.0 contains a stack exhaustion vulnerability that allows attackers to bypass the SQLITELIMITEXPRDEPTH nesting limit because common table expressions are not counted against it. Attackers can supply a WITH clause chaining tens of thousands of CTEs, via plain SQL or a view in an untrusted database file, causing unbounded selectExpander() recursion that crashes the process.
Other sources
SQLite before 3.54.0 Stack Exhaustion via CTE Chain in selectExpander()
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/sqlite3to a version that resolves this vulnerability.Fixed in 3.54.1-1 - Upgrade
Upgrade
bitnami/sqliteto a version that resolves this vulnerability.Fixed in 3.54.0 - Upgrade
Upgrade
azurelinux/sqliteto a version that resolves this vulnerability.Fixed in 3.44.0-5 - Upgrade
Upgrade
ubuntu/sqlite3to a version that resolves this vulnerability.Fixed in 3.46.1-9ubuntu0.5
Event History
Frequently Asked Questions
Who is exposed to this issue?
Applications using SQLite versions before 3.54.0 are exposed if they process attacker-supplied SQL or open untrusted SQLite database files that may contain views.
What does an attacker need to trigger the crash?
An attacker needs a way to provide SQL containing a WITH clause with tens of thousands of chained CTEs, either directly as SQL input or indirectly through a view stored in an untrusted database file. No privileges are required, but user interaction is required according to the supplied vector.
What is the impact of successful exploitation?
The chained CTEs cause unbounded recursion in selectExpander(), exhausting the stack and crashing the SQLite-using process. The provided impact metrics indicate availability impact only, with no stated confidentiality or integrity impact.
Does SQLITE_LIMIT_EXPR_DEPTH mitigate this issue?
No. The issue exists because common table expressions are not counted toward SQLITE_LIMIT_EXPR_DEPTH, allowing attackers to bypass that nesting limit.
What can be done if upgrading is not immediately possible?
Avoid executing untrusted SQL and avoid opening untrusted SQLite database files, particularly files that may contain attacker-controlled views. These are the identified delivery paths for the CTE chain.