{"id":"GHSA-4v37-24gm-h554","aliases":["BIT-codeigniter-2022-24712","CVE-2022-24712"],"title":"Cross-Site Request Forgery (CSRF) Protection Bypass Vulnerability in CodeIgniter4","titleSource":"OSV","descriptionSource":"OSV","declaredSeverity":"MODERATE","description":"### 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->request->getMethod()) !== 'post') {\n            return $this->response->setStatusCode(405)->setBody('Method Not Allowed');\n        }\n```\n\n#### When Auto-Routing is Disabled\nDo one of the following:\n1. Do not use `$routes->add()`, 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->request->getMethod()) !== 'post') {\n            return $this->response->setStatusCode(405)->setBody('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","severity":"medium","score":6.3,"published":"2022-03-01T21:47:28.000Z","modified":"2023-12-06T01:02:04.763Z","withdrawn":false,"knownExploited":false,"affected":[{"ecosystem":"Packagist","name":"codeigniter4/framework","sources":[{"name":"OSV · GHSA-4v37-24gm-h554","url":"https://osv.dev/vulnerability/GHSA-4v37-24gm-h554"}],"ranges":[{"events":[{"introduced":"0"},{"fixed":"4.1.9"}],"type":"ECOSYSTEM"}],"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"],"fixed":["4.1.9"]}],"sourceAffected":[],"references":["https://github.com/codeigniter4/CodeIgniter4/security/advisories/GHSA-4v37-24gm-h554","https://nvd.nist.gov/vuln/detail/CVE-2022-24712","https://github.com/codeigniter4/CodeIgniter4/blob/7dc2ece32401ebde67122f7d2460efcaee7c352e/user_guide_src/source/changelogs/v4.1.9.rst"],"sources":[{"name":"OSV","id":"GHSA-4v37-24gm-h554","modified":"2023-12-06T01:02:04.763497Z","url":"https://osv.dev/vulnerability/GHSA-4v37-24gm-h554"}],"assessments":[{"source":"OSV","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L","score":6.3}],"products":[],"remediation":[],"kev":{"status":"not-listed","checkedAt":"2026-10-28T16:00:31.263Z"},"coverage":[{"source":"NVD","status":"not-checked"},{"source":"GHSA","status":"not-checked"},{"source":"EUVD","status":"not-checked"},{"source":"EPSS","status":"not-checked"}],"evidence":[]}