Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS0yYzgzLXdmdjMtcTI1Zs0Vmg

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown

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:

```
\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:

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.

Permalink: https://github.com/advisories/GHSA-2c83-wfv3-q25f
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS0yYzgzLXdmdjMtcTI1Zs0Vmg
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Critical
Classification: General
Published: about 3 years ago
Updated: 7 months ago


Identifiers: GHSA-2c83-wfv3-q25f
References: Repository: https://github.com/zestedesavoir/zmarkdown
Blast Radius: 0.0

Affected Packages

npm:rebber
Dependent packages: 3
Dependent repositories: 5
Downloads: 145 last month
Affected Version Ranges: < 5.2.1
Fixed in: 5.2.1
All affected versions: 0.0.2, 0.0.3, 0.0.4, 0.0.5, 0.0.6, 0.0.7, 0.0.8, 0.0.9, 0.0.10, 0.0.11, 0.0.12, 0.0.13, 0.0.14, 0.0.15, 0.0.16, 0.0.17, 0.0.18, 0.0.19, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 3.0.0, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 4.0.0, 4.0.2, 5.0.0, 5.1.0, 5.1.1, 5.1.2, 5.2.0
All unaffected versions: 5.2.1, 5.3.0, 5.4.0, 5.5.0