{"id":"CVE-2026-107225","aliases":["CVE-2026-107225","GHSA-5h23-36rv-pm65","GO-2026-6674"],"related":[],"kind":"vulnerability","state":"published","title":"Excelize: GetStyle panics on a negative fillId, borderId or fontId in styles.xml","summary":"Excelize is a Go language library for reading and writing Microsoft Excel spreadsheets. From 2.8.0 to 2.11.0, GetStyle's fill, border, and font extraction predicates check only upper bounds for attacker-controlled style-table indices. File.GetStyle relies on extractStyleCondFuncs predicates that allow negative FillID, BorderID, and FontID values to reach slice indexing. When a crafted styles.xml supplies a negative fillId, borderId, or fontId and the application reads the style, a negative identifier passes the upper-bound-only predicate and becomes a negative slice index, allowing an attacker to panic while reading cell styling. 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.0 to 2.11.0, GetStyle's fill, border, and font extraction predicates check only upper bounds for attacker-controlled style-table indices. File.GetStyle relies on extractStyleCondFuncs predicates that allow negative FillID, BorderID, and FontID values to reach slice indexing. When a crafted styles.xml supplies a negative fillId, borderId, or fontId and the application reads the style, a negative identifier passes the upper-bound-only predicate and becomes a negative slice index, allowing an attacker to panic while reading cell styling. No fixed version is available as of this review.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`File.GetStyle` indexes the fill, border and font tables with values taken straight out of `xl/styles.xml`, and the conditions gating those lookups check only the upper bound. A workbook whose `cellXfs` entry carries `fillId=\"-1\"`, `borderId=\"-1\"` or `fontId=\"-1\"` reaches a negative slice index and panics. excelize has no `recover()`, so the panic leaves `GetStyle` and takes the calling process with it.\n\nSame defect class as GHSA-48hm-4h8j-58fg, the negative shared-string index, in a different file. That one was fixed by adding the missing lower bound; these three sites still lack it.\n\n## Where it is\n\n`styles.go`, in `GetStyle`, lines 1683, 1686 and 1689:\n\n```go\nxf := s.CellXfs.Xf[idx]\nif extractStyleCondFuncs[\"fill\"](xf, s) {\n    f.extractFills(s.Fills.Fill[*xf.FillID], s, style)\n}\nif extractStyleCondFuncs[\"border\"](xf, s) {\n    f.extractBorders(s.Borders.Border[*xf.BorderID], s, style)\n}\nif extractStyleCondFuncs[\"font\"](xf, s) {\n    style.Font = extractFont(s.Fonts.Font[*xf.FontID])\n}\n```\n\nThe conditions, at lines 1171 to 1185, bound only the top:\n\n```go\n\"fill\": func(xf xlsxXf, s *xlsxStyleSheet) bool {\n    return (xf.ApplyFill == nil || (xf.ApplyFill != nil && *xf.ApplyFill)) &&\n        xf.FillID != nil && s.Fills != nil &&\n        *xf.FillID < len(s.Fills.Fill)\n},\n```\n\n`*xf.FillID < len(...)` is satisfied by any negative value. `FillID`, `BorderID` and `FontID` are `*int` unmarshalled directly from the `fillId`, `borderId` and `fontId` attributes, so the value is whatever the file says. The border and font conditions have the same shape.\n\nThe correct pattern is already in the same function, six lines above at 1677:\n\n```go\nif idx < 0 || s.CellXfs == nil || len(s.CellXfs.Xf) <= idx {\n    return style, newInvalidStyleID(idx)\n}\n```\n\nand again at 1783. So the style index itself is guarded on both sides while the three ids it leads to are not.\n\n## Proof of concept\n\nExecuted against `master` at `f98df08`, which is the merge of #2366, so this is current rather than historical. The harness builds a normal styled workbook with excelize, rewrites one attribute of the `cellXfs` entry inside the zip to `-1`, reopens it and calls `GetCellStyle` then `GetStyle`:\n\n```\ncontrol (all >= 0)           ok style=true err=<nil>\nfillId=-1                    PANIC: runtime error: index out of range [-1]\nborderId=-1                  PANIC: runtime error: index out of range [-1]\nfontId=-1                    PANIC: runtime error: index out of range [-1]\n```\n\nThe control confirms the harness reads a valid file correctly, so the three panics are the negative ids rather than a broken fixture. Worth mentioning because my first attempt at this harness patched only `fillId` and appeared to show the other two were fine; they are not, the replacement had simply missed them.\n\n## Impact\n\nAny application that opens an untrusted `.xlsx` and reads cell styling crashes. `GetStyle` is reached through `GetCellStyle` and from the style-copying and rendering paths, so it sits on the ordinary read path. With no `recover()` anywhere in excelize, a CLI or worker exits and a service returns 500 per request unless the caller installed its own recovery middleware.\n\nNo memory corruption and no information disclosure. Availability only.\n\n## Suggested fix\n\nAdd the lower bound to each of the three conditions, matching what line 1677 already does for the style index:\n\n```go\n*xf.FillID >= 0 && *xf.FillID < len(s.Fills.Fill)\n```\n\nand the same for `BorderID` and `FontID`. Three one-line changes in `extractStyleCondFuncs`.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Excelize: GetStyle panics on a negative fillId, borderId or fontId in styles.xml in github.com/xuri/excelize","format":"markdown","source":"go"}],"published":"2026-10-07T18:55:55.603Z","modified":"2026-11-05T23:26:03.346Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-20","CWE-129"],"affected":[{"ranges":[{"version":">= 2.8.0, <= 2.11.0","status":"affected"}],"vendor":"qax-os","product":"excelize","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.8.0","status":"affected","fixed":"2.11.1-0.20260731010303-ae2113b410e5"}],"ecosystem":"Go","package":"github.com/xuri/excelize/v2","purl":"pkg:golang/github.com/xuri/excelize/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.8.0","status":"affected","fixed":"2.11.1-0.20260731010303-ae2113b410e5"}],"ecosystem":"Go","package":"github.com/xuri/excelize/v2","purl":"pkg:golang/github.com/xuri/excelize/v2","source":"go"},{"ranges":[{"status":"affected","introduced":"2.8.0","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-5h23-36rv-pm65","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/qax-os/excelize/pull/2367","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/qax-os/excelize/commit/ae2113b410e51f6a141c396a59eda8c42b91bc22","tags":["fix","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/qax-os/excelize","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-10-10T02:41:58.921Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-107225","url":"https://www.cve.org/CVERecord?id=CVE-2026-107225","licence":"CVE Terms of Use","modified":"2026-10-10T02:42:21.546Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5h23-36rv-pm65","url":"https://github.com/advisories/GHSA-5h23-36rv-pm65","licence":"CC-BY-4.0","modified":"2026-11-05T23:26:03.346Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6674","url":"https://pkg.go.dev/vuln/GO-2026-6674","licence":"CC-BY-4.0","modified":"2026-11-05T23:15:11.901Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-107225","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-107225","licence":"Public domain","modified":"2026-10-13T13:08:51.830Z"}],"updatedAt":"2026-11-25T22:59:43.087Z","epss":{"score":0.0027,"percentile":0.20512,"date":"2026-12-01T12:00:22.000Z"}}