CVE-2022-35943: Codeigniter4/shield CodeIgniter Shield Vulnerable To SameSite Vulnerability
MODERATECVE-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
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).
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.
Upgrade codeigniter4/shield to 1.0.0-beta.2
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
CVE-2022-35943 Affected Codeigniter4/shield Versions
1 component(s)| 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?
Which Codeigniter4/shield versions are affected?
What version fixes CVE-2022-35943?
Is codeigniter4/shield affected?
What is the CVSS score of CVE-2022-35943?
What CWE is associated with CVE-2022-35943?
How can I check Packagist dependencies for CVE-2022-35943?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}