Marked version 0.3.4 represents an incremental update to the popular markdown parsing library, building upon the foundation laid by version 0.3.3. Both versions share the same core description: "A markdown parser built for speed," emphasizing their efficiency in converting markdown text into HTML. Both versions also maintain the MIT license, providing developers with the freedom to use and modify the library in their projects. The author remains Christopher Jeffrey across both releases.
The key difference between the two versions lies in the development dependencies. Version 0.3.4 introduces several new devDependencies including "gulp", "gulp-concat" and "gulp-uglify", suggesting an enhancement in the build and deployment process. These packages are commonly used for automating tasks such as minification, concatenation meaning that the developers are now using a more structured process to build and deploy the package and that most likely the newer version includes minified code which brings advantages such as decreased payload sizes.
While both versions list "markdown," "showdown," and "robotskirt" as development dependencies, the absence of gulp-related tools in version 0.3.3 indicates a shift towards a more streamlined workflow in version 0.3.4. For developers using Marked, this change potentially translates to more efficient builds, smaller distribution sizes, and potentially improved performance – all valuable considerations when integrating a markdown parser into a project. Moreover, the updated release date from January to July suggests a period of active development and refinement.
All the vulnerabilities related to the version 0.3.4 of the package
Sanitization bypass using HTML Entities in marked
Affected versions of marked
are susceptible to a cross-site scripting vulnerability in link components when sanitize:true
is configured.
This flaw exists because link URIs containing HTML entities get processed in an abnormal manner. Any HTML Entities get parsed on a best-effort basis and included in the resulting link, while if that parsing fails that character is omitted.
For example:
A link URI such as
javascript֍ocument;alert(1)
Renders a valid link that when clicked will execute alert(1)
.
Update to version 0.3.6 or later.
Marked vulnerable to XSS from data URIs
marked version 0.3.6 and earlier is vulnerable to an XSS attack in the data: URI parser.
Regular Expression Denial of Service in marked
Affected versions of marked
are vulnerable to a regular expression denial of service.
The amplification in this vulnerability is significant, with 1,000 characters resulting in the event loop being blocked for around 6 seconds.
Update to version 0.3.9 or later.
Marked allows Regular Expression Denial of Service (ReDoS) attacks
Marked prior to version 0.3.17 is vulnerable to a Regular Expression Denial of Service (ReDoS) attack due to catastrophic backtracking in several regular expressions used for parsing HTML tags and markdown links. An attacker can exploit this vulnerability by providing specially crafted markdown input, such as deeply nested or repetitively structured brackets or tag attributes, which cause the parser to hang and lead to a Denial of Service.
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: