diff --git a/advisories/github-reviewed/2025/02/GHSA-j82m-pc2v-2484/GHSA-j82m-pc2v-2484.json b/advisories/github-reviewed/2025/02/GHSA-j82m-pc2v-2484/GHSA-j82m-pc2v-2484.json new file mode 100644 index 00000000000..7382137b7bb --- /dev/null +++ b/advisories/github-reviewed/2025/02/GHSA-j82m-pc2v-2484/GHSA-j82m-pc2v-2484.json @@ -0,0 +1,68 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-j82m-pc2v-2484", + "modified": "2025-02-06T17:16:27Z", + "published": "2025-02-06T17:16:27Z", + "aliases": [ + "CVE-2025-24981" + ], + "summary": "Parsed HTML anchor links in Markdown provided to parseMarkdown can result in XSS in @nuxtjs/mdc", + "details": "### Summary\nAn unsafe parsing logic of the URL from markdown can lead to arbitrary JavaScript code due to a bypass to the existing guards around the `javascript:` protocol scheme in the URL.\n\n### Details\n\nThe parsing logic implement at [https://github.com/nuxt-modules/mdc/blob/main/src/runtime/parser/utils/props.ts#L16](https://github.com/nuxt-modules/mdc/blob/main/src/runtime/parser/utils/props.ts#L16) maintains a deny-list approach to filtering potential malicious payload. It does so by matching protocol schemes like `javascript:` and others.\n\nSpecifically, this is the code from the mdc library's parser that is not secure enough:\n\n```js\nexport const unsafeLinkPrefix = [\n 'javascript:',\n 'data:text/html',\n 'vbscript:',\n 'data:text/javascript',\n 'data:text/vbscript',\n 'data:text/css',\n 'data:text/plain',\n 'data:text/xml'\n]\n\nexport const validateProp = (attribute: string, value: string) => {\n if (attribute.startsWith('on')) {\n return false\n }\n\n if (attribute === 'href' || attribute === 'src') {\n return !unsafeLinkPrefix.some(prefix => value.toLowerCase().startsWith(prefix))\n }\n\n return true\n}\n```\n\nThese security guards can be bypassed by an adversarial that provides JavaScript URLs with HTML entities encoded via hex string.\n\n### PoC\n\nThe following URL payloads if provided to the markdown parsing library (such as through the usage of `import { parseMarkdown } from '@nuxtjs/mdc/runtime';`) will trigger the alert() dialog:\n\n```markdown\n# ✅ This is correctly escaped by the parser\n\n- XSS Attempt:\n\n this gets sanitizied, yay!\n\n# ❌ These are vulnerable and not escaped\n\n- Bypass 1:\n\nClick Me 1\n\n- Bypass 2:\n\nClick Me 2\n\n- Bypass 3:\n\nClick Me 3\n```\n\n### Impact\n\nUsers who consume this library and perform markdown parsing from unvalidated sources such as LLM generative text responses, user input and other untrusted sources could result in rendering vulnerable XSS anchor links.\n\n## Reference\n\nYou may infer the following write-up for more in-depth walkthrough of URL parsing problems and suggestions on how to securely address them: [How to Parse URLs from Markdown to HTML Securely?](https://www.nodejs-security.com/blog/how-to-parse-urls-from-markdown-to-html-securely)", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:L" + } + ], + "affected": [ + { + "package": { + "ecosystem": "npm", + "name": "@nuxtjs/mdc" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "0.13.3" + } + ] + } + ], + "database_specific": { + "last_known_affected_version_range": "<= 0.13.2" + } + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/nuxt-modules/mdc/security/advisories/GHSA-j82m-pc2v-2484" + }, + { + "type": "WEB", + "url": "https://github.com/nuxt-modules/mdc/commit/99097738b5561639e9bf247c55d8103236618bf3" + }, + { + "type": "PACKAGE", + "url": "https://github.com/nuxt-modules/mdc" + }, + { + "type": "WEB", + "url": "https://github.com/nuxt-modules/mdc/blob/main/src/runtime/parser/utils/props.ts#L16" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-79" + ], + "severity": "CRITICAL", + "github_reviewed": true, + "github_reviewed_at": "2025-02-06T17:16:27Z", + "nvd_published_at": null + } +} \ No newline at end of file