CVE-2022-35943: Codeigniter4/shield CodeIgniter Shield Vulnerable To SameSite Vulnerability

MODERATE
Advisory Identifier: GHSA-5hm8-vh6r-2cjq
CVSS 5.9
CWE-352
Published
Advisory Summary

CVE-2022-35943 is a MODERATE (CVSS 5.9) codeigniter shield vulnerable to samesite vulnerability (CWE-352: Cross-Site Request Forgery (CSRF)) affecting Codeigniter4/shield libraries in the Packagist ecosystem. The issue involves codeigniter shield vulnerable to samesite attackers bypassing the csrf protection. Remediation is available by upgrading affected packages to version 1.0.0-beta.2.

CVE-2022-35943 at a Glance

CVE Identifier CVE-2022-35943
GHSA Identifier GHSA-5hm8-vh6r-2cjq
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-352: Cross-Site Request Forgery (CSRF)
Affected Product Codeigniter4/shield
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability Low (A:L)

How to Fix CVE-2022-35943

To remediate this vulnerability, upgrade all affected Codeigniter4/shield dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

codeigniter4/shield fixed: 1.0.0-beta.2
Upgrade codeigniter4/shield to 1.0.0-beta.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for codeigniter4/shield

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-35943, inspect your project dependencies for Codeigniter4/shield:

inspect dependencies for codeigniter4/shield

Analyze the terminal output to locate any version of Codeigniter4/shield in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0-beta.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-352: Cross-Site Request Forgery (CSRF), where the web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor. In Codeigniter4/shield, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact This vulnerability may allow [SameSite Attackers](https://canitakeyoursubdomain.name/) to bypass the [CodeIgniter4 CSRF protection](https://codeigniter4.github.io/userguide/libraries/security.html) mechanism with CodeIgniter Shield. For this attack to succeed, 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/`). This vulnerability exists whether `Config\Security::$csrfProtection` is `'cookie'` or `'session'`. It is also exploitable whether `Config\Security::$regenerate` is `true` or `false`. ### Patches Upgrade to **CodeIgniter v4.2.3 or later** and **Shield v1.0.0-beta.2 or later**. ### Workarounds Do all of the following: - set `Config\Security::$csrfProtection` to `'session'` - remove old session data right after login (immediately after ID and password match) - regenerate CSRF token right after login (immediately after ID and password match) ### References - [CodeIgniter4 CSRF Protection](https://codeigniter4.github.io/userguide/libraries/security.html) - [SameSite Attacks](https://canitakeyoursubdomain.name/) - [SameSite Cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite) - [The great SameSite confusion](https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/) ### For more information If you have any questions or comments about this advisory: * Open an issue or discussion in [codeigniter4/shield](https://github.com/codeigniter4/shield) * Email us at [security@codeigniter.com](mailto:security@codeigniter.com)

CVE-2022-35943 Affected Codeigniter4/shield Versions

1 component(s)
Fixed Versions:
1.0.0-beta.2
Product / Package Ecosystem Affected Versions Fixed Version
codeigniter4/shield
Packagist
≥ 1.0.0-beta
< 1.0.0-beta.2
All 1 versions
1.0.0-beta
1.0.0-beta.2

References

Frequently Asked Questions

What is CVE-2022-35943?
CVE-2022-35943 is a security vulnerability in Codeigniter4/shield involving CodeIgniter Shield Vulnerable to SameSite Attackers Bypassing the CSRF Protection under CWE-352: Cross-Site Request Forgery (CSRF).
Which Codeigniter4/shield versions are affected?
Affected versions include releases prior to 1.0.0-beta.2 across affected packages: codeigniter4/shield.
What version fixes CVE-2022-35943?
Upgrading to 1.0.0-beta.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is codeigniter4/shield affected?
Yes, codeigniter4/shield is affected in releases prior to 1.0.0-beta.2. Upgrade your dependency to 1.0.0-beta.2 or later.
What is the CVSS score of CVE-2022-35943?
CVE-2022-35943 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L.
What CWE is associated with CVE-2022-35943?
CVE-2022-35943 is classified under CWE-352: Cross-Site Request Forgery (CSRF) (The web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor.).
How can I check Packagist dependencies for CVE-2022-35943?
Run the dependency tree command: 'inspect dependencies for codeigniter4/shield'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5hm8-vh6r-2cjq",
  "modified" : "2022-08-18T19:03:34Z",
  "published" : "2022-08-18T19:03:34Z",
  "aliases" : [ "CVE-2022-35943" ],
  "summary" : "CodeIgniter Shield Vulnerable to SameSite Attackers Bypassing the CSRF Protection",
  "details" : "### Impact\nThis vulnerability may allow [SameSite Attackers](https://canitakeyoursubdomain.name/) to bypass the [CodeIgniter4 CSRF protection](https://codeigniter4.github.io/userguide/libraries/security.html) mechanism with CodeIgniter Shield.\n\nFor this attack to succeed, 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/`).\n\nThis vulnerability exists whether `Config\\Security::$csrfProtection` is `'cookie'` or `'session'`.\nIt is also exploitable whether `Config\\Security::$regenerate` is `true` or `false`.\n\n### Patches\nUpgrade to **CodeIgniter v4.2.3 or later** and **Shield v1.0.0-beta.2 or later**.\n\n### Workarounds\nDo all of the following:\n- set `Config\\Security::$csrfProtection` to `'session'`\n- remove old session data right after login (immediately after ID and password match)\n- regenerate CSRF token right after login (immediately after ID and password match)\n\n### References\n- [CodeIgniter4 CSRF Protection](https://codeigniter4.github.io/userguide/libraries/security.html)\n- [SameSite Attacks](https://canitakeyoursubdomain.name/)\n- [SameSite Cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite)\n- [The great SameSite confusion](https://jub0bs.com/posts/2021-01-29-great-samesite-confusion/)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue or discussion in [codeigniter4/shield](https://github.com/codeigniter4/shield)\n* Email us at [security@codeigniter.com](mailto:security@codeigniter.com)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "codeigniter4/shield"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0-beta"
      }, {
        "fixed" : "1.0.0-beta.2"
      } ]
    } ],
    "versions" : [ "1.0.0-beta" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/codeigniter4/shield/security/advisories/GHSA-5hm8-vh6r-2cjq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-35943"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/codeigniter4/shield/commit/342a368536678621998c3c41d276480cd14ec6c6"
  }, {
    "type" : "WEB",
    "url" : "https://codeigniter4.github.io/userguide/libraries/security.htm"
  }, {
    "type" : "WEB",
    "url" : "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/codeigniter4/shield"
  }, {
    "type" : "WEB",
    "url" : "https://jub0bs.com/posts/2021-01-29-great-samesite-confusion"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-352" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-18T19:03:34Z",
    "nvd_published_at" : "2022-08-12T21:15:00Z"
  }
}