| Gói / sản phẩm | Phiên bản bị ảnh hưởng | Phiên bản đã vá |
|---|---|---|
| md-to-pdf | < 5.2.5 | 5.2.5 |
A Markdown front-matter block that contains JavaScript delimiter causes the JS engine in gray-matter library to execute arbitrary code in the Markdown to PDF converter process of md-to-pdf library, resulting in remote code execution.
md-to-pdf uses the gray-matter library to parse front-matter. Gray-matter exposes a JavaScript engine that, when enabled or triggered by certain front-matter delimiters (e.g. ---js or ---javascript), will evaluate the front-matter contents as JavaScript. If user-supplied Markdown is fed to md-to-pdf and the front-matter contains malicious JS, the converter process will execute that code.
const { mdToPdf } = require('md-to-pdf');
var payload = '---javascript\n((require("child_process")).execSync("calc.exe"))\n---RCE';
(async () => {
await mdToPdf({ content: payload }, { dest: './output.pdf'});
})();
Running the PoC on Windows launches the calculator application, demonstrating arbitrary code execution.
Bạn đang dùng một trong các sản phẩm này? Quét site để biết có đang lộ phiên bản có lỗ hổng không.
Quét site miễn phí