CVE-2021-46743: Firebase/php jwt Firebase PHP-JWT Key/algorithm Type Confusion Vulnerability
CRITICALCVE-2021-46743 is a CRITICAL (CVSS 9.1) firebase php-jwt key/algorithm type confusion vulnerability (CWE-843: Access of Resource Using Incompatible Type ('Type Confusion')) affecting Firebase/php jwt libraries in the Packagist ecosystem. The issue involves firebase php-jwt key/algorithm type confusion. Remediation is available by upgrading affected packages to version 6.0.0.
CVE-2021-46743 at a Glance
Security Impact
CVSS: 9.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N).
How to Fix CVE-2021-46743
To remediate this vulnerability, upgrade all affected Firebase/php jwt 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 firebase/php-jwt to 6.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for firebase/php-jwt
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-46743, inspect your project dependencies for Firebase/php jwt:
inspect dependencies for firebase/php-jwt
Analyze the terminal output to locate any version of Firebase/php jwt in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.0.0), 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-843: Access of Resource Using Incompatible Type ('Type Confusion'), where the product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type. In Firebase/php jwt, 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-2021-46743 Affected Firebase/php jwt Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
firebase/php-jwt
|
Packagist |
< 6.0.0
|
6.0.0
|
References
Frequently Asked Questions
What is CVE-2021-46743?
Which Firebase/php jwt versions are affected?
What version fixes CVE-2021-46743?
Is firebase/php-jwt affected?
What is the CVSS score of CVE-2021-46743?
What CWE is associated with CVE-2021-46743?
How can I check Packagist dependencies for CVE-2021-46743?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-8xf4-w7qw-pjjw",
"modified" : "2023-02-17T14:26:38Z",
"published" : "2022-03-30T00:00:27Z",
"aliases" : [ "CVE-2021-46743" ],
"summary" : "Firebase PHP-JWT key/algorithm type confusion",
"details" : "In Firebase PHP-JWT before 6.0.0, an algorithm-confusion issue (e.g., RS256 / HS256) exists via the kid (aka Key ID) header, when multiple types of keys are loaded in a key ring. This allows an attacker to forge tokens that validate under the incorrect key. NOTE: this provides a straightforward way to use the PHP-JWT library unsafely, but might not be considered a vulnerability in the library itself.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "firebase/php-jwt"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "6.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-46743"
}, {
"type" : "WEB",
"url" : "https://github.com/firebase/php-jwt/issues/351"
}, {
"type" : "WEB",
"url" : "https://github.com/FriendsOfPHP/security-advisories/blob/master/firebase/php-jwt/CVE-2021-46743.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/firebase/php-jwt"
}, {
"type" : "WEB",
"url" : "https://github.com/firebase/php-jwt/releases/tag/v6.0.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-347", "CWE-843" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2023-02-17T14:26:38Z",
"nvd_published_at" : "2022-03-29T07:15:00Z"
}
}