CVE-2022-25898: Jsrsasign JWS And JWT Signature Validation Vulnerability
HIGHCVE-2022-25898 is a HIGH (CVSS 8.6) jws and jwt signature validation vulnerability (CWE-347: Improper Verification of Cryptographic Signature) affecting Jsrsasign libraries in the npm ecosystem. The issue involves jws and jwt signature validation vulnerability with special characters. Remediation is available by upgrading affected packages to version 10.5.25.
CVE-2022-25898 at a Glance
Security Impact
CVSS: 8.6
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:C/C:N/I:H/A:N).
How to Fix CVE-2022-25898
To remediate this vulnerability, upgrade all affected Jsrsasign dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install jsrsasign@10.5.25
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls jsrsasign
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-25898, inspect your project dependencies using npm:
npm ls jsrsasign
Analyze the terminal output to locate any version of Jsrsasign in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.5.25), your application is affected.
Note: The npm ls jsrsasign command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-347: Improper Verification of Cryptographic Signature, where the product does not verify, or incorrectly verifies, the cryptographic signature for data. In Jsrsasign, 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-25898 Affected Jsrsasign Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
jsrsasign
|
npm |
≥ 4.8.0
< 10.5.25
|
10.5.25
|
References
Frequently Asked Questions
What is CVE-2022-25898?
Which Jsrsasign versions are affected?
What version fixes CVE-2022-25898?
Is jsrsasign affected?
What is the CVSS score of CVE-2022-25898?
What CWE is associated with CVE-2022-25898?
How can I check npm dependencies for CVE-2022-25898?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3fvg-4v2m-98jf",
"modified" : "2022-07-05T21:25:54Z",
"published" : "2022-06-25T07:19:06Z",
"aliases" : [ "CVE-2022-25898" ],
"summary" : "JWS and JWT signature validation vulnerability with special characters",
"details" : "### Impact\n\nJsrsasign supports JWS(JSON Web Signatures) and JWT(JSON Web Token) validation. However JWS or JWT signature with non Base64URL encoding special characters or number escaped characters may be validated as valid by mistake.\n\nFor example, even if a string of non Base64URL encoding characters such as `!@$%` or `\\11` is inserted into a valid JWS or JWT signature value string, it will still be a valid JWS or JWT signature by mistake.\n\nWhen jsrsasign's JWS or JWT validation is used in OpenID connect or OAuth2, this vulnerability will affect to authentication or authorization.\n\nBy our internal assessment, CVSS 3.1 score will be 8.6.\nCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N\n\n### Patches\nUsers validate JWS or JWT signatures should upgrade to 10.5.25.\n\n### Workarounds\nValidate JWS or JWT signature if it has Base64URL and dot safe string before\nexecuting JWS.verify() or JWS.verifyJWT() method.\n\n### ACKNOWLEDGEMENT\n\nThanks to Adi Malyanker and Or David for this vulnerability report. Also thanks for [Snyk security team](https://snyk.io/) for this coordination.\n\n### References\nhttps://github.com/kjur/jsrsasign/releases/tag/10.5.25\nhttps://github.com/kjur/jsrsasign/security/advisories/GHSA-3fvg-4v2m-98jf kjur's advisories\nhttps://github.com/advisories/GHSA-3fvg-4v2m-98jf github advisories\nhttps://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-25898\nhttps://kjur.github.io/jsrsasign/api/symbols/KJUR.jws.JWS.html#.verifyJWT\nhttps://kjur.github.io/jsrsasign/api/symbols/KJUR.jws.JWS.html#.verify\nhttps://kjur.github.io/jsrsasign/api/symbols/global__.html#.isBase64URLDot\nhttps://github.com/kjur/jsrsasign/wiki/Tutorial-for-JWS-verification\nhttps://github.com/kjur/jsrsasign/wiki/Tutorial-for-JWT-verification\nhttps://security.snyk.io/vuln/SNYK-JS-JSRSASIGN-2869122\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "jsrsasign"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.8.0"
}, {
"fixed" : "10.5.25"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-25898"
}, {
"type" : "WEB",
"url" : "https://github.com/kjur/jsrsasign/commit/4536a6e9e8bcf1a644ab7c07ed96e453347dae41"
}, {
"type" : "WEB",
"url" : "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-25898"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/kjur/jsrsasign"
}, {
"type" : "WEB",
"url" : "https://github.com/kjur/jsrsasign/releases/tag/10.5.25"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWER-2935898"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSBOWERGITHUBKJUR-2935897"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-2935896"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-JSRSASIGN-2869122"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-347" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-25T07:19:06Z",
"nvd_published_at" : "2022-07-01T20:15:00Z"
}
}