CVE-2022-40833: CodeIgniter SQL Injection Vulnerability

codeigniter Updated 02 Oct 2025

Summary

31/01/2024
Yes i
Critical
Not published

CVE-2022-40833: B.C. Institute of Technology CodeIgniter. Affects codeigniter across 5 version ranges.

>= 3.0-rc.0, <= 3.0-rc.0 >= 3.0-rc2.0, <= 3.0-rc2.0 >= 3.0-rc3.0, <= 3.0-rc3.0 >= 3.0.0, < 3.1.13 >= 3.0.0, <= 3.0.0

Fixed in 3.1.13. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

CodeIgniter is an open-source PHP web application framework that provides a simple and elegant toolkit for building web applications. It is widely used for its lightweight and flexible nature, making it a popular choice among developers. However, CodeIgniter versions up to 3.1.13 are vulnerable to SQL Injection attacks via the system\database\DB_query_builder.php or_where_in() function.

Vulnerability Detail

The SQL Injection vulnerability in CodeIgniter allows an attacker to manipulate SQL queries by injecting malicious SQL code into user-supplied input. This can lead to unauthorized access, data leakage, data manipulation, and even remote code execution. The vulnerability arises due to improper input validation and sanitization in the affected function, which allows an attacker to bypass security measures and execute arbitrary SQL statements.

How To Fix

Minimum fixed version

3.1.13

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can manually sanitize user input before using it in SQL queries. This can be achieved by using prepared statements or parameterized queries, which ensure that user-supplied data is treated as data and not executable code. Here is an example of using prepared statements in CodeIgniter:

$userId = $this->input->post('user_id');
$this->db->query('SELECT * FROM users WHERE id = ?', array($userId));

Conclusion

The CodeIgniter SQL Injection vulnerability (CVE-2022-40833) poses a significant risk to applications built on CodeIgniter versions up to 3.1.13. It is crucial for developers to upgrade to the latest version and implement proper input validation and sanitization techniques to prevent SQL Injection attacks. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for codeigniter →

Share this vulnerability

FAQ

CodeIgniter is an open-source PHP web application framework that provides a simple and elegant toolkit for building web applications. It is known for its lightweight and flexible nature, making it a popular choice among developers.

SQL Injection is a web security vulnerability that allows an attacker to manipulate SQL queries by injecting malicious SQL code into user-supplied input. This can lead to unauthorized access, data leakage, data manipulation, and even remote code execution.

The SQL Injection vulnerability in CodeIgniter arises due to improper input validation and sanitization in the system\database\DB_query_builder.php or_where_in() function. This allows an attacker to bypass security measures and execute arbitrary SQL statements.

The CodeIgniter SQL Injection vulnerability can lead to unauthorized access to sensitive data, data manipulation, data leakage, and even remote code execution. It poses a significant risk to the confidentiality, integrity, and availability of the affected application.

Developers can mitigate the CodeIgniter SQL Injection vulnerability by upgrading to the latest version of CodeIgniter (3.1.14 or later) that includes a patch for the vulnerability. It is also crucial to implement proper input validation and sanitization techniques to prevent SQL Injection attacks.

References

Related vulnerabilities

Recent vulnerabilities recorded for codeigniter.

How To Fix

Minimum fixed version

3.1.13

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback