XSS (Cross-Site Scripting) dans sanitize (CVE-2020-4054)
Résumé
XSS dans sanitize (CVE-2020-4054). Risque d'opérations non autorisées ou de divulgation. Exploitable via math. Atténuation : mise à jour vers 5.2.1 ou plus.
Description d'origine
La description telle que publiée par la source (souvent en anglais).
When HTML is sanitized using Sanitize's "relaxed" config or a custom config that allows certain elements, some content in a or element may not be sanitized correctly even if math and svg are not in the allowlist.
You are likely to be vulnerable to this issue if you use Sanitize's relaxed config or a custom config that allows one or more of the following HTML elements:
iframemathnoembednoframesnoscriptplaintextscriptstylesvgxmp
Impact
Using carefully crafted input, an attacker may be able to sneak arbitrary HTML through Sanitize, potentially resulting in XSS (cross-site scripting) or other undesired behavior when that HTML is rendered in a browser.
Releases
This problem has been fixed in Sanitize 5.2.1.
Workarounds
If upgrading is not possible, a workaround is to override the default value of Sanitize's :remove_contents config option with the following value, which ensures that the contents of math and svg elements (among others) are removed entirely when those elements are not in the allowlist:
%w[iframe math noembed noframes noscript plaintext script style svg xmp]
For example, if you currently use Sanitize's relaxed config, you can create a custom config object that overrides the default value of :remove_contents like this:
custom_config = Sanitize::Config.merge(
Sanitize::Config::RELAXED,
:remove_contents => %w[iframe math noembed noframes noscript plaintext sc…
Source: OSV.dev (Open Source Vulnerabilities) NVD GitHub Advisory OSV
Résumé généré automatiquement
Assemblé par SecPulse à partir des données sources (CVSS, CWE, versions affectées) à l'aide de modèles, sans IA. Vérifiez la description d'origine et les références ci-dessous.
Une vulnérabilité référencée CVE-2020-4054 a été découverte dans sanitize.
Des attaquants peuvent cibler un point d'entrée spécifique comme math à distance pour détourner le produit.
Risque d'opérations non autorisées ou de divulgation.
Action : mettez à jour sanitize vers 5.2.1 ou supérieur.
En cas de doute, contactez votre service informatique ou cherchez « sanitize CVE-2020-4054 » sur le site de l'éditeur.
CVE-2020-4054 (sanitize) — CWE-79
Vecteur d'attaque : distant (réseau) / non authentifié / sans interaction utilisateur
Surface d'attaque : math / svg / iframe / noembed
Correctif : 5.2.1 — appliquer immédiatement
Plan : 1) Audit SBOM, 2) Mise à jour staging→prod, 3) Surveillance WAF/proxy sur les endpoints affectés, 4) Recherche d'IOC dans les logs.
Réfs : voir GHSA / avis éditeur / version corrigée liés sur cette page.
Une XSS (CWE-79) affecte sanitize. Les attaquants atteignent le code vulnérable via math sans authentification.
Consultez l'avis de l'éditeur pour les versions affectées de sanitize. Surface d'attaque : math / svg / iframe / noembed.
Gravité : ?. Risque d'opérations non autorisées ou de divulgation.
Mettre à jour vers 5.2.1.
En attendant le correctif : désactivez la fonctionnalité concernée, appliquez des règles WAF, ou restreignez l'accès par ACL réseau.
Recherchez dans les logs des requêtes correspondant aux IOC connus de cette CVE. Auditez les SBOM/dépendances.
Actions de réponse
Étapes concrètes et exemples de commandes que les équipes SOC/SRE doivent exécuter dans l'ordre
-
1Identify exposure identify
grep -r 'sanitize' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
sanitizeを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade sanitize to 5.2.1ステージング環境で 5.2.1 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Paquets affectés
Références
- advisory nvd.nist.gov
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web usn.ubuntu.com
- web debian.org