Junglewise Threat Intelligence

CVE-2021-30246: kjur jsrsasign RSA signature validation bypass in PKCS#1 v1.5 padding

CVE-2021-30246 · Severity: low · CVSS 3.1 · Published 2021-04-16

Technologies: jsrsasign (npm). Vendors: npm.

Executive brief

The jsrsasign library, a popular JavaScript tool for cryptography and digital signatures, contains a vulnerability in how it validates RSA signatures. This flaw could allow an attacker to provide a specially crafted signature that is incorrectly accepted as valid, potentially leading to unauthorized access or the bypass of security checks. While the library is widely used for web security and tokens, creating a successful exploit is considered difficult in practice.

Technical details

A vulnerability exists in jsrsasign versions prior to 10.2.0 where the RSA signature validation (RSASSA-PKCS1-v1_5) fails to strictly verify the length and structure of PKCS#1.5 padding. Specifically, the library does not sufficiently check that the decoded signature byte length matches the RSA key length, and it is overly lenient when parsing the block type and padding bytes (expecting 0x0001 followed by 0xFF padding). An attacker could potentially craft a malleable encoded message that bypasses signature verification. However, a practical attack remains difficult as it still requires finding hash collisions. The issue is addressed in version 10.2.0.

Affected products

  • kjur jsrsasign < 10.2.0

Timeline

  • 2021-04-07: advisory: NVD published CVE-2021-30246
  • 2021-04-13: patched: Version 10.2.0 released to fix the vulnerability
  • 2021-04-16: disclosed: GitHub Security Advisory published

References

Related threats