CVE-2022-24712: CodeIgniter4 Cross-Site Request Forgery (CSRF) Protection Bypass

codeigniter Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2022-24712: CodeIgniter4 is the 4.x branch of CodeIgniter, a PHP full-stack web framework. Affects codeigniter versions >= 4.0.0, < 4.1.9. Fixed in 4.1.9. How to fix ↓

Also tracked for

The same CVE-2022-24712 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

CodeIgniter4 is a PHP full-stack web framework and the 4.x branch of CodeIgniter. It provides developers with a set of tools and libraries for building web applications. The framework includes features such as routing, database access, and security mechanisms like Cross-Site Request Forgery (CSRF) protection. However, versions prior to 4.1.9 are vulnerable to a bypass in the CSRF protection mechanism.

Vulnerability Detail

The vulnerability in CodeIgniter4 versions prior to 4.1.9 allows remote attackers to bypass the CSRF protection. This can lead to unauthorized actions being performed on behalf of authenticated users, potentially compromising the security and integrity of the application. The vulnerability arises due to a lack of proper validation of the request method in the controller method. Attackers can exploit this by crafting malicious requests that bypass the CSRF protection.

How To Fix

Minimum fixed version

4.1.9

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

If auto-routing is enabled, developers should check the request method in the controller method before processing. This can be done by using conditional statements to validate the request method. For example, in PHP, developers can use the $_SERVER['REQUEST_METHOD'] variable to check the request method and proceed accordingly. If auto-routing is disabled, developers can either avoid using $routes->add() and instead use HTTP verbs in routes, or check the request method in the controller method before processing.

Conclusion

The vulnerability in CodeIgniter4 versions prior to 4.1.9 allows for the bypass of the CSRF protection mechanism, potentially leading to unauthorized actions and compromising the application's security. Users should upgrade to version 4.1.9 and review their code to ensure proper validation of the request method. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for codeigniter →

Share this vulnerability

FAQ

CodeIgniter4 is a PHP full-stack web framework that provides developers with tools and libraries for building web applications.

Cross-Site Request Forgery (CSRF) is an attack that tricks the victim into submitting a malicious request. It can lead to unauthorized actions being performed on behalf of the victim.

The CSRF protection bypass vulnerability in CodeIgniter4 versions prior to 4.1.9 occurs due to a lack of proper validation of the request method in the controller method. Attackers can exploit this by crafting malicious requests that bypass the CSRF protection.

The potential consequences of this vulnerability include unauthorized actions being performed on behalf of authenticated users, compromising the security and integrity of the application.

To fix this vulnerability, upgrade to CodeIgniter4 version 4.1.9 and ensure that the request method is properly checked in the controller method.

Related vulnerabilities

Recent vulnerabilities recorded for codeigniter.

How To Fix

Minimum fixed version

4.1.9

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