GitHub Advisoryadvisory · Go
GHSA-fx5j-qcqg-grpf Excelize: Negative shared-string index causes panic in GetCellValue and GetRows
MEDIUM
Official page ↗
- Aliases
- CVE-2026-59162
- Ecosystem
- Go
- Packages
- github.com/xuri/excelize/v2, github.com/xuri/excelize
- Severity
- Moderate
- CVSS vector
- CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
- Weaknesses
- CWE-248, CWE-755
- Reviewed
- 2026-09-10
Affected packages
• Go github.com/xuri/excelize/v2: < 2.11.0 → fixed in 2.11.0
• Go github.com/xuri/excelize: <= 1.4.0 (no fix yet)
Description
Negative shared-string index causes panic in GetCellValue and GetRows
Summary
Excelize parses shared-string cell values with `strconv.Atoi` and checks only the upper bound before indexing the shared string slice. If an XLSX file contains a shared-string cell with `-1`, the parsed index is negative. The upper-bound check still passes (`len(sharedStrings) > -1`), and Excelize indexes `sharedStrings[-1]`, causing a runtime panic.
This was reproduced on the current default branch commit `1213a8bd7c5ab360554603ac5c995ccaf6eb4314` and the latest release tag `v2.10.1` (`5ad5ab3af0054c55bdce09f1530085600e9f2e45`). The issue is independent from the row-bound allocation report, so I am reporting it separately.
Affected package
• Package: `github.com/xuri/excelize/v2`
• Tested affected versions: current default branch at `1213a8bd7c5ab360554603ac5c995ccaf6eb4314`, and release `v2.10.1`
• Fixed version: none known at the time of this report
Impact
An attacker who can provide an XLSX file to an application using Excelize can trigger a process panic when the application reads the malicious cell through common APIs such as `GetCellValue` or `GetRows`. In services that parse untrusted spreadsheets without a panic recovery boundary, this can cause denial of service.
Root cause
For shared-string cells (`t="s"`), `xlsxC.getValueFrom()` parses the cell value as a shared-string index and only checks whether the index is below `len(d.SI)` before indexing:
```go
xlsxSI, _ := strconv.Atoi(strings.TrimSpace(c.V))
if len(d.SI) > xlsxSI {
return d.SI[xlsxSI].String(), nil
}
```
For `xlsxSI == -1`, `len(d.SI) > -1` is true, so the code proceeds to index `d.SI[-1]` and panics.
Minimal worksheet payload
```xml
-1
```
The workbook also contains a normal `sharedStrings.xml` with one string (`ok`), so the failure is specifically due to accepting a negative index.
Reproduction
Calling `GetCellValue("Sheet1", "A1")` on the workbook panics:
```text
== negative shared string GetCellValue ==
elapsed=0s alloc_delta=0MB
PANIC: runtime.boundsError runtime error: index out of range [-1]
```
Calling `GetRows("Sheet1")` on the same workbook also panics:
```text
== negative shared string GetRows ==
elapsed=0s alloc_delta=0MB
PANIC: runtime.boundsError runtime error: index out of range [-1]
```
The same results were observed on current default branch commit `1213a8bd7c5ab360554603ac5c995ccaf6eb4314` and on release `v2.10.1`.
Expected behavior
Malformed shared-string indices should be rejected or treated as missing/invalid string references without panicking.
Suggested remediation
Check both lower and upper bounds before indexing the shared string table. For example:
```go
if xlsxSI >= 0 && xlsxSI ` value is negative.
Related
Alias · CVE (1)
- CVE-2026-59162 Excelize is a Go language library for reading and writing Microsoft Excel spreadsheets. vulnerability
References
- https://github.com/qax-os/excelize/security/advisories/GHSA-fx5j-qcqg-grpf web
- https://nvd.nist.gov/vuln/detail/CVE-2026-59162 advisory
- https://github.com/qax-os/excelize/pull/2331 web
- https://github.com/qax-os/excelize/commit/93f0b3caed37f21ef5079e3259c6c21dcfe68453 web
- https://github.com/qax-os/excelize package
- https://github.com/qax-os/excelize/releases/tag/v2.11.0 web