Advisory · CVE-2026-142150
CodeIgniter4 SQL injection via named bind placeholders in the query builder
CodeIgniter4 before 4.7.6 substitutes named :name: bind placeholders across the entire SQL text, including values already escaped into string literals, letting a remote attacker who can inject a placeholder break out of a literal and execute arbitrary SQL. Scored CVSS 4.0 9.2 and CVSS 3.1 8.1. Fixed in 4.7.6.
- Vendor
- CodeIgniter
- Product
- CodeIgniter4
- Identifier / CWE
- CVE-2026-142150
CWE-89 - Action timing
- Immediate
Explain it like I’m five
CodeIgniter's query builder fills in blanks marked :name: in a SQL sentence. The bug is that it fills in blanks everywhere, even inside quoted text that was already made safe. An attacker who can slip a :name: marker into a query gets their own value written straight into the SQL, and the database runs it.
- 01Placeholder injected
An attacker gets a :name: placeholder into a subquery, union, escaped where() or having() string, deleteBatch() condition, or query fragment, while controlling that bind's value.
- 02Builder substitutes everywhere
Query::matchNamedBinds() substitutes named binds across the entire SQL text, including values already escaped into string literals.
- 03Literal escaped
The substituted value breaks out of the string literal it was supposed to stay inside.
- 04Arbitrary SQL runs
The attacker-controlled SQL executes against the application database.
What happened
CodeIgniter4 before 4.7.6 contains an SQL injection vulnerability in Query::matchNamedBinds(). The query builder substitutes named :name: bind placeholders across the entire SQL text, including values already escaped into string literals. A remote attacker who can inject a :name: placeholder into a subquery, union, escaped where() or having() string, deleteBatch() condition, or $db->query() fragment while controlling that bind’s value can break out of the literal and execute arbitrary SQL.
The flaw is scored CVSS 4.0 9.2 and CVSS 3.1 8.1. It affects CodeIgniter4 before 4.7.6, and is fixed in 4.7.6.
What to do
- Inventory PHP applications built on CodeIgniter4 and check the framework version.
- Upgrade affected applications to CodeIgniter4 4.7.6 or later.
- Audit application queries for places where user input can reach where(), having(), deleteBatch(), subqueries, or raw query fragments, since those are the injection points.
- Review database logs for unexpected statements, especially unions or stacked queries that do not match application behavior.
- Check for signs of data extraction or modification, and rotate database credentials if exposure cannot be excluded.
Management note
The escaping in this bug worked as designed and still lost: the placeholder substitution ran after the escaping and undid it. The framework upgrade is the fix, and the query audit matters because the vulnerable pattern is any place an attacker can plant a placeholder, not just the obvious search box.