Cross-site Request Forgery (CSRF) Affecting lonnieezell/codeigniter-shield package, versions <1.0.0-beta.2


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.22% (61st percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-site Request Forgery (CSRF) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PHP-LONNIEEZELLCODEIGNITERSHIELD-2980288
  • published14 Aug 2022
  • disclosed14 Aug 2022
  • creditMarco Squarcina, Pedro Adão

Introduced: 14 Aug 2022

CVE-2022-35943  (opens in a new tab)
CWE-352  (opens in a new tab)

How to fix?

Upgrade lonnieezell/codeigniter-shield to version 1.0.0-beta.2 or higher.

Overview

lonnieezell/codeigniter-shield is an Authentication and Authorization package for CodeIgniter 4.

Affected versions of this package are vulnerable to Cross-site Request Forgery (CSRF) due to insecure implementation of authentication.

Note: This is exploitable whether Config\Security::$csrfProtection is 'cookie' or 'session' and also if Config\Security::$regenerate is true or false

The attacker must have direct (or indirect, e.g., XSS) control over a subdomain site (e.g., https://a.example.com/) of the target site (e.g., http://example.com/).

Workaround:

If it is not possible to upgrade to the fixed version:

  1. set Config\Security::$csrfProtection to 'session'

  2. remove old session data right after login (immediately after ID and password match)

  3. regenerate CSRF token right after login (immediately after ID and password match)

References

CVSS Scores

version 3.1