Vulnerabilities in pkg:npm/rebber

PACKAGE
Advisory Summary

GHSA-2c83-wfv3-q25f is a CRITICAL improper neutralization of special elements vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Rebber libraries in the npm ecosystem. The issue involves improper neutralization of special elements used in an os command ('os command injection') in zmarkdown. Remediation is available by upgrading affected packages to version 5.2.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/rebber

1 Known Advisory Record(s)

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

Advisory ID CVE / NVD Severity Summary
GHSA-2c83-wfv3-q25f - CRITICAL Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown

GHSA-2c83-wfv3-q25f at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-2c83-wfv3-q25f
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Rebber
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-2c83-wfv3-q25f

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

rebber fixed: 5.2.1
npm install rebber@5.2.1
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 rebber

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-2c83-wfv3-q25f, inspect your project dependencies using npm:

npm ls rebber

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

Note: The npm ls rebber 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-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Rebber, 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

### Impact A Remote Command Execution vulnerability was found in the rebber module, which allowed execution of arbitrary commands. The reported problem came from CodeBlocks, which could be escaped to insert malicious LaTeX. Anyone using `rebber` without sanitation of code content or a custom macro is impacted by this vulnerability. Here is an example of a Markdown content that will exploit the vulnerability: ````markdown ``` \end{CodeBlock} \immediate\write18{COMMAND > outputrce} \input{outputrce} \begin{CodeBlock}{text} ``` ```` Will insert into the generated LaTeX the result of executing `COMMAND` on the system. ### Patches The vulnerability has been patched in version 5.2.1. If impacted, you should update to this version as soon as possible. ### Workarounds It is possible to mitigate the vulnerability without upgrading by using a custom code macro. Please make sure this custom macro escapes your closing LaTeX sequence. For the example above, use: ```javascript const escaped = content.replace(new RegExp('\\\\end\\s*{CodeBlock}', 'g'), '') ``` ### For more information If you have any questions or comments about this advisory, open an issue in [ZMarkdown](https://github.com/zestedesavoir/zmarkdown/issues).

GHSA-2c83-wfv3-q25f Affected Rebber Versions

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

References

Frequently Asked Questions

What is GHSA-2c83-wfv3-q25f?
GHSA-2c83-wfv3-q25f is a security vulnerability in Rebber involving Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Rebber versions are affected?
Affected versions include releases prior to 5.2.1 across affected packages: rebber.
What version fixes GHSA-2c83-wfv3-q25f?
Upgrading to 5.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rebber affected?
Yes, rebber is affected in releases prior to 5.2.1. Upgrade your dependency to 5.2.1 or later.
What CWE is associated with GHSA-2c83-wfv3-q25f?
GHSA-2c83-wfv3-q25f is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check npm dependencies for GHSA-2c83-wfv3-q25f?
Run the dependency tree command: 'npm ls rebber'. 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-2c83-wfv3-q25f",
  "modified" : "2021-09-07T14:04:47Z",
  "published" : "2021-09-07T23:07:56Z",
  "aliases" : [ ],
  "summary" : "Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown",
  "details" : "### Impact\n\nA Remote Command Execution vulnerability was found in the rebber module,\nwhich allowed execution of arbitrary commands. The reported problem came\nfrom CodeBlocks, which could be escaped to insert malicious LaTeX.\n\nAnyone using `rebber` without sanitation of code content or a custom\nmacro is impacted by this vulnerability. Here is an example of a Markdown\ncontent that will exploit the vulnerability:\n\n````markdown\n```\n\\end{CodeBlock}\n\n\\immediate\\write18{COMMAND > outputrce}\n\\input{outputrce}\n\n\\begin{CodeBlock}{text}\n```\n````\n\nWill insert into the generated LaTeX the result of executing\n`COMMAND` on the system.\n\n### Patches\n\nThe vulnerability has been patched in version 5.2.1.\nIf impacted, you should update to this version as soon as possible.\n\n### Workarounds\n\nIt is possible to mitigate the vulnerability without upgrading by using a\ncustom code macro. Please make sure this custom macro escapes your\nclosing LaTeX sequence. For the example above, use:\n\n```javascript\nconst escaped = content.replace(new RegExp('\\\\\\\\end\\\\s*{CodeBlock}', 'g'), '')\n```\n\n### For more information\n\nIf you have any questions or comments about this advisory, open an issue in [ZMarkdown](https://github.com/zestedesavoir/zmarkdown/issues).",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "rebber"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/zestedesavoir/zmarkdown/security/advisories/GHSA-2c83-wfv3-q25f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/zestedesavoir/zmarkdown"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-09-07T14:04:47Z",
    "nvd_published_at" : null
  }
}