Skip to main content

CVE-2022-21647: CWE-502: Deserialization of Untrusted Data in codeigniter4 CodeIgniter4

Medium
Published: Tue Jan 04 2022 (01/04/2022, 20:05:11 UTC)
Source: CVE
Vendor/Project: codeigniter4
Product: CodeIgniter4

Description

CodeIgniter is an open source PHP full-stack web framework. Deserialization of Untrusted Data was found in the `old()` function in CodeIgniter4. Remote attackers may inject auto-loadable arbitrary objects with this vulnerability, and possibly execute existing PHP code on the server. We are aware of a working exploit, which can lead to SQL injection. Users are advised to upgrade to v4.1.6 or later. Users unable to upgrade as advised to not use the `old()` function and form_helper nor `RedirectResponse::withInput()` and `redirect()->withInput()`.

AI-Powered Analysis

AILast updated: 06/23/2025, 18:48:40 UTC

Technical Analysis

CVE-2022-21647 is a security vulnerability identified in CodeIgniter4, an open-source PHP full-stack web framework widely used for developing web applications. The vulnerability stems from the deserialization of untrusted data within the `old()` function. Deserialization is the process of converting data from a format suitable for storage or transmission back into an object or data structure. When untrusted data is deserialized without proper validation or sanitization, it can lead to the injection of malicious objects. In this case, remote attackers can exploit this vulnerability by injecting auto-loadable arbitrary PHP objects, potentially enabling them to execute existing PHP code on the server. This can escalate to critical attacks such as SQL injection, where attackers manipulate database queries to extract, modify, or delete sensitive data. The vulnerability affects all versions of CodeIgniter4 prior to 4.1.6. The exploit does not require authentication but does require the application to use the vulnerable `old()` function or related helpers such as `form_helper`, `RedirectResponse::withInput()`, or `redirect()->withInput()`. The vendor has released version 4.1.6 and later to address this issue. Users unable to upgrade are advised to avoid using the vulnerable functions to mitigate risk. Although no known exploits are currently active in the wild, the existence of a working exploit and the potential for severe impact make this vulnerability a significant concern for affected applications.

Potential Impact

For European organizations, the impact of this vulnerability can be substantial, especially for those relying on CodeIgniter4 in their web applications. Successful exploitation could lead to unauthorized code execution, enabling attackers to perform SQL injection attacks that compromise the confidentiality, integrity, and availability of critical data. This could result in data breaches involving personal data protected under GDPR, financial loss, reputational damage, and operational disruption. Organizations in sectors such as finance, healthcare, government, and e-commerce are particularly at risk due to the sensitive nature of their data and regulatory requirements. Additionally, compromised web applications could be used as pivot points for further network intrusion or to distribute malware. The medium severity rating reflects the need for timely remediation to prevent exploitation, especially since the vulnerability does not require authentication and can be triggered remotely. The risk is heightened for organizations that have not updated to the patched version or continue to use the vulnerable functions in legacy codebases.

Mitigation Recommendations

1. Immediate upgrade to CodeIgniter4 version 4.1.6 or later is the most effective mitigation to eliminate the vulnerability. 2. For organizations unable to upgrade promptly, audit all codebases to identify and remove usage of the vulnerable `old()` function, `form_helper`, `RedirectResponse::withInput()`, and `redirect()->withInput()` methods. 3. Implement strict input validation and sanitization on all user-supplied data to reduce the risk of malicious payloads reaching deserialization routines. 4. Employ Web Application Firewalls (WAFs) with custom rules to detect and block suspicious serialized payloads or unusual request patterns targeting these functions. 5. Conduct thorough code reviews and penetration testing focused on deserialization and SQL injection vectors. 6. Monitor application logs for anomalies indicating attempted exploitation, such as unusual object injection patterns or SQL errors. 7. Educate development teams about secure coding practices related to serialization and deserialization to prevent similar vulnerabilities in the future. 8. Where possible, isolate web application environments and limit database permissions to minimize the impact of a potential compromise.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2021-11-16T00:00:00.000Z
Cisa Enriched
true

Threat ID: 682d9842c4522896dcbf221b

Added to database: 5/21/2025, 9:09:22 AM

Last enriched: 6/23/2025, 6:48:40 PM

Last updated: 8/1/2025, 10:04:38 AM

Views: 11

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats