CVE-2022-39284: Codeigniter4/framework Codeigniter4's Secure Or HttpOnly Flag Vulnerability
LOWCVE-2022-39284 is a LOW (CVSS 2.6) codeigniter4's secure or httponly flag vulnerability (CWE-732: Incorrect Permission Assignment for Critical Resource) affecting Codeigniter4/framework libraries in the Packagist ecosystem. The issue involves codeigniter4's secure or httponly flag set in config\cookie is not reflected in cookies issued. Remediation is available by upgrading affected packages to version 4.2.7.
CVE-2022-39284 at a Glance
Security Impact
CVSS: 2.6
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N).
How to Fix CVE-2022-39284
To remediate this vulnerability, upgrade all affected Codeigniter4/framework dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade codeigniter4/framework to 4.2.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for codeigniter4/framework
How to Check if You Are Affected
To determine whether your application is affected by CVE-2022-39284, inspect your project dependencies for Codeigniter4/framework:
inspect dependencies for codeigniter4/framework
Analyze the terminal output to locate any version of Codeigniter4/framework in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.7), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-732: Incorrect Permission Assignment for Critical Resource, where the product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors. In Codeigniter4/framework, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-39284 Affected Codeigniter4/framework Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
codeigniter4/framework
|
Packagist |
< 4.2.7
|
4.2.7
|
References
Frequently Asked Questions
What is CVE-2022-39284?
Which Codeigniter4/framework versions are affected?
What version fixes CVE-2022-39284?
Is codeigniter4/framework affected?
What is the CVSS score of CVE-2022-39284?
What CWE is associated with CVE-2022-39284?
How can I check Packagist dependencies for CVE-2022-39284?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-745p-r637-7vvp",
"modified" : "2022-10-06T20:01:41Z",
"published" : "2022-10-06T20:01:41Z",
"aliases" : [ "CVE-2022-39284" ],
"summary" : "Codeigniter4's Secure or HttpOnly flag set in Config\\Cookie is not reflected in Cookies issued",
"details" : "### Impact\nSetting `$secure` or `$httponly` value to `true` in `Config\\Cookie` is not reflected in `set_cookie()` or `Response::setCookie()`.\n\n> **Note**\n> This vulnerability does not affect session cookies.\n\nThe following code does not issue a cookie with the secure flag even if you set `$secure = true` in `Config\\Cookie`.\n\n```php\nhelper('cookie');\n\n$cookie = [\n 'name' => $name,\n 'value' => $value,\n];\nset_cookie($cookie);\n// or\n$this->response->setCookie($cookie);\n```\n\n### Patches\nUpgrade to v4.2.7 or later.\n\n### Workarounds\n1. Specify the options explicitly.\n ```php\n helper('cookie');\n\n $cookie = [\n 'name' => $name,\n 'value' => $value,\n 'secure' => true,\n 'httponly' => true,\n ];\n set_cookie($cookie);\n // or\n $this->response->setCookie($cookie);\n ```\n2. Use Cookie object.\n ```php\n use CodeIgniter\\Cookie\\Cookie;\n\n helper('cookie');\n\n $cookie = new Cookie($name, $value);\n set_cookie($cookie);\n // or\n $this->response->setCookie($cookie);\n ```\n\n### References\n- https://codeigniter4.github.io/userguide/helpers/cookie_helper.html#set_cookie\n- https://codeigniter4.github.io/userguide/outgoing/response.html#CodeIgniter\\HTTP\\Response::setCookie\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [codeigniter4/CodeIgniter4](https://github.com/codeigniter4/CodeIgniter4/issues)\n* Email us at [SECURITY.md](https://github.com/codeigniter4/CodeIgniter4/blob/develop/SECURITY.md)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "codeigniter4/framework"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-745p-r637-7vvp"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-39284"
}, {
"type" : "WEB",
"url" : "https://github.com/codeigniter4/CodeIgniter4/issues/6540"
}, {
"type" : "WEB",
"url" : "https://github.com/codeigniter4/CodeIgniter4/pull/6544"
}, {
"type" : "WEB",
"url" : "https://codeigniter4.github.io/userguide/helpers/cookie_helper.html#set_cookie"
}, {
"type" : "WEB",
"url" : "https://codeigniter4.github.io/userguide/outgoing/response.html#CodeIgniter%5CHTTP%5CResponse::setCookie"
}, {
"type" : "WEB",
"url" : "https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/codeigniter4/framework/CVE-2022-39284.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/codeigniter4/CodeIgniter4"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-665", "CWE-732" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2022-10-06T20:01:41Z",
"nvd_published_at" : "2022-10-06T20:15:00Z"
}
}