CVE-2026-48591: earmark Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-52mm-h59v-f3c7
CWE-79 CWE-83
Published
Advisory Summary

CVE-2026-48591 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting earmark libraries in the Hex ecosystem. The issue involves stored xss via unescaped html attribute values. Remediation is available in the latest vendor maintenance releases.

CVE-2026-48591 at a Glance

CVE Identifier CVE-2026-48591
GHSA Identifier GHSA-52mm-h59v-f3c7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product earmark
Package Ecosystem Hex
Published Date
Last Updated

How to Fix CVE-2026-48591

To remediate this vulnerability, upgrade all affected earmark dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

earmark fixed: Latest secure release
Upgrade earmark to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for earmark

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-48591, inspect your project dependencies for earmark:

inspect dependencies for earmark

Analyze the terminal output to locate any version of earmark in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In earmark, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

Improper Neutralization of Script in Attributes in a Web Page vulnerability in pragdave earmark allows stored cross-site scripting via unescaped HTML attribute values. 'Elixir.Earmark.Transform':_make_att1/2 in lib/earmark/transform.ex splices attribute values verbatim between two literal " bytes: [" ", name, "=\"", value, "\""]. Text nodes are routed through the existing escape function which encodes " as &quot;, but attribute values never visit that path. A markdown link whose URL or title contains a bare " closes the attribute early and lets the trailing bytes be parsed by the browser as fresh HTML attributes. For example, [click](http://example.com/?a=x" onerror="alert(1)) renders as <a href="http://example.com/?a=x" onerror="alert(1)">click</a>, executing arbitrary JavaScript in the victim's browser. The earmark library is no longer maintained and has been retired on Hex. No patched version will be released. All releases from 1.4.1 onward are affected, and users should migrate to a maintained Markdown library such as MDEx. This issue affects earmark from 1.4.1 onward.

CVE-2026-48591 Affected earmark Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
earmark
Hex
≥ 1.4.1
≤ 1.5.0-pre1

References

Frequently Asked Questions

What is CVE-2026-48591?
CVE-2026-48591 is a security vulnerability in earmark involving Stored XSS via unescaped HTML attribute values under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which earmark versions are affected?
Affected versions include releases prior to current release patches across affected packages: earmark.
What version fixes CVE-2026-48591?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is earmark affected?
Yes, earmark is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What CWE is associated with CVE-2026-48591?
CVE-2026-48591 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Hex dependencies for CVE-2026-48591?
Run the dependency tree command: 'inspect dependencies for earmark'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-52mm-h59v-f3c7",
  "modified" : "2026-06-18T14:47:16Z",
  "published" : "2026-06-17T18:35:58Z",
  "aliases" : [ "CVE-2026-48591" ],
  "summary" : "earmark: Stored XSS via unescaped HTML attribute values",
  "details" : "Improper Neutralization of Script in Attributes in a Web Page vulnerability in pragdave earmark allows stored cross-site scripting via unescaped HTML attribute values.\n\n'Elixir.Earmark.Transform':_make_att1/2 in lib/earmark/transform.ex splices attribute values verbatim between two literal \" bytes: [\" \", name, \"=\\\"\", value, \"\\\"\"]. Text nodes are routed through the existing escape function which encodes \" as &quot;, but attribute values never visit that path. A markdown link whose URL or title contains a bare \" closes the attribute early and lets the trailing bytes be parsed by the browser as fresh HTML attributes. For example, [click](http://example.com/?a=x\" onerror=\"alert(1)) renders as <a href=\"http://example.com/?a=x\" onerror=\"alert(1)\">click</a>, executing arbitrary JavaScript in the victim's browser.\n\nThe earmark library is no longer maintained and has been retired on Hex. No patched version will be released. All releases from 1.4.1 onward are affected, and users should migrate to a maintained Markdown library such as MDEx.\n\nThis issue affects earmark from 1.4.1 onward.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Hex",
      "name" : "earmark"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.1"
      }, {
        "last_affected" : "1.5.0-pre1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-48591"
  }, {
    "type" : "WEB",
    "url" : "https://cna.erlef.org/cves/CVE-2026-48591.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pragdave/earmark"
  }, {
    "type" : "WEB",
    "url" : "https://osv.dev/vulnerability/EEF-CVE-2026-48591"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79", "CWE-83" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-18T14:47:16Z",
    "nvd_published_at" : "2026-06-17T18:18:04Z"
  }
}