CVE-2026-63221: CodeIgniter: SQL injection in Query Builder deleteBatch() when used with where() conditions

Published Jul 31, 2026
·
Updated

Impact A SQL injection vulnerability exists in the Query Builder's deleteBatch() method. When deleteBatch() is used together with where() conditions, the bound values from the WHERE clause are substituted directly into the generated SQL with their escape flag ignored, so they are never escaped or quoted. If an application passes user-controlled input to where() before calling deleteBatch(), that input is interpreted as SQL rather than as a value, allowing SQL injection.

This affects only the deleteBatch() code path. Regular delete() operations escape where() binds correctly.

Patches Upgrade to v4.7.4 or later.

Workarounds If you cannot upgrade immediately:

- Strictly validate and cast values (e.g. numeric IDs) before using them in conditions - though this does not fully protect string conditions. - Do not pass user-controlled input to where() when using deleteBatch(). - For user-controlled conditions, use a normal delete() with Query Builder binds instead of deleteBatch(). - Where possible, express required matching values through the batch data and onConstraint() rather than as separate user-controlled where() clauses.

Other sources

CodeIgniter is a PHP full-stack web framework. From 4.3.0 through 4.7.3, Query Builder deleteBatch() substitutes bound values from where() conditions into generated SQL while ignoring their escape flags, allowing user-controlled condition values to be interpreted as SQL. This affects only the deleteBatch() code path. Regular delete() operations escape where() binds correctly. This issue is fixed in version 4.7.4.

— MITRE

CodeIgniter: SQL injection in Query Builder deleteBatch() when used with where() conditions

— Packagist

Affected Software

3 affected componentsFixes available
CodeIgniter Codeigniter>=4.3.0<=4.7.3
composer/codeigniter4/framework>=4.3.0<4.7.4
4.7.4
composer/codeigniter4/framework>=4.3.0, <4.7.4
4.7.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/codeigniter4/framework to a version that resolves this vulnerability.

    Fixed in 4.7.4
  2. Upgrade

    Upgrade CodeIgniter to a version that resolves this vulnerability.

    Fixed in 4.7.4
  3. Compensating control

    Until upgrading, do not pass user-controlled input to where() when using deleteBatch(); use a normal delete() with Query Builder binds instead. Strictly validate and cast values, such as numeric IDs, before using them in conditions, and where possible express required matching values through the batch data and onConstraint() rather than separate user-controlled where() clauses.

Event History

Jul 31, 2026
CVE Published
via MITRE·04:03 AM
Data Sourced
via MITRE·04:03 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 AM
DescriptionSeverityWeakness
Aug 7, 2026
Advisory Published
via GitHub·06:22 PM
Data Sourced
via GitHub·06:22 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·06:22 PM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-63221?

CVE-2026-63221 has a critical severity level of 9.4.

2

How does CVE-2026-63221 affect CodeIgniter?

CVE-2026-63221 allows SQL injection via Query Builder deleteBatch() when used with unsafe where() conditions.

3

What versions of CodeIgniter are impacted by CVE-2026-63221?

CodeIgniter versions 4.3.0 through 4.7.3 are affected by CVE-2026-63221.

4

How do I fix CVE-2026-63221?

To fix CVE-2026-63221, upgrade to CodeIgniter version 4.7.4 or later.

5

What type of vulnerability is CVE-2026-63221 classified as?

CVE-2026-63221 is classified as an SQL Injection vulnerability.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203