Junglewise Threat Intelligence

CVE-2026-41244: Mojic: Observable Timing Discrepancy in HMAC Verification

CVE-2026-41244 · Severity: medium · CVSS 4.7 · Published 2026-04-16

Vendors: npm.

Executive brief

Mojic is a library that encrypts and decrypts data by encoding it as emoji sequences. The library uses a non-constant-time string comparison to verify that encrypted files have not been tampered with, allowing attackers to forge valid HMAC signatures through timing analysis without knowing the decryption password. A successful attack could allow an attacker to inject malicious code into decrypted files.

Technical details

The vulnerability is an observable timing discrepancy (CWE-208) in the HMAC-SHA256 verification logic within lib/CipherEngine.js. The code uses a standard JavaScript inequality operator (!==) to compare the calculated HMAC digest with the footer signature, which short-circuits and returns immediately upon the first byte mismatch. An attacker can measure microsecond-level timing differences to determine how many leading bytes of their forged signature match the expected value, allowing byte-by-byte reconstruction of a valid HMAC without possession of the decryption key. The fix is to replace the comparison with Node.js's crypto.timingSafeEqual() function to enforce constant-time comparison. The vulnerability affects all versions up to and including 2.1.3, with a patch available in version 2.1.4.

Affected products

  • notamitgamer mojic <= 2.1.3

Timeline

  • 2026-04-16: disclosed
  • 2026-04-16: patched: patch version 2.1.4 released

References