{"id":"GHSA-2c83-wfv3-q25f","aliases":[],"status":"published","title":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown","description":"### 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 \u003e 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).","facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-78"],"published":"2021-09-07T23:07:56Z","modified":"2024-04-29T09:19:35Z","fixes":[{"ecosystem":"npm","package":"rebber","fixed_in":["5.2.1"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"rebber","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"5.2.1"}]}]},{"source":"osv","ecosystem":"npm","package":"rebber","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"5.2.1"}]}]}],"references":[{"url":"https://github.com/zestedesavoir/zmarkdown/security/advisories/GHSA-2c83-wfv3-q25f","tags":["web"]},{"url":"https://github.com/advisories/GHSA-2c83-wfv3-q25f"},{"url":"https://github.com/zestedesavoir/zmarkdown","tags":["package"]}],"sources":{"ghsa":[{"id":"GHSA-2c83-wfv3-q25f","title":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown","description":"### 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 \u003e 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).","status":"published","published":"2021-09-07T23:07:56Z","modified":"2024-04-29T09:19:35Z","cwes":["CWE-78"],"updated_at":"2026-11-02T14:37:47.338362Z"}],"osv":[{"id":"GHSA-2c83-wfv3-q25f","title":"Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in ZMarkdown","description":"### 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 \u003e 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).","status":"published","published":"2021-09-07T23:07:56Z","modified":"2021-09-07T14:04:47Z","cwes":["CWE-78"],"updated_at":"2026-11-02T15:46:34.338541Z"}]}}
