ghsa-4v37-24gm-h554
Vulnerability from github
Impact
This vulnerability might allow remote attackers to bypass the CodeIgniter4 CSRF protection mechanism.
Patches
Upgrade to v4.1.9 or later.
Workarounds
These are workarounds for this vulnerability, but you will still need to code as these after upgrading to v4.1.9. Otherwise, the CSRF protection may be bypassed.
When Auto-Routing is Enabled
- Check the request method in the controller method before processing.
E.g.:
php
if (strtolower($this->request->getMethod()) !== 'post') {
return $this->response->setStatusCode(405)->setBody('Method Not Allowed');
}
When Auto-Routing is Disabled
Do one of the following:
1. Do not use $routes->add()
, and use HTTP verbs in routes.
2. Check the request method in the controller method before processing.
E.g.:
php
if (strtolower($this->request->getMethod()) !== 'post') {
return $this->response->setStatusCode(405)->setBody('Method Not Allowed');
}
References
For more information
If you have any questions or comments about this advisory: * Open an issue in codeigniter4/CodeIgniter4 * Email us at SECURITY.md
{ "affected": [ { "package": { "ecosystem": "Packagist", "name": "codeigniter4/framework" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "4.1.9" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2022-24712" ], "database_specific": { "cwe_ids": [ "CWE-352" ], "github_reviewed": true, "github_reviewed_at": "2022-03-01T21:47:28Z", "nvd_published_at": "2022-02-28T16:15:00Z", "severity": "MODERATE" }, "details": "### Impact\nThis vulnerability might allow remote attackers to bypass the CodeIgniter4 CSRF protection mechanism. \n\n### Patches\nUpgrade to v4.1.9 or later.\n\n### Workarounds\nThese are workarounds for this vulnerability, but **you will still need to code as these after upgrading to v4.1.9**.\nOtherwise, the CSRF protection may be bypassed.\n\n#### When Auto-Routing is Enabled\n1. Check the request method in the controller method before processing.\n\nE.g.:\n```php\n if (strtolower($this-\u003erequest-\u003egetMethod()) !== \u0027post\u0027) {\n return $this-\u003eresponse-\u003esetStatusCode(405)-\u003esetBody(\u0027Method Not Allowed\u0027);\n }\n```\n\n#### When Auto-Routing is Disabled\nDo one of the following:\n1. Do not use `$routes-\u003eadd()`, and [use HTTP verbs in routes](https://codeigniter4.github.io/userguide/incoming/routing.html#using-http-verbs-in-routes).\n2. Check the request method in the controller method before processing.\n\nE.g.:\n```php\n if (strtolower($this-\u003erequest-\u003egetMethod()) !== \u0027post\u0027) {\n return $this-\u003eresponse-\u003esetStatusCode(405)-\u003esetBody(\u0027Method Not Allowed\u0027);\n }\n```\n\n### References\n- [CodeIgniter4 CSRF protection](https://codeigniter4.github.io/userguide/libraries/security.html#cross-site-request-forgery-csrf)\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", "id": "GHSA-4v37-24gm-h554", "modified": "2022-03-01T21:47:28Z", "published": "2022-03-01T21:47:28Z", "references": [ { "type": "WEB", "url": "https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-4v37-24gm-h554" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-24712" }, { "type": "WEB", "url": "https://github.com/codeigniter4/CodeIgniter4/blob/7dc2ece32401ebde67122f7d2460efcaee7c352e/user_guide_src/source/changelogs/v4.1.9.rst" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L", "type": "CVSS_V3" } ], "summary": "Cross-Site Request Forgery (CSRF) Protection Bypass Vulnerability in CodeIgniter4" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.