Repository navigation
Version 6.2.0
Security Release — Hardening against malicious .msg files
This release addresses several denial-of-service and information-disclosure vulnerabilities that could be triggered simply by opening an untrusted .msg file. Upgrading is strongly recommended for any application that parses .msg files from untrusted sources.
Security Fixes
- Arbitrary file read / NTLM credential leak via external attachments (most critical) Attachments using ATTACH_BY_REFERENCE / ATTACH_BY_REF_ONLY / ATTACH_BY_REF_RESOLVE previously had their referenced path read from disk automatically during new Message(...). A crafted .msg could point at a local file (e.g. C:\Windows\win.ini) or a UNC path (e.g. \attacker.com\share\probe), triggering arbitrary local file reads or outbound SMB/UNC requests that can leak NTLM credentials — all before the caller had any chance to intervene.
• External references are now recorded, not read, during construction.
• New opt-in API: Attachment.ResolveExternalReference(), plus Attachment.IsExternalReference and Attachment.ExternalReferencePath so callers can inspect and validate the path before choosing to read it. - Unbounded recursion with nested embedded messages (uncatchable crash) Deeply (or infinitely) nested ATTACH_EMBEDDED_MSG attachments caused an uncatchable StackOverflowException during construction.
• Embedded-message nesting is now limited to a depth of 10.
• Exceeding the limit throws the new catchable MRMaxEmbeddedDepthReached exception. - Unbounded memory allocation in RTF decompression The uncompressedSize field was read from the compressed-RTF header and trusted without validation, allowing a small crafted file to force multi-gigabyte allocations and OutOfMemoryException.
• uncompressedSize is now validated against a 100 MB cap (plus existing compressed-size sanity checks). - Unbounded stream-to-memory copy Oversized property streams were copied fully into memory with no size cap.
• Stream reads are now capped at 256 MB, throwing an IOException for oversized streams. - Out-of-bounds read on truncated property records Iterating the property stream in 16-byte steps did not verify the remaining length, so a truncated final record caused an unhandled IndexOutOfRangeException / ArgumentOutOfRangeException.
• Added bounds checks that stop iteration safely on malformed/truncated records (in both property-stream parsing and named-property discovery).
Behavioral Change
External-reference attachments are no longer resolved automatically. If your application relies on the byte content of ATTACH_BY_REFERENCE attachments, call attachment.ResolveExternalReference() explicitly after validating attachment.ExternalReferencePath.