Cross-Site Scripting (XSS) in @github/paste-markdown (CVE-2021-37700)
Summary
Cross-site scripting in @github/paste-markdown (CVE-2021-37700). Confidential information can be exposed externally. Mitigation: upgrade to 0.3.4 or later.
Original description
The description as published by the source.
Impact
A self Cross-Site Scripting vulnerability exists in the @github/paste-markdown library. If the clipboard data contains the string ``, a div is dynamically created, and the clipboard content is copied into its innerHTML property without any sanitization, resulting in improper execution of JavaScript in the browser of the victim (the user who pasted the code). Users directed to copy text from a malicious website and paste it into pages that utilize this library are affected.
The following @github/paste-markdown code snippet is triggered when the user pastes something and the browser's clipboard data contains an entry whose content-type is text/HTML.
function generateText(transfer: DataTransfer): string | undefined {
if (Array.from(transfer.types).indexOf('text/html') === -1) return
let html = transfer.getData('text/html')
if (!//, '')
const el = document.createElement('div')
el.innerHTML = html
const tables = el.querySelectorAll('table')
for (const table of tables) {
if (table.closest('[data-paste-markdown-skip]')) {
table.replaceWith(new Text(table.textContent || ''))
}
const formattedTable = tableMarkdown(table)
table.replaceWith(new Text(formattedTable))
}
return el.innerHTML
}
Patches
A security patch was released in version 0.3.4.
Workarounds
A Content Security Policy that prevents unsafe-inline helps reduce the…
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2021-37700 has been found in @github/paste-markdown.
Confidential information can be exposed externally.
What to do: upgrade @github/paste-markdown to 0.3.4 or later.
If unsure, ask your IT team or search "@github/paste-markdown CVE-2021-37700" on the vendor's site.
CVE-2021-37700 (@github/paste-markdown) — CWE-79
Attack vector: remote (network-reachable) / unauthenticated
Patched: 0.3.4 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
Cross-site scripting (XSS) (CWE-79) exists in @github/paste-markdown.
Check the vendor advisory for the affected versions of @github/paste-markdown.
Severity: ?. Confidential information can be exposed externally.
Update to 0.3.4.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r '@github/paste-markdown' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r '@github/paste-markdown' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
@github/paste-markdownを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade @github/paste-markdown to 0.3.4ステージング環境で 0.3.4 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
References
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web npmjs.com