{"id":"CVE-2026-107215","aliases":["CVE-2026-107215","GHSA-x2q3-8cjh-766f","GO-2026-6689"],"related":[],"kind":"vulnerability","state":"published","title":"Excelize: extractPart allocates attacker-controlled, unbounded and negative-sized buffers from CFB directory entries: remote panic / OOM DoS","summary":"Excelize is a Go language library for reading and writing Microsoft Excel spreadsheets. From 2.3.1 to 2.11.0, extractPart allocates a byte slice directly from an attacker-controlled CFB directory-entry size before validating the sector chain or size domain. extractPart trusts the CFB directory entry streamSize for EncryptionInfo and EncryptedPackage allocations before validating the stream. When a crafted OLE compound file declares a negative or extremely large EncryptionInfo or EncryptedPackage stream size, the declared size reaches make with a negative length or forces a multi-gigabyte allocation, allowing an attacker to panic or exhaust process memory. No fixed version is available as of this review.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Excelize is a Go language library for reading and writing Microsoft Excel spreadsheets. From 2.3.1 to 2.11.0, extractPart allocates a byte slice directly from an attacker-controlled CFB directory-entry size before validating the sector chain or size domain. extractPart trusts the CFB directory entry streamSize for EncryptionInfo and EncryptedPackage allocations before validating the stream. When a crafted OLE compound file declares a negative or extremely large EncryptionInfo or EncryptedPackage stream size, the declared size reaches make with a negative length or forces a multi-gigabyte allocation, allowing an attacker to panic or exhaust process memory. No fixed version is available as of this review.","source":"cvelist"},{"lang":"en","text":"### Summary\n\n`extractPart` allocates directly from the mscfb directory-entry size with no clamping (`crypt.go:198`, same missing bound at `crypt.go:204`):\n\n```go\nbuf := make([]byte, entry.Size)\n```\n\n`entry.Size` is the raw `streamSize` field from the attacker-controlled CFB directory entry (mscfb v1.0.8 `fixFile`, `file.go:109-120`: full uint64 → int64 for major version 4, low uint32 for v3). mscfb only detects short sector chains later, inside `File.Read` (`file.go:485-489` \"emergency brake\") — i.e. **after** the allocation. The zip path already enforces `UnzipSizeLimit`, and the KDF path bounds work with `maxSpinCount`; this path consults no limit at all.\n\n### Details\n\nTwo consequences, both execution-confirmed against pristine master (`ecd99d761fe0`, 2026-09-08):\n\n1. **Hard crash**: a version-4 CFB declaring `streamSize = 0xFFFFFFFFFFFFFFFF` yields `entry.Size == -1` → `panic: runtime error: makeslice: len out of range`, which escapes `Decrypt` (`openReaderAt` converts errors, not panics, `excelize.go:210-214`) and kills the process.\n2. **Memory exhaustion**: any CFB (v3 suffices) declaring `streamSize` up to `0xFFFFFFFF` forces up to 4 GiB of zeroed allocation from a ~12 KB file — an amplification factor of ~350,000×, trivially repeated per request in memory-limited deployments.\n\nCall path: `OpenFile`/`OpenReader`/`OpenBytes` → `openReaderAt` (`excelize.go:208-215`, OLE magic sniff) → `Decrypt` (`crypt.go:145-150`) → `extractPart` (`crypt.go:198`).\n\n### PoC\n\nA standalone program (public API only) was provided to the maintainer by email (`2-extractpart-oom`): it builds a valid-enough v4 (4096-byte sector) CFB — header (signature, sector shift `0x0C`, `DIFAT[0]=1`), one directory sector with Root Entry (typeID 5, child=1) and a stream entry `EncryptionInfo` (objectType=2, startingSector=endOfChain, `streamSize=0xFFFFFFFFFFFFFFFF`). `mscfb.New` succeeds, `doc.Next()` returns the entry, and `extractPart` calls `make([]byte, -1)` before any chain validation. On master `ecd99d761fe0` the program prints `panic: runtime error: makeslice: len out of range`; with the proposed patch it prints BLOCKED. An `-oom` flag demonstrates the 4 GiB allocation variant with `streamSize = 0xFFFFFFFF`.\n\n### Impact\n\nAn attacker uploads any file starting with the OLE signature `D0 CF 11 E0 A1 B1 1A E1` (~12 KB is enough) to a service that calls `excelize.OpenFile`/`OpenReader`/`OpenBytes` on it (or calls `Decrypt` directly): remote, unauthenticated process crash (hard panic) or forced 4 GiB allocation per request (OOM) with a ~350,000× amplification factor.\n\n### Proposed fix\n\nBound the declared stream size before allocating in `extractPart`: reject negative sizes and sizes above a sane policy cap (1 GiB is far above any real encrypted-workbook part) with `ErrWorkbookFileFormat`, so malformed CFBs are rejected as errors instead of panicking or OOMing. A complete patch has been provided to the maintainer; verified that the patch blocks the PoC while legitimate `Encrypt()` output still opens.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Panic and memory exhaustion via unbounded CFB stream allocation in github.com/xuri/excelize","format":"markdown","source":"go"}],"published":"2026-10-07T17:48:03.233Z","modified":"2026-10-19T21:41:17.838Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-789"],"affected":[{"ranges":[{"version":">= 2.3.1, <= 2.11.0","status":"affected"}],"vendor":"qax-os","product":"excelize","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.3.1","status":"affected","fixed":"2.11.1-0.20260912113515-5f636f9dcde5"}],"ecosystem":"Go","package":"github.com/xuri/excelize/v2","purl":"pkg:golang/github.com/xuri/excelize/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.3.1","status":"affected"}],"ecosystem":"Go","package":"github.com/360EntSecGroup-Skylar/excelize/v2","purl":"pkg:golang/github.com/360EntSecGroup-Skylar/excelize/v2","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.11.1-0.20260912113515-5f636f9dcde5"}],"ecosystem":"Go","package":"github.com/xuri/excelize/v2","purl":"pkg:golang/github.com/xuri/excelize/v2","source":"go"},{"ranges":[{"status":"affected","introduced":"2.3.1","lastAffected":"2.11.0"}],"vendor":"excelize","product":"excelize","cpe":"cpe:2.3:a:excelize:excelize:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/qax-os/excelize/security/advisories/GHSA-x2q3-8cjh-766f","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/qax-os/excelize/pull/2396","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/qax-os/excelize/commit/5f636f9dcde55911f14290060b017f0cc88cd694","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-107215","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/qax-os/excelize","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-10-10T02:38:08.709Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-107215","url":"https://www.cve.org/CVERecord?id=CVE-2026-107215","licence":"CVE Terms of Use","modified":"2026-10-10T02:38:31.276Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x2q3-8cjh-766f","url":"https://github.com/advisories/GHSA-x2q3-8cjh-766f","licence":"CC-BY-4.0","modified":"2026-10-19T21:41:17.838Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6689","url":"https://pkg.go.dev/vuln/GO-2026-6689","licence":"CC-BY-4.0","modified":"2026-10-19T21:31:52.826Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-107215","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-107215","licence":"Public domain","modified":"2026-10-13T14:23:50.540Z"}],"updatedAt":"2026-11-25T22:59:43.080Z","epss":{"score":0.00287,"percentile":0.22839,"date":"2026-12-01T12:00:22.000Z"}}