{"id":"CVE-2026-107216","aliases":["CVE-2026-107216","GHSA-wp2g-vpjj-g53r","GO-2026-6688"],"related":[],"kind":"vulnerability","state":"published","title":"Excelize ANCHORARRAY: mutually-referencing array formulas recurse unboundedly via re-entrant CalcCellValue, causing a fatal stack overflow","summary":"Excelize is a Go language library for reading and writing Microsoft Excel spreadsheets. From 2.8.1 to 2.11.0, ANCHORARRAY recursively calls the exported CalcCellValue function, creating a fresh calculation context at each cycle and bypassing in-flight and iteration controls. ANCHORARRAY calls CalcCellValue instead of cellResolver, so each recursive hop receives a new calcContext and loses cycle state. When mutually referencing dynamic-array formulas are evaluated directly or through formula-evaluating APIs, each recursion hop resets the cycle budget and prevents completion-based caches from breaking the cycle, allowing an attacker to cause a fatal Go stack overflow and abort the process. 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.8.1 to 2.11.0, ANCHORARRAY recursively calls the exported CalcCellValue function, creating a fresh calculation context at each cycle and bypassing in-flight and iteration controls. ANCHORARRAY calls CalcCellValue instead of cellResolver, so each recursive hop receives a new calcContext and loses cycle state. When mutually referencing dynamic-array formulas are evaluated directly or through formula-evaluating APIs, each recursion hop resets the cycle budget and prevents completion-based caches from breaking the cycle, allowing an attacker to cause a fatal Go stack overflow and abort the process. No fixed version is available as of this review.","source":"cvelist"},{"lang":"en","text":"### Summary\n\n`ANCHORARRAY` (calc.go:15137 on current master) evaluates each cell of the referenced spill range by calling the **exported** `CalcCellValue`, which unconditionally constructs a fresh `calcContext` — fresh entry marker, fresh iterations map, full `MaxCalcIterations` budget (calc.go:896-900). The circular-reference control only exists **within one context**: the entry-exclusion marker and per-ref iteration budget are fields of that single context, and completion-based caching (`formulaArgCache`/`calcRawCache`) only ever stores results of evaluations that *finish*.\n\nDuring a pure cycle no nested evaluation ever finishes, so nothing is ever cached to break the recursion, and each hop re-arms the entire budget. Two ordinary, Excel-legal constructs in an attacker-supplied workbook are enough:\n\n- `A1` (dynamic array formula, ref `A1:A1`): `_xlfn.ANCHORARRAY($B$1)`\n- `B1` (dynamic array formula, ref `B1:B1`): `_xlfn.ANCHORARRAY($A$1)`\n\n→ `CalcCellValue → calcCellValue → evalInfixExp → parseReference → cellResolver → … → ANCHORARRAY → CalcCellValue → …` forever, ending in a **fatal, unrecoverable** Go runtime error: `runtime: goroutine stack exceeds …-byte limit / fatal error: stack overflow`. Go stack overflows cannot be recovered — the whole process aborts.\n\n### Details\n\n- The terminating edge the iterations gate is supposed to provide does not exist across contexts: there is no in-flight tracking shared between nested `CalcCellValue` calls.\n- Both formulas are ordinary Excel-legal constructs; no exotic XML is required.\n- Excelize's own APIs reach formula evaluation on untrusted cells implicitly (e.g. `pivotTable.go:538`, `picture.go:985/1141`, `col.go:892`), so a service that merely adds a pivot table or a picture over such a workbook dies.\n- No option value prevents it: `MaxCalcIterations` is irrelevant because every hop gets a fresh budget.\n- Measured: a 64 MB stack budget is exhausted in ~0.09 s; the ~1 GB default in ~1–2 s.\n\n### PoC\n\nA standalone program (public API only) was provided to the maintainer by email (`4-anchorarray-recursion`): `NewFile` + `SetCellFormula` with `FormulaOpts{Type: array, Ref: A1:A1 / B1:B1}`, then `CalcCellValue(\"Sheet1\",\"A1\")`. On master `ecd99d761fe0` (2026-09-08) the process aborts with `fatal error: stack overflow`; with the proposed patch the cycle terminates normally (`CYCLE_TERMINATED`) and existing calc tests pass.\n\n### Impact\n\nAn attacker ships a workbook containing the two formulas; any service that evaluates a formula over those cells — directly via `CalcCellValue`, or implicitly via `AddPivotTable` / `AddPicture` / auto-fit — aborts. Remote, unauthenticated, process-fatal, no configuration prevents it.\n\n### Proposed fix\n\nEvaluate spill-range cells through the **current** calculation context — `fn.f.cellResolver(fn.ctx, …)` instead of the exported `CalcCellValue` — so the entry check and iterations gate of the running calculation apply. `cellResolver` returns the typed value directly (dropping a string round-trip); an `ArgEmpty → \"\"` shim preserves the existing `ToNumber` behavior for empty spill cells, and a fresh-context fallback covers the legacy nil-ctx test paths. A complete patch has been provided to the maintainer.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Mutually-referencing array formulas recurse unboundedly, causing a fatal stack overflow in github.com/xuri/excelize","format":"markdown","source":"go"}],"published":"2026-10-07T17:51:31.980Z","modified":"2026-10-19T21:41:18.715Z","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-674"],"affected":[{"ranges":[{"version":">= 2.8.1, <= 2.11.0","status":"affected"}],"vendor":"qax-os","product":"excelize","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.8.1","status":"affected","fixed":"2.11.1-0.20260911060113-ea12859e43c6"}],"ecosystem":"Go","package":"github.com/xuri/excelize/v2","purl":"pkg:golang/github.com/xuri/excelize/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.8.1","status":"affected","fixed":"2.11.1-0.20260911060113-ea12859e43c6"}],"ecosystem":"Go","package":"github.com/xuri/excelize/v2","purl":"pkg:golang/github.com/xuri/excelize/v2","source":"go"},{"ranges":[{"status":"affected","introduced":"2.8.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-wp2g-vpjj-g53r","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/qax-os/excelize/commit/ea12859e43c64d498ecf839263c5f917391f3316","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-107216","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/qax-os/excelize","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-10-07T18:50:55.568Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-107216","url":"https://www.cve.org/CVERecord?id=CVE-2026-107216","licence":"CVE Terms of Use","modified":"2026-10-07T18:51:04.748Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-wp2g-vpjj-g53r","url":"https://github.com/advisories/GHSA-wp2g-vpjj-g53r","licence":"CC-BY-4.0","modified":"2026-10-19T21:41:18.715Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6688","url":"https://pkg.go.dev/vuln/GO-2026-6688","licence":"CC-BY-4.0","modified":"2026-10-19T21:31:49.924Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-107216","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-107216","licence":"Public domain","modified":"2026-10-13T14:23:43.183Z"}],"updatedAt":"2026-11-25T22:59:43.081Z","epss":{"score":0.00422,"percentile":0.38477,"date":"2026-12-01T12:00:22.000Z"}}