{"id":"CVE-2022-39284","aliases":["CVE-2022-39284","GHSA-745p-r637-7vvp","BIT-CODEIGNITER-2022-39284"],"related":[],"kind":"vulnerability","state":"published","title":"Secure or HttpOnly flag set in Config\\Cookie is not reflected in Cookies issued in Codeigniter4","summary":"CodeIgniter is a PHP full-stack web framework. In versions prior to 4.2.7 setting `$secure` or `$httponly` value to `true` in `Config\\Cookie` is not reflected in `set_cookie()` or `Response::setCookie()`. As a result cookie values are erroneously exposed to scripts. It should be noted that this vulnerability does not affect session cookies. Users are advised to upgrade to v4.2.7 or later. Users unable to upgrade are advised to manually construct their cookies either by setting the options in code or by constructing Cookie objects. Examples of each workaround are available in the linked GHSA.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"CodeIgniter is a PHP full-stack web framework. In versions prior to 4.2.7 setting `$secure` or `$httponly` value to `true` in `Config\\Cookie` is not reflected in `set_cookie()` or `Response::setCookie()`. As a result cookie values are erroneously exposed to scripts. It should be noted that this vulnerability does not affect session cookies. Users are advised to upgrade to v4.2.7 or later. Users unable to upgrade are advised to manually construct their cookies either by setting the options in code or by constructing Cookie objects. Examples of each workaround are available in the linked GHSA.","source":"cvelist"},{"lang":"en","text":"### 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)","format":"markdown","source":"ghsa"},{"lang":"es","text":"CodeIgniter es un framework web PHP full-stack. En versiones anteriores a 4.2.7 el valor \"$secure\" o \"$httponly\" de \"true\" en \"Config\\Cookie\" no es reflejado en \"set_cookie()\" o \"Response::setCookie()\". Como resultado, los valores de las cookies son expuestas erróneamente a los scripts. Cabe destacar que esta vulnerabilidad no afecta a las cookies de sesión. Es recomendado a usuarios actualizar a versión 4.2.7 o posterior. A usuarios que no puedan actualizarse les es aconsejado que construyan manualmente sus cookies, ya sea al establecer las opciones en el código o construyendo objetos Cookie. Ejemplos de cada mitigación están disponibles en el enlace GHSA","source":"nvd"}],"published":"2022-10-06T00:00:00.000Z","modified":"2026-06-17T04:58:04.160Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N","score":2.6,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N","score":2.6,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:N/A:N","score":2.6,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N","score":4.3,"rating":"MEDIUM"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-665","CWE-732"],"affected":[{"ranges":[{"version":"< 4.2.7","status":"affected"}],"vendor":"codeigniter4","product":"CodeIgniter4","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.2.7"}],"ecosystem":"Packagist","package":"codeigniter4/framework","purl":"pkg:composer/codeigniter4/framework","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"4.0.0","fixed":"4.2.7"}],"vendor":"codeigniter","product":"codeigniter","cpe":"cpe:2.3:a:codeigniter:codeigniter:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.2.7"}],"ecosystem":"Bitnami","package":"codeigniter","purl":"pkg:bitnami/codeigniter","source":"bitnami"}],"references":[{"url":"https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-745p-r637-7vvp","tags":["mitigation","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/codeigniter4/CodeIgniter4/issues/6540","tags":["exploit","issue-tracking","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/codeigniter4/CodeIgniter4/pull/6544","tags":["patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://codeigniter4.github.io/userguide/helpers/cookie_helper.html#set_cookie","tags":["technical-description","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://codeigniter4.github.io/userguide/outgoing/response.html#CodeIgniter%5CHTTP%5CResponse::setCookie","tags":["technical-description","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies","tags":["technical-description","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-39284","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/FriendsOfPHP/security-advisories/blob/master/codeigniter4/framework/CVE-2022-39284.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/codeigniter4/CodeIgniter4","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-22T15:43:55.091Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-39284","url":"https://www.cve.org/CVERecord?id=CVE-2022-39284","licence":"CVE Terms of Use","modified":"2025-04-22T17:19:34.229Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-745p-r637-7vvp","url":"https://github.com/advisories/GHSA-745p-r637-7vvp","licence":"CC-BY-4.0","modified":"2024-02-16T08:04:07.612Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-39284","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-39284","licence":"Public domain","modified":"2026-06-17T04:58:04.160Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-CODEIGNITER-2022-39284","url":"https://osv.dev/vulnerability/BIT-CODEIGNITER-2022-39284","licence":"Apache-2.0","modified":"2024-03-06T11:25:28.861Z"}],"updatedAt":"2026-11-25T22:58:15.444Z","epss":{"score":0.01146,"percentile":0.67718,"date":"2026-12-02T12:00:21.000Z"}}