CVE-2022-21680
Inefficient Regular Expression Complexity in marked
Description
Impact
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.
Patches
Has the problem been patched?
Yes
What versions should users upgrade to?
4.0.10
Workarounds
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.
References
Are there any links users can visit to find out more?
- https://marked.js.org/using_advanced#workers
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
For more information
If you have any questions or comments about this advisory:
- Open an issue in marked
Affected Maven artifacts (3)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| org.mvnpm » markedvia npm marked | < 4.0.10 | 4.0.10 |
| org.webjars » markedvia npm marked | < 4.0.10 | 4.0.10 |
| org.webjars.npm » markedvia npm marked | < 4.0.10 | 4.0.10 |
Blast radius
67% of the dependent artifacts (19) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 47 |
| 2 hops | 56 |
| 3 hops | 6 |
Most used dependents
- net.aequologica.neo » geppaequo-tags15 usages
- com.graphql-java » graphiql-spring-boot-starter11 usages
- net.aequologica.neo » geppaequo-web7 usages
- org.webjars.npm » openlayers4 usages
- org.webjars.npm » graphiql4 usages
- net.aequologica.neo » quintessence-core4 usages
- net.aequologica.neo » dagr-vebchar2 usages
- net.aequologica.neo » buildhub-persist2 usages
- net.aequologica.neo » quintessence-web2 usages
- net.aequologica.neo » shakuntala-doc2 usages
- net.aequologica.neo » tuhao-core2 usages
- net.aequologica.neo » buildhub-vebchar2 usages
- de.smartsquare » squit1 usages
- com.graphql-java » graphiql-spring-boot-autoconfigure1 usages
- net.aequologica.neo » dagr-web1 usages
Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
Other ecosystems
Also affects npm (1 package) . See all on OSV
References
| Advisory | NVD CVE-2022-21680 | nvd.nist.gov |
| Package | markedjs/marked | github.com |
| Web | markedjs/marked advisory GHSA-rrrm-qjm4-v8hf | github.com |
| Web | markedjs/marked commit c4a3ccd | github.com |
| Web | markedjs/marked release v4.0.10 | github.com |
| Web | archives/list/package-announce@lists.fedoraproject.org/message/AIXDMC3CSHYW3YWVSQOXAWLUYQH ... | lists.fedoraproject.org |
