GHSA-4v37-24gm-h554

Suggest an improvement
Source
https://github.com/advisories/GHSA-4v37-24gm-h554
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/03/GHSA-4v37-24gm-h554/GHSA-4v37-24gm-h554.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-4v37-24gm-h554
Aliases
Published
2022-03-01T21:47:28Z
Modified
2023-12-06T01:02:04.763497Z
Severity
  • 6.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L CVSS Calculator
Summary
Cross-Site Request Forgery (CSRF) Protection Bypass Vulnerability in CodeIgniter4
Details

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

  1. Check the request method in the controller method before processing.

E.g.:

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

        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

References

Affected packages

Packagist / codeigniter4/framework

Package

Name
codeigniter4/framework
Purl
pkg:composer/codeigniter4/framework

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
4.1.9

Affected versions

v4.*

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

4.*

4.0.0-rc.4
4.0.0