CVE-2022-40825: CodeIgniter SQL Injection Vulnerability
Summary
CVE-2022-40825: 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 ↓
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.
No signup required · Results in about 60 seconds
Background
CodeIgniter is an open-source PHP web application framework that provides a simple and elegant toolkit for creating full-featured web applications. It is widely used for its lightweight nature, speed, and ease of use. However, versions up to 3.1.13 of CodeIgniter are vulnerable to SQL Injection attacks through the where_in() function in the system\database\DB_query_builder.php file.
Vulnerability Detail
The SQL Injection vulnerability in CodeIgniter allows an attacker to manipulate SQL queries by injecting malicious input. This can lead to unauthorized access, data leakage, data manipulation, and potentially complete compromise of the application and underlying database. The vulnerability arises due to insufficient input validation and sanitization in the where_in() function, which allows an attacker to craft specially crafted input to 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 and validate user input before using it in SQL queries. This can be done by using appropriate functions or libraries to escape special characters and ensure that only valid input is used in queries. However, this approach is error-prone and may not provide complete protection against all possible attack vectors. Therefore, upgrading to the latest version of CodeIgniter is strongly recommended.
Conclusion
The SQL Injection vulnerability in CodeIgniter can have serious consequences for the security and integrity of web applications. It is crucial to promptly upgrade to the latest version of CodeIgniter and follow secure coding practices to mitigate the risk of SQL Injection attacks. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for codeigniter →
FAQ
CodeIgniter is an open-source PHP web application framework known for its lightweight nature, speed, and ease of use. It provides a simple and elegant toolkit for creating full-featured web applications.
SQL Injection is a type of security vulnerability that allows an attacker to manipulate SQL queries by injecting malicious input. This can lead to unauthorized access, data leakage, and data manipulation.
The SQL Injection vulnerability in CodeIgniter allows an attacker to execute arbitrary SQL statements, potentially leading to unauthorized access, data leakage, and complete compromise of the application and underlying database.
To fix the SQL Injection vulnerability, it is recommended to upgrade to CodeIgniter version 3.1.14 or later. The latest version includes a patch that addresses the vulnerability. Additionally, developers should follow secure coding practices, such as using prepared statements or parameterized queries.
As a temporary workaround, developers can manually sanitize and validate user input before using it in SQL queries. However, this approach is error-prone and may not provide complete protection. Upgrading to the latest version of CodeIgniter is strongly recommended.
References
Related vulnerabilities
Recent vulnerabilities recorded for codeigniter.