BREW-PARSEDMARC-CVE-2026… (GHSA-8CGQ-X343-P74C)

Vulnerability from osv_homebrew – Published: 2026-11-17 10:40 – Updated: 2026-11-17 10:40 – Source website
VLAI
Summary
mail-parser: One hostile attachment aborts `write_attachments()` and silently drops the rest of the batch
Details

Impact

write_attachments() called _safe_attachment_filename() and write_sample() inside its loop with no guard, so a single crafted attachment raised out of the whole save. Every attachment after the malicious one was silently never written, with no error surfaced to a caller that catches only MailParserError.

That is an evasion primitive as much as an availability bug: a sender puts one poisoned part first and the real payload second, and the payload never reaches the extraction directory that a downstream scanner or sandbox reads — while it still reaches the recipient's mail client intact. The tool's output diverges from the bytes actually in the message, which is the same failure mode as the filename-sanitizing bypass in GHSA-fr3h-cpq2-9496.

Three shapes were reachable, all from attacker-controlled MIME metadata:

  • NUL smuggled through RFC 2231 — filename*=us-ascii''evil%00.bin decodes to a NUL in the filename during parsing and raised ValueError out of the name check;
  • overlong basename — a filename longer than NAME_MAX (e.g. 300 characters) raised OSError: File name too long from open(), after creating a zero-byte stub on disk;
  • undecodable payload — a body that is not valid base64 raised binascii.Error (a ValueError subclass) from the decode performed inside the open() block.
import tempfile, mailparser

raw = ("Content-Type: multipart/mixed; boundary=b\r\n\r\n"
       "--b\r\nContent-Type: application/octet-stream\r\n"
       "Content-Disposition: attachment; filename*=us-ascii''evil%00.bin\r\n\r\nxx\r\n"
       "--b\r\nContent-Type: application/octet-stream\r\n"
       "Content-Disposition: attachment; filename=good.bin\r\n\r\nyy\r\n"
       "--b--\r\n")

mp = mailparser.parse_from_string(raw)     # parse itself is fine; safe_filename is None
mp.write_attachments(tempfile.mkdtemp())
# 4.6.0 - 4.6.2 -> ValueError, and good.bin is never written
# 4.6.3         -> logs "Skipped attachment with invalid filename: 'evil\x00.bin'";
#                  good.bin is written

parse() itself was never affected — it catches the ValueError — so only the write path was unguarded. The reject-paths that made this reachable were introduced with the filename sanitizing in 4.6.0 (PR #165).

Patches

Fixed in 4.6.3. write_attachments() now logs and skips a single unusable attachment instead of aborting the batch:

  • an invalid filename is caught and skipped;
  • overlong basenames are truncated to 240 UTF-8 bytes, preserving the extension, rather than reaching open();
  • the base64 decode moved before open(), so a failure leaves no zero-byte stub, and it now repairs padding and alphabet errors the way mail clients do (matching MIME::Base64 on 2008 cases) — rejecting them let a sender append one character to make an attachment vanish from the extraction directory while it still reached the recipient;
  • MailParserPathError is deliberately not caught by the per-attachment handler: a containment failure is not a per-attachment problem, and path-containment checks now raise MailParserPathError instead of ValueError so the broader catch cannot swallow them.

Deduplication was hardened in the same change: it reserves room for its own suffix marker (write_sample() sanitizes again, and the clamp there used to cut the marker back off, collapsing distinct attachments onto one file), resumes from the last used suffix per stem instead of rescanning from 1 (quadratic before — 16000 same-named attachments took 14 s, now milliseconds), and folds case, because APFS, exFAT and SMB collapse Invoice.pdf and invoice.pdf.

Workarounds

Upgrade to 4.6.3. If you cannot upgrade, do not call write_attachments() on untrusted mail; iterate parser.attachments yourself and write each attachment inside its own try/except Exception, skipping the ones whose safe_filename is None.

Impacted products
Ecosystem Package Version
Homebrew parsedmarc
pkg:brew/parsedmarc
Affected: ≥ 10.4.2, < 10.5.0 (ecosystem)

{
  "affected": [
    {
      "ecosystem_specific": {
        "fix": "bump",
        "range_state": "fixed",
        "resource": "mail-parser",
        "resource_purl": "pkg:pypi/mail-parser@4.10.0",
        "upstream_fixed_in": "4.6.3"
      },
      "package": {
        "ecosystem": "Homebrew",
        "name": "parsedmarc",
        "purl": "pkg:brew/parsedmarc"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "10.4.2"
            },
            {
              "fixed": "10.5.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "database_specific": {
    "confidence": "high",
    "source": "matched",
    "strategy": "registry",
    "upstream_evidence": [
      {
        "ecosystem": "PyPI",
        "key": "pkg:pypi/mail-parser@4.10.0",
        "name": "mail-parser",
        "resource": "mail-parser",
        "strategy": "registry",
        "subject_version": "4.10.0"
      }
    ]
  },
  "details": "### Impact\n\n`write_attachments()` called `_safe_attachment_filename()` and `write_sample()` inside its loop\nwith no guard, so a single crafted attachment raised out of the whole save. Every attachment\n**after** the malicious one was silently never written, with no error surfaced to a caller that\ncatches only `MailParserError`.\n\nThat is an evasion primitive as much as an availability bug: a sender puts one poisoned part\nfirst and the real payload second, and the payload never reaches the extraction directory that\na downstream scanner or sandbox reads \u2014 while it still reaches the recipient\u0027s mail client\nintact. The tool\u0027s output diverges from the bytes actually in the message, which is the same\nfailure mode as the filename-sanitizing bypass in\n[GHSA-fr3h-cpq2-9496](https://github.com/SpamScope/mail-parser/security/advisories/GHSA-fr3h-cpq2-9496).\n\nThree shapes were reachable, all from attacker-controlled MIME metadata:\n\n- **NUL smuggled through RFC 2231** \u2014 `filename*=us-ascii\u0027\u0027evil%00.bin` decodes to a NUL in the\n  filename during parsing and raised `ValueError` out of the name check;\n- **overlong basename** \u2014 a filename longer than `NAME_MAX` (e.g. 300 characters) raised\n  `OSError: File name too long` from `open()`, *after* creating a zero-byte stub on disk;\n- **undecodable payload** \u2014 a body that is not valid base64 raised `binascii.Error` (a\n  `ValueError` subclass) from the decode performed inside the `open()` block.\n\n```python\nimport tempfile, mailparser\n\nraw = (\"Content-Type: multipart/mixed; boundary=b\\r\\n\\r\\n\"\n       \"--b\\r\\nContent-Type: application/octet-stream\\r\\n\"\n       \"Content-Disposition: attachment; filename*=us-ascii\u0027\u0027evil%00.bin\\r\\n\\r\\nxx\\r\\n\"\n       \"--b\\r\\nContent-Type: application/octet-stream\\r\\n\"\n       \"Content-Disposition: attachment; filename=good.bin\\r\\n\\r\\nyy\\r\\n\"\n       \"--b--\\r\\n\")\n\nmp = mailparser.parse_from_string(raw)     # parse itself is fine; safe_filename is None\nmp.write_attachments(tempfile.mkdtemp())\n# 4.6.0 - 4.6.2 -\u003e ValueError, and good.bin is never written\n# 4.6.3         -\u003e logs \"Skipped attachment with invalid filename: \u0027evil\\x00.bin\u0027\";\n#                  good.bin is written\n```\n\n`parse()` itself was never affected \u2014 it catches the `ValueError` \u2014 so only the write path was\nunguarded. The reject-paths that made this reachable were introduced with the filename\nsanitizing in 4.6.0 (PR #165).\n\n### Patches\n\nFixed in **4.6.3**. `write_attachments()` now logs and skips a single unusable attachment\ninstead of aborting the batch:\n\n- an invalid filename is caught and skipped;\n- overlong basenames are truncated to 240 UTF-8 bytes, preserving the extension, rather than\n  reaching `open()`;\n- the base64 decode moved *before* `open()`, so a failure leaves no zero-byte stub, and it now\n  repairs padding and alphabet errors the way mail clients do (matching `MIME::Base64` on 2008\n  cases) \u2014 rejecting them let a sender append one character to make an attachment vanish from\n  the extraction directory while it still reached the recipient;\n- `MailParserPathError` is deliberately **not** caught by the per-attachment handler: a\n  containment failure is not a per-attachment problem, and path-containment checks now raise\n  `MailParserPathError` instead of `ValueError` so the broader catch cannot swallow them.\n\nDeduplication was hardened in the same change: it reserves room for its own suffix marker\n(`write_sample()` sanitizes again, and the clamp there used to cut the marker back off,\ncollapsing distinct attachments onto one file), resumes from the last used suffix per stem\ninstead of rescanning from 1 (quadratic before \u2014 16000 same-named attachments took 14 s, now\nmilliseconds), and folds case, because APFS, exFAT and SMB collapse `Invoice.pdf` and\n`invoice.pdf`.\n\n### Workarounds\n\nUpgrade to 4.6.3. If you cannot upgrade, do not call `write_attachments()` on untrusted mail;\niterate `parser.attachments` yourself and write each attachment inside its own\n`try`/`except Exception`, skipping the ones whose `safe_filename` is `None`.",
  "id": "BREW-parsedmarc-CVE-2026-129301",
  "modified": "2026-11-17T10:40:10Z",
  "published": "2026-11-17T10:40:10Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/security/advisories/GHSA-8cgq-x343-p74c"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129301"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/pull/171"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/commit/11b894a0b8b3f11055a99caff118206138d1daba"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/commit/e1d9fe6778045d6e2c44406bc8822e3464c1097f"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/SpamScope/mail-parser"
    },
    {
      "type": "WEB",
      "url": "https://github.com/SpamScope/mail-parser/releases/tag/4.6.3"
    }
  ],
  "schema_version": "1.7.3",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "mail-parser: One hostile attachment aborts `write_attachments()` and silently drops the rest of the batch",
  "upstream": [
    "GHSA-8cgq-x343-p74c",
    "CVE-2026-129301"
  ]
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.