# marked content injection in autolink

Source: https://junglewise.ai/threats/marked-content-injection-in-autolink-0c735c59  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2021-02-25. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: info · CVSS 0 · Published 2021-02-25

marked is a JavaScript library for converting Markdown to HTML. When mangling is disabled, the library fails to escape URLs in autolinks, allowing attackers to inject arbitrary HTML event handlers (such as onclick) into generated links. This can lead to cross-site scripting (XSS) attacks when user-supplied Markdown is rendered.

Technologies: [marked (npm)](https://junglewise.ai/threats/technologies/npm-marked). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Informational severity, with a CVSS score of 0, published 25 February 2021.

**Which products and versions are affected?** marked (npm) SEMVER:introduced=0,fixed=0.3.9.

**Is there a fix for This vulnerability?** Yes. marked (npm): upgrade to 0.3.9 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network.

**Am I affected?** Check whether you run marked (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- marked (npm): upgrade to 0.3.9 or later

  ```sh
  npm install marked@0.3.9
  ```


## Technical details

The vulnerability is an XSS injection in marked's autolink handling when the `mangle` option is set to false. The root cause is insufficient escaping of href attributes in generated anchor tags. When processing email autolinks (e.g., `<user@example.com>`), if mangling is disabled, the library does not properly escape special characters in the href target, allowing an attacker to break out of the href attribute and inject arbitrary HTML event handlers. The attack requires the attacker to control the Markdown input and the application to have mangling disabled. The fix escapes non-mangled hrefs to prevent the injection. Affected versions: 0.3.7 and earlier; fixed in 0.3.9.

## Affected products

- marked marked 0.3.7 and earlier

## Timeline

- 2017-08-15: disclosed: Issue #926 filed on GitHub
- 2019-06-05: patched: Reviewed and fixed in commit cb72584
- 2021-02-25: advisory: GHSA published

## References

- [https://github.com/markedjs/marked/issues/926](https://github.com/markedjs/marked/issues/926)
- [https://github.com/markedjs/marked/commit/cb72584c5d9d32ebfdbb99e35fb9b81af2b79686](https://github.com/markedjs/marked/commit/cb72584c5d9d32ebfdbb99e35fb9b81af2b79686)

## Related threats

- [marked Denial of Service via infinite recursion in tokenizer](https://junglewise.ai/threats/cve-2026-41680-marked-denial-of-service-via-infinite-recursion-in-tokenizer)
- [Marked Regular Expression Denial of Service (ReDoS)](https://junglewise.ai/threats/cve-2018-25110-marked-regular-expression-denial-of-service-redos)
- [marked Regular Expression Denial of Service in inline.reflinkSearch](https://junglewise.ai/threats/cve-2022-21681-marked-regular-expression-denial-of-service-in-inline)
- [marked ReDoS in block.def regular expression](https://junglewise.ai/threats/cve-2022-21680-marked-redos-in-block-def-regular-expression)
- [marked Regular Expression Denial of Service](https://junglewise.ai/threats/marked-regular-expression-denial-of-service-501371b1)
