{"id":"GHSA-4v37-24gm-h554","summary":"Cross-Site Request Forgery (CSRF) Protection Bypass Vulnerability in CodeIgniter4","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()) !== 'post') {\n            return $this-\u003eresponse-\u003esetStatusCode(405)-\u003esetBody('Method Not Allowed');\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()) !== 'post') {\n            return $this-\u003eresponse-\u003esetStatusCode(405)-\u003esetBody('Method Not Allowed');\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","aliases":["BIT-codeigniter-2022-24712","CVE-2022-24712"],"modified":"2023-12-06T01:02:04.763497Z","published":"2022-03-01T21:47:28Z","database_specific":{"github_reviewed_at":"2022-03-01T21:47:28Z","nvd_published_at":"2022-02-28T16:15:00Z","cwe_ids":["CWE-352"],"severity":"MODERATE","github_reviewed":true},"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"}],"affected":[{"package":{"name":"codeigniter4/framework","ecosystem":"Packagist","purl":"pkg:composer/codeigniter4/framework"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"4.1.9"}]}],"versions":["4.0.0","4.0.0-rc.4","v4.0.0-alpha.3","v4.0.0-alpha.4","v4.0.0-alpha.5","v4.0.0-beta.1","v4.0.0-beta.2","v4.0.0-beta.3","v4.0.0-beta.4","v4.0.0-rc.1","v4.0.0-rc.2","v4.0.0-rc.2.1","v4.0.0-rc.3","v4.0.1","v4.0.2","v4.0.3","v4.0.4","v4.0.5","v4.1.0","v4.1.1","v4.1.2","v4.1.3","v4.1.4","v4.1.5","v4.1.6","v4.1.7","v4.1.8"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/03/GHSA-4v37-24gm-h554/GHSA-4v37-24gm-h554.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L"}]}