{"id":"CVE-2022-21681","aliases":["CVE-2022-21681","GHSA-5v2h-r2cx-5xgj"],"related":[],"kind":"vulnerability","state":"published","title":"Exponential catastrophic backtracking (ReDoS) in marked","summary":"Marked is a markdown parser and compiler. Prior to version 4.0.10, the regular expression `inline.reflinkSearch` may cause catastrophic backtracking against some strings and lead to a denial of service (DoS). Anyone who runs untrusted markdown through a vulnerable version of marked and does not use a worker with a time limit may be affected. This issue is patched in version 4.0.10. As a workaround, avoid running untrusted markdown through marked or run marked on a worker thread and set a reasonable time limit to prevent draining resources.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Marked is a markdown parser and compiler. Prior to version 4.0.10, the regular expression `inline.reflinkSearch` may cause catastrophic backtracking against some strings and lead to a denial of service (DoS). Anyone who runs untrusted markdown through a vulnerable version of marked and does not use a worker with a time limit may be affected. This issue is patched in version 4.0.10. As a workaround, avoid running untrusted markdown through marked or run marked on a worker thread and set a reasonable time limit to prevent draining resources.","source":"cvelist"},{"lang":"en","text":"### Impact\n\n_What kind of vulnerability is it?_\n\nDenial of service.\n\nThe regular expression `inline.reflinkSearch` may cause catastrophic backtracking against some strings.\nPoC is the following.\n\n```javascript\nimport * as marked from 'marked';\n\nconsole.log(marked.parse(`[x]: x\n\n\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](\\\\[\\\\](`));\n```\n\n_Who is impacted?_\n\nAnyone who runs untrusted markdown through marked and does not use a worker with a time limit.\n\n### Patches\n\n_Has the problem been patched?_\n\nYes\n\n_What versions should users upgrade to?_\n\n4.0.10\n\n### Workarounds\n\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nDo not run untrusted markdown through marked or run marked on a [worker](https://marked.js.org/using_advanced#workers) thread and set a reasonable time limit to prevent draining resources.\n\n### References\n\n_Are there any links users can visit to find out more?_\n\n- https://marked.js.org/using_advanced#workers\n- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n\n* Open an issue in [marked](https://github.com/markedjs/marked)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Marked es un analizador y compilador de markdown. En versiones anteriores a 4.0.10, la expresión regular \"inline.reflinkSearch\" podía causar un retroceso catastrófico contra algunas cadenas y conllevar a una denegación de servicio (DoS). Cualquiera que ejecute markdown no confiable mediante una versión vulnerable de marked y no use un trabajador con límite de tiempo puede verse afectado. Este problema está parcheado en la versión 4.0.10. Como medida de mitigación, evite ejecutar markdown no confiable mediante marked o ejecute marked en un hilo de trabajo y establezca un límite de tiempo razonable para evitar el agotamiento de los recursos","source":"nvd"}],"published":"2022-01-14T00:00:00.000Z","modified":"2026-09-10T03:49:10.576Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:N/I:N/A:P","score":5,"rating":"MEDIUM"}],"cwes":["CWE-400","CWE-1333"],"affected":[{"ranges":[{"version":"< 4.0.10","status":"affected"}],"vendor":"markedjs","product":"marked","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"4.0.10"}],"ecosystem":"npm","package":"marked","purl":"pkg:npm/marked","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"4.0.10"}],"vendor":"marked_project","product":"marked","cpe":"cpe:2.3:a:marked_project:marked:*:*:*:*:*:node.js:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"36"}],"vendor":"fedoraproject","product":"fedora","cpe":"cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/markedjs/marked/security/advisories/GHSA-5v2h-r2cx-5xgj","tags":["exploit","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/markedjs/marked/commit/8f806573a3f6c6b7a39b8cdb66ab5ebb8d55a5f5","tags":["patch","third-party-advisory","web","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AIXDMC3CSHYW3YWVSQOXAWLUYQHAO5UX/","tags":["vendor-advisory","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-21681","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/markedjs/marked/commit/c4a3ccd344b6929afa8a1d50ac54a721e57012c0","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/markedjs/marked","tags":["package"],"sources":["ghsa"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/AIXDMC3CSHYW3YWVSQOXAWLUYQHAO5UX","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-04-22T15:42:21.459Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-21681","url":"https://www.cve.org/CVERecord?id=CVE-2022-21681","licence":"CVE Terms of Use","modified":"2025-04-22T18:33:29.916Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5v2h-r2cx-5xgj","url":"https://github.com/advisories/GHSA-5v2h-r2cx-5xgj","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:10.576Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-21681","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-21681","licence":"Public domain","modified":"2026-06-17T04:26:45.093Z"}],"updatedAt":"2026-11-25T22:58:09.248Z","epss":{"score":0.02893,"percentile":0.87287,"date":"2026-12-01T12:00:22.000Z"}}