Advisory

GHSA-4v37-24gm-h554

Also known as: BIT-codeigniter-2022-24712, CVE-2022-24712

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:

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2022-03-01 21:47 UTC
Modified
2023-12-06 01:02 UTC

Affected packages and fixes

codeigniter4/framework

Packagist · All systems

Affected

  • introduced 0, fixed 4.1.9 (ecosystem)

Fixed versions

4.1.9

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences