CVE-2022-39284: Codeigniter4/framework Codeigniter4's Secure Or HttpOnly Flag Vulnerability

LOW
Advisory Identifier: GHSA-745p-r637-7vvp
CVSS 2.6
CWE-732 CWE-665
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2022-39284
GHSA Identifier GHSA-745p-r637-7vvp
Severity LOW
CVSS v3.1 Base Score 2.6
CWE Classification CWE-732: Incorrect Permission Assignment for Critical Resource
Affected Product Codeigniter4/framework
Package Ecosystem Packagist
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (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.

codeigniter4/framework fixed: 4.2.7
Upgrade codeigniter4/framework to 4.2.7
Verify Direct and Transitive Dependencies

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

### Impact Setting `$secure` or `$httponly` value to `true` in `Config\Cookie` is not reflected in `set_cookie()` or `Response::setCookie()`. > **Note** > This vulnerability does not affect session cookies. The following code does not issue a cookie with the secure flag even if you set `$secure = true` in `Config\Cookie`. ```php helper('cookie'); $cookie = [ 'name' => $name, 'value' => $value, ]; set_cookie($cookie); // or $this->response->setCookie($cookie); ``` ### Patches Upgrade to v4.2.7 or later. ### Workarounds 1. Specify the options explicitly. ```php helper('cookie'); $cookie = [ 'name' => $name, 'value' => $value, 'secure' => true, 'httponly' => true, ]; set_cookie($cookie); // or $this->response->setCookie($cookie); ``` 2. Use Cookie object. ```php use CodeIgniter\Cookie\Cookie; helper('cookie'); $cookie = new Cookie($name, $value); set_cookie($cookie); // or $this->response->setCookie($cookie); ``` ### References - https://codeigniter4.github.io/userguide/helpers/cookie_helper.html#set_cookie - https://codeigniter4.github.io/userguide/outgoing/response.html#CodeIgniter\HTTP\Response::setCookie ### For more information If you have any questions or comments about this advisory: * Open an issue in [codeigniter4/CodeIgniter4](https://github.com/codeigniter4/CodeIgniter4/issues) * Email us at [SECURITY.md](https://github.com/codeigniter4/CodeIgniter4/blob/develop/SECURITY.md)

CVE-2022-39284 Affected Codeigniter4/framework Versions

1 component(s)
Fixed Versions:
4.2.7
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?
CVE-2022-39284 is a security vulnerability in Codeigniter4/framework involving Codeigniter4's Secure or HttpOnly flag set in Config\Cookie is not reflected in Cookies issued under CWE-732: Incorrect Permission Assignment for Critical Resource.
Which Codeigniter4/framework versions are affected?
Affected versions include releases prior to 4.2.7 across affected packages: codeigniter4/framework.
What version fixes CVE-2022-39284?
Upgrading to 4.2.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is codeigniter4/framework affected?
Yes, codeigniter4/framework is affected in releases prior to 4.2.7. Upgrade your dependency to 4.2.7 or later.
What is the CVSS score of CVE-2022-39284?
CVE-2022-39284 has a CVSS v3.1 base score of 2.6 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2022-39284?
CVE-2022-39284 is classified under CWE-732: Incorrect Permission Assignment for Critical Resource (The product specifies permissions for a security-critical resource in a way that allows that resource to be read or modified by unintended actors.).
How can I check Packagist dependencies for CVE-2022-39284?
Run the dependency tree command: 'inspect dependencies for codeigniter4/framework'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}