CVE-2022-39284: CodeIgniter Cookie Misconfiguration

codeigniter Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2022-39284: CodeIgniter is a PHP full-stack web framework. Affects codeigniter versions >= 4.0.0, < 4.2.7. Fixed in 4.2.7. How to fix ↓

Also tracked for

The same CVE-2022-39284 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 Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

CodeIgniter is a PHP full-stack web framework that provides developers with a set of tools and libraries for building web applications. It offers features such as a powerful MVC architecture, database abstraction, and security mechanisms. However, in versions prior to 4.2.7, CodeIgniter is vulnerable to a misconfiguration in the handling of cookies. This vulnerability allows an attacker to access cookie values that should be protected, potentially leading to unauthorized access or data exposure. It is important for CodeIgniter users to be aware of this issue and take appropriate measures to mitigate the risk.

Vulnerability Detail

The vulnerability in CodeIgniter arises from the incorrect handling of the $secure and $httponly options in the Config\Cookie class. When these options are set to true, they should ensure that cookies are only sent over secure connections and are not accessible to client-side scripts. However, in affected versions, these options are not properly reflected in the set_cookie() and Response::setCookie() methods. As a result, cookie values are exposed to scripts, potentially allowing an attacker to steal sensitive information. It is important to note that this vulnerability does not affect session cookies, which are handled separately. CodeIgniter users are strongly advised to upgrade to version 4.2.7 or later to address this vulnerability.

How To Fix

Minimum fixed version

4.2.7

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 upgrading to the latest version of CodeIgniter is not immediately feasible, users can manually construct their cookies by setting the options in code or by using the Cookie objects. Here are examples of each workaround:

  1. Setting options in code:
$cookieConfig = new Config\Cookie();
$cookieConfig->secure = true;
$cookieConfig->httponly = true;

// Use the cookie config when setting the cookie
$cookie = new Cookie('cookie_name', 'cookie_value', $cookieConfig);

// Set the cookie
$cookie->set();
  1. Using Cookie objects:
$cookieConfig = new Config\Cookie();
$cookieConfig->secure = true;
$cookieConfig->httponly = true;

// Create a new Cookie object with the desired options
$cookie = new Cookie('cookie_name', 'cookie_value', $cookieConfig);

// Set the cookie
$cookie->set();

Conclusion

CodeIgniter users should take immediate action to address this vulnerability. Upgrading to version 4.2.7 or later is the recommended solution. If upgrading is not immediately feasible, users can apply the provided workarounds to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for codeigniter →

Share this vulnerability

FAQ

CodeIgniter is a PHP full-stack web framework that provides developers with a set of tools and libraries for building web applications. It follows the MVC architectural pattern and offers features such as database abstraction, security mechanisms, and a rich set of libraries for common tasks.

This vulnerability in CodeIgniter allows an attacker to access cookie values that should be protected. This can potentially lead to unauthorized access or exposure of sensitive information. It is important for CodeIgniter users to upgrade to the latest version or apply the recommended workarounds to mitigate the risk.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your CodeIgniter application is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) to the playground, and it will analyze your dependencies and alert you if any vulnerabilities are found.

No, this vulnerability only affects regular cookies. Session cookies, which are used to maintain session state, are handled separately and are not impacted by this issue.

The recommended workaround is to upgrade to the latest version of CodeIgniter. However, if immediate upgrade is not possible, users can manually construct their cookies by setting the options in code or by using the Cookie objects. Examples of each workaround are provided in the 'workaround' section.

Related vulnerabilities

Recent vulnerabilities recorded for codeigniter.

How To Fix

Minimum fixed version

4.2.7

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