Marked version 0.4.0 represents a minor version update from the previous stable release, 0.3.19, of this popular markdown parsing library known for its speed. Both versions maintain the core functionalty of transforming Markdown text into HTML, a crucial feature for developers building blogging platforms, documentation generators, or any application needing to display user-generated content formatted with Markdown. Key differences lie in the development dependencies. The 0.4.0 release introduces html-differ and eslint-plugin-vuln-regex-detector, enhancing testing and security analysis during development. It removes "jasmine2-custom-message":"^0.9.0".
Interestingly, while the newer version boasts added development tools, its unpacked size is slightly smaller (76469 bytes versus 80609 bytes), and fewer files are included in the distribution (17 vs 19), indicating potential optimizations or refactoring. Developers choosing between these versions should consider their specific needs. Version 0.4.0's added security checks with "eslint-plugin-vuln-regex-detector" and html-differ for better testing could be advantageous for projects prioritizing security and robust rendering. However, if backwards compatibility with very specific environments is paramount, or if the project relies on the exact file structure of version 0.3.19, sticking with the older version might be preferable, even if that version presents some risk from a vulnerabilities standpoint. Ultimately, both versions remain under the MIT license, ensuring flexibility for developers.
All the vulnerabilities related to the version 0.4.0 of the package
Marked ReDoS due to email addresses being evaluated in quadratic time
Versions of marked
from 0.3.14 until 0.6.2 are vulnerable to Regular Expression Denial of Service. Email addresses may be evaluated in quadratic time, allowing attackers to potentially crash the node process due to resource exhaustion.
Upgrade to version 0.6.2 or later.
Regular Expression Denial of Service in marked
Affected versions of marked
are vulnerable to Regular Expression Denial of Service (ReDoS). The _label
subrule may significantly degrade parsing performance of malformed input.
Upgrade to version 0.7.0 or later.
Inefficient Regular Expression Complexity in marked
What kind of vulnerability is it?
Denial of service.
The regular expression inline.reflinkSearch
may cause catastrophic backtracking against some strings.
PoC is the following.
import * as marked from 'marked';
console.log(marked.parse(`[x]: x
\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](\\[\\](`));
Who is impacted?
Anyone who runs untrusted markdown through marked and does not use a worker with a time limit.
Has the problem been patched?
Yes
What versions should users upgrade to?
4.0.10
Is there a way for users to fix or remediate the vulnerability without upgrading?
Do not run untrusted markdown through marked or run marked on a worker thread and set a reasonable time limit to prevent draining resources.
Are there any links users can visit to find out more?
If you have any questions or comments about this advisory:
Inefficient Regular Expression Complexity in marked
What kind of vulnerability is it?
Denial of service.
The regular expression block.def
may cause catastrophic backtracking against some strings.
PoC is the following.
import * as marked from "marked";
marked.parse(`[x]:${' '.repeat(1500)}x ${' '.repeat(1500)} x`);
Who is impacted?
Anyone who runs untrusted markdown through marked and does not use a worker with a time limit.
Has the problem been patched?
Yes
What versions should users upgrade to?
4.0.10
Is there a way for users to fix or remediate the vulnerability without upgrading?
Do not run untrusted markdown through marked or run marked on a worker thread and set a reasonable time limit to prevent draining resources.
Are there any links users can visit to find out more?
If you have any questions or comments about this advisory: