Vulnerabilities in pkg:npm/mojic

PACKAGE
Advisory Identifier: GHSA-wqq3-wfmp-v85g
Advisory Summary

CVE-2026-41244 is a MODERATE (CVSS 4.7) observable timing discrepancy vulnerability (CWE-208: Observable Timing Discrepancy) affecting Mojic libraries in the npm ecosystem. The issue involves observable timing discrepancy in hmac verification. Remediation is available by upgrading affected packages to version 2.1.4.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/mojic

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/mojic. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-wqq3-wfmp-v85g CVE-2026-41244 MODERATE Mojic: Observable Timing Discrepancy in HMAC Verification

CVE-2026-41244 at a Glance

CVE Identifier CVE-2026-41244
GHSA Identifier GHSA-wqq3-wfmp-v85g
Severity MODERATE
CVSS v3.1 Base Score 4.7
CWE Classification CWE-208: Observable Timing Discrepancy
Affected Product Mojic
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2026-41244

To remediate this vulnerability, upgrade all affected Mojic dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mojic fixed: 2.1.4
npm install mojic@2.1.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls mojic

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-41244, inspect your project dependencies using npm:

npm ls mojic

Analyze the terminal output to locate any version of Mojic in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.4), your application is affected.

Note: The npm ls mojic 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-208: Observable Timing Discrepancy, where two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not. In Mojic, 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

### Summary The `CipherEngine` in Mojic v2.1.3 uses a standard equality operator (`!==`) to verify the HMAC-SHA256 integrity seal during the decryption phase. This creates an Observable Timing Discrepancy (CWE-208), allowing a potential attacker to bypass the file integrity check via a timing attack. ### Details In `lib/CipherEngine.js`, the footer check validates the HMAC signature using a standard string comparison: `if (footerHex !== calcDigest) { ... }` Standard string comparisons in JavaScript short-circuit; they return `false` the moment a character mismatch occurs. Because the time taken to evaluate the comparison is proportional to the number of matching leading bytes, an attacker can measure the exact microseconds it takes for the engine to throw the `FILE_TAMPERED` error. By repeatedly altering the signature byte-by-byte and analyzing these minute timing differences, a malicious actor can theoretically forge a valid HMAC signature without possessing the decryption password. ### PoC The vulnerable implementation is located in `lib/CipherEngine.js`, within the `getDecryptStream()` flush method (approximately line 265): ```javascript // Vulnerable Code if (footerHex !== calcDigest) { this.emit('error', new Error("FILE_TAMPERED")); return; } ``` ### Recommended Remediation: Replace the standard equality operator with Node.js's built-in constant-time comparison utility, crypto.timingSafeEqual(). ```JavaScript // Remediated Code const footerBuffer = Buffer.from(footerHex, 'hex'); const calcBuffer = Buffer.from(calcDigest, 'hex'); if (footerBuffer.length !== calcBuffer.length || !crypto.timingSafeEqual(footerBuffer, calcBuffer)) { this.emit('error', new Error("FILE_TAMPERED")); return; } ``` ### Impact If successfully exploited, an attacker could tamper with the encrypted .mojic payload and forge a valid HMAC signature. This bypasses the integrity seal, tricking the decryption engine into processing maliciously injected emoji streams. Because the engine translates these emojis back into C keywords and raw data chunks, this could ultimately result in arbitrary Code Injection into the restored .c source code when an unsuspecting user decrypts the tampered file.

CVE-2026-41244 Affected Mojic Versions

1 component(s)
Fixed Versions:
2.1.4
Product / Package Ecosystem Affected Versions Fixed Version
mojic
npm
< 2.1.4
2.1.4

References

Frequently Asked Questions

What is CVE-2026-41244?
CVE-2026-41244 is a security vulnerability in Mojic involving Observable Timing Discrepancy in HMAC Verification under CWE-208: Observable Timing Discrepancy.
Which Mojic versions are affected?
Affected versions include releases prior to 2.1.4 across affected packages: mojic.
What version fixes CVE-2026-41244?
Upgrading to 2.1.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mojic affected?
Yes, mojic is affected in releases prior to 2.1.4. Upgrade your dependency to 2.1.4 or later.
What is the CVSS score of CVE-2026-41244?
CVE-2026-41244 has a CVSS v3.1 base score of 4.7 (MODERATE) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2026-41244?
CVE-2026-41244 is classified under CWE-208: Observable Timing Discrepancy (Two separate operations in a product require different amounts of time to complete, in a way that is observable to an actor and reveals security-relevant information about the state of the product, such as whether a particular operation was successful or not.).
How can I check npm dependencies for CVE-2026-41244?
Run the dependency tree command: 'npm ls mojic'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-wqq3-wfmp-v85g",
  "modified" : "2026-04-27T16:08:33Z",
  "published" : "2026-04-16T21:10:17Z",
  "aliases" : [ "CVE-2026-41244" ],
  "summary" : "Mojic: Observable Timing Discrepancy in HMAC Verification",
  "details" : "### Summary\nThe `CipherEngine` in Mojic v2.1.3 uses a standard equality operator (`!==`) to verify the HMAC-SHA256 integrity seal during the decryption phase. This creates an Observable Timing Discrepancy (CWE-208), allowing a potential attacker to bypass the file integrity check via a timing attack.\n\n### Details\nIn `lib/CipherEngine.js`, the footer check validates the HMAC signature using a standard string comparison:\n`if (footerHex !== calcDigest) { ... }`\n\nStandard string comparisons in JavaScript short-circuit; they return `false` the moment a character mismatch occurs. Because the time taken to evaluate the comparison is proportional to the number of matching leading bytes, an attacker can measure the exact microseconds it takes for the engine to throw the `FILE_TAMPERED` error. By repeatedly altering the signature byte-by-byte and analyzing these minute timing differences, a malicious actor can theoretically forge a valid HMAC signature without possessing the decryption password.\n\n### PoC\nThe vulnerable implementation is located in `lib/CipherEngine.js`, within the `getDecryptStream()` flush method (approximately line 265):\n\n```javascript\n// Vulnerable Code\nif (footerHex !== calcDigest) {\n    this.emit('error', new Error(\"FILE_TAMPERED\"));\n    return;\n}\n```\n\n### Recommended Remediation:\nReplace the standard equality operator with Node.js's built-in constant-time comparison utility, crypto.timingSafeEqual().\n\n```JavaScript\n// Remediated Code\nconst footerBuffer = Buffer.from(footerHex, 'hex');\nconst calcBuffer = Buffer.from(calcDigest, 'hex');\n\nif (footerBuffer.length !== calcBuffer.length || !crypto.timingSafeEqual(footerBuffer, calcBuffer)) {\n    this.emit('error', new Error(\"FILE_TAMPERED\"));\n    return;\n}\n```\n\n### Impact\nIf successfully exploited, an attacker could tamper with the encrypted .mojic payload and forge a valid HMAC signature. This bypasses the integrity seal, tricking the decryption engine into processing maliciously injected emoji streams. Because the engine translates these emojis back into C keywords and raw data chunks, this could ultimately result in arbitrary Code Injection into the restored .c source code when an unsuspecting user decrypts the tampered file.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mojic"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.1.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/notamitgamer/mojic/security/advisories/GHSA-wqq3-wfmp-v85g"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41244"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/notamitgamer/mojic"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-208" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-16T21:10:17Z",
    "nvd_published_at" : "2026-04-24T20:16:26Z"
  }
}