Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS00djM3LTI0Z20taDU1NM0vgg

Cross-Site Request Forgery (CSRF) Protection Bypass Vulnerability in CodeIgniter4

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:

Permalink: https://github.com/advisories/GHSA-4v37-24gm-h554
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS00djM3LTI0Z20taDU1NM0vgg
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: over 2 years ago
Updated: almost 2 years ago


CVSS Score: 6.3
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:H/A:L

Identifiers: GHSA-4v37-24gm-h554, CVE-2022-24712
References: Repository: https://github.com/codeigniter4/CodeIgniter4
Blast Radius: 21.0

Affected Packages

packagist:codeigniter4/framework
Dependent packages: 257
Dependent repositories: 2,160
Downloads: 2,363,629 total
Affected Version Ranges: < 4.1.9
Fixed in: 4.1.9
All affected versions: 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 4.1.7, 4.1.8
All unaffected versions: 4.1.9, 4.2.0, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.2.5, 4.2.6, 4.2.7, 4.2.8, 4.2.9, 4.2.10, 4.2.11, 4.2.12, 4.3.0, 4.3.1, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7, 4.3.8, 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.4.4, 4.4.5, 4.4.6, 4.4.7, 4.4.8, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.5.4, 4.5.5