CVE-2026-107222: Excelize GetConditionalFormats Indexes Conditional-formatting Rule Sub-elements Vulnerability

MODERATE
Advisory Identifier: GHSA-rxcj-4pj5-74gr
CVSS 6.5
CWE-129 CWE-476
Published
Advisory Summary

CVE-2026-107222 is a MODERATE (CVSS 6.5) getconditionalformats indexes conditional-formatting rule sub-elements vulnerability (CWE-129: Improper Validation of Array Index) affecting Excelize libraries in the Go ecosystem. The issue involves getconditionalformats indexes conditional-formatting rule sub-elements with no length or nil check. Remediation is available by upgrading affected packages to version 2.11.1-0.20260812075026-be7a16390fa6.

CVE-2026-107222 at a Glance

CVE Identifier CVE-2026-107222
GHSA Identifier GHSA-rxcj-4pj5-74gr
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-129: Improper Validation of Array Index
Affected Product Excelize
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 6.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:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-107222

To remediate this vulnerability, upgrade all affected Excelize dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/xuri/excelize/v2 fixed: 2.11.1-0.20260812075026-be7a16390fa6
Upgrade github.com/xuri/excelize/v2 to 2.11.1-0.20260812075026-be7a16390fa6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/xuri/excelize/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-107222, inspect your project dependencies for Excelize:

inspect dependencies for github.com/xuri/excelize/v2

Analyze the terminal output to locate any version of Excelize in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.11.1-0.20260812075026-be7a16390fa6), 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-129: Improper Validation of Array Index, where the product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array. In Excelize, 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

## Summary `GetConditionalFormats` reads sub-elements of a `<cfRule>` straight out of `xl/worksheets/sheetN.xml` and indexes them without checking length, and in one case without checking for nil. Three rule types are affected: `cellIs`, `dataBar` and `colorScale`. A workbook with a rule that is missing a child a real Excel file would always have panics the call. ## Where it is All three sinks are in `styles.go`, at the same line numbers in v2.11.0 and on master `d552a7e`. All three are reached from `GetConditionalFormats` through `styles.go:3271`. `styles.go:3003`, in `extractCondFmtCellIs`: ```go format.Value = c.Formula[0] ``` The branch above it handles `len(c.Formula) == 2`; this one is the fallback and does not check that there is a formula at all, so a `cellIs` rule with no `<formula>` child indexes an empty slice. `styles.go:3132`, in the colorScale extractor: ```go values := len(c.ColorScale.Cfvo) ``` `c.ColorScale` is a `*xlsxColorScale` and is nil when the `<cfRule type="colorScale">` element has no `<colorScale>` child. Lines 3148 and 3153 then index `Cfvo[1]` and `Cfvo[2]` in the three-colour branch with no length check either. `styles.go:3186`, `:3188` and `:3190`, in the dataBar extractor: ```go format.MinType = c.DataBar.Cfvo[0].Type ... format.BarColor = "#" + f.getThemeColor(c.DataBar.Color[0]) ``` The guard here is `c.DataBar != nil`, which says nothing about the length of `Cfvo` or `Color`, so an empty `<dataBar></dataBar>` element reaches all three. ## Who the attacker is Anyone who can hand a spreadsheet to a service that opens it and calls `GetConditionalFormats`. No authentication, no user interaction beyond the service doing its normal job, and the file is small. ## Reproduction Three minimal `.xlsx` files were built, each a real zip with `[Content_Types].xml`, `_rels/.rels`, `xl/workbook.xml`, `xl/_rels/workbook.xml.rels` and one worksheet, opened each with the public `excelize.OpenReader` and called `GetConditionalFormats("Sheet1")`. Nothing internal is touched. The worksheet fragment for the `cellIs` case, note there is no `<formula>` child: ```xml <conditionalFormatting sqref="A1"><cfRule type="cellIs" operator="equal" priority="1" dxfId="0"/></conditionalFormatting> ``` for `dataBar`: ```xml <conditionalFormatting sqref="A1"><cfRule type="dataBar" priority="1"><dataBar></dataBar></cfRule></conditionalFormatting> ``` and for `colorScale`: ```xml <conditionalFormatting sqref="A1"><cfRule type="colorScale" priority="1"/></conditionalFormatting> ``` Observed against master `d552a7e` on go1.26.5: ```text cellIs panic: runtime error: index out of range [0] with length 0 styles.go:3003 styles.go:1217 styles.go:3271 dataBar panic: runtime error: index out of range [0] with length 0 styles.go:3186 styles.go:1262 styles.go:3271 colorScale panic: runtime error: invalid memory address or nil pointer dereference styles.go:3132 styles.go:1259 styles.go:3271 ``` One honesty note on impact. These are ordinary Go panics, not fatal errors, so a caller that wraps the call in `recover` survives them. ## Suggested fix Length-check `c.Formula` before line 3003 and return the rule with an empty value when there is no formula. Nil-check `c.ColorScale` before line 3132 and length-check `ColorScale.Cfvo` before indexing 1 and 2. Length-check `DataBar.Cfvo` and `DataBar.Color` alongside the existing nil check at 3186 to 3190. Skipping the malformed rule rather than erroring would keep `GetConditionalFormats` usable on files that are merely sloppy. ## Affected versions `github.com/xuri/excelize/v2` up to and including v2.11.0, and master at `d552a7e`. I read the three sinks at tag v2.11.0 and at master and ran the reproducers against master.

CVE-2026-107222 Affected Excelize Versions

1 component(s)
Fixed Versions:
2.11.1-0.20260812075026-be7a16390fa6
Product / Package Ecosystem Affected Versions Fixed Version
github.com/xuri/excelize/v2
Go
≥ 2.7.0
< 2.11.1-0.20260812075026-be7a16390fa6
2.11.1-0.20260812075026-be7a16390fa6

References

Frequently Asked Questions

What is CVE-2026-107222?
CVE-2026-107222 is a security vulnerability in Excelize involving GetConditionalFormats indexes conditional-formatting rule sub-elements with no length or nil check under CWE-129: Improper Validation of Array Index.
Which Excelize versions are affected?
Affected versions include releases prior to 2.11.1-0.20260812075026-be7a16390fa6 across affected packages: github.com/xuri/excelize/v2.
What version fixes CVE-2026-107222?
Upgrading to 2.11.1-0.20260812075026-be7a16390fa6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/xuri/excelize/v2 affected?
Yes, github.com/xuri/excelize/v2 is affected in releases prior to 2.11.1-0.20260812075026-be7a16390fa6. Upgrade your dependency to 2.11.1-0.20260812075026-be7a16390fa6 or later.
What is the CVSS score of CVE-2026-107222?
CVE-2026-107222 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-107222?
CVE-2026-107222 is classified under CWE-129: Improper Validation of Array Index (The product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array.).
How can I check Go dependencies for CVE-2026-107222?
Run the dependency tree command: 'inspect dependencies for github.com/xuri/excelize/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rxcj-4pj5-74gr",
  "modified" : "2026-10-07T20:22:55Z",
  "published" : "2026-10-07T20:22:54Z",
  "aliases" : [ "CVE-2026-107222" ],
  "summary" : "Excelize: GetConditionalFormats indexes conditional-formatting rule sub-elements with no length or nil check",
  "details" : "## Summary\n\n`GetConditionalFormats` reads sub-elements of a `<cfRule>` straight out of `xl/worksheets/sheetN.xml` and indexes them without checking length, and in one case without checking for nil. Three rule types are affected: `cellIs`, `dataBar` and `colorScale`. A workbook with a rule that is missing a child a real Excel file would always have panics the call.\n\n## Where it is\n\nAll three sinks are in `styles.go`, at the same line numbers in v2.11.0 and on master `d552a7e`. All three are reached from `GetConditionalFormats` through `styles.go:3271`.\n\n`styles.go:3003`, in `extractCondFmtCellIs`:\n\n```go\n\tformat.Value = c.Formula[0]\n```\n\nThe branch above it handles `len(c.Formula) == 2`; this one is the fallback and does not check that there is a formula at all, so a `cellIs` rule with no `<formula>` child indexes an empty slice.\n\n`styles.go:3132`, in the colorScale extractor:\n\n```go\n\tvalues := len(c.ColorScale.Cfvo)\n```\n\n`c.ColorScale` is a `*xlsxColorScale` and is nil when the `<cfRule type=\"colorScale\">` element has no `<colorScale>` child. Lines 3148 and 3153 then index `Cfvo[1]` and `Cfvo[2]` in the three-colour branch with no length check either.\n\n`styles.go:3186`, `:3188` and `:3190`, in the dataBar extractor:\n\n```go\n\t\tformat.MinType = c.DataBar.Cfvo[0].Type\n\t\t...\n\t\tformat.BarColor = \"#\" + f.getThemeColor(c.DataBar.Color[0])\n```\n\nThe guard here is `c.DataBar != nil`, which says nothing about the length of `Cfvo` or `Color`, so an empty `<dataBar></dataBar>` element reaches all three.\n\n## Who the attacker is\n\nAnyone who can hand a spreadsheet to a service that opens it and calls `GetConditionalFormats`. No authentication, no user interaction beyond the service doing its normal job, and the file is small.\n\n## Reproduction\n\nThree minimal `.xlsx` files were built, each a real zip with `[Content_Types].xml`, `_rels/.rels`, `xl/workbook.xml`, `xl/_rels/workbook.xml.rels` and one worksheet, opened each with the public `excelize.OpenReader` and called `GetConditionalFormats(\"Sheet1\")`. Nothing internal is touched.\n\nThe worksheet fragment for the `cellIs` case, note there is no `<formula>` child:\n\n```xml\n<conditionalFormatting sqref=\"A1\"><cfRule type=\"cellIs\" operator=\"equal\" priority=\"1\" dxfId=\"0\"/></conditionalFormatting>\n```\n\nfor `dataBar`:\n\n```xml\n<conditionalFormatting sqref=\"A1\"><cfRule type=\"dataBar\" priority=\"1\"><dataBar></dataBar></cfRule></conditionalFormatting>\n```\n\nand for `colorScale`:\n\n```xml\n<conditionalFormatting sqref=\"A1\"><cfRule type=\"colorScale\" priority=\"1\"/></conditionalFormatting>\n```\n\nObserved against master `d552a7e` on go1.26.5:\n\n```text\ncellIs      panic: runtime error: index out of range [0] with length 0\n              styles.go:3003\n              styles.go:1217\n              styles.go:3271\n\ndataBar     panic: runtime error: index out of range [0] with length 0\n              styles.go:3186\n              styles.go:1262\n              styles.go:3271\n\ncolorScale  panic: runtime error: invalid memory address or nil pointer dereference\n              styles.go:3132\n              styles.go:1259\n              styles.go:3271\n```\n\nOne honesty note on impact. These are ordinary Go panics, not fatal errors, so a caller that wraps the call in `recover` survives them.\n\n## Suggested fix\n\nLength-check `c.Formula` before line 3003 and return the rule with an empty value when there is no formula. Nil-check `c.ColorScale` before line 3132 and length-check `ColorScale.Cfvo` before indexing 1 and 2. Length-check `DataBar.Cfvo` and `DataBar.Color` alongside the existing nil check at 3186 to 3190. Skipping the malformed rule rather than erroring would keep `GetConditionalFormats` usable on files that are merely sloppy.\n\n## Affected versions\n\n`github.com/xuri/excelize/v2` up to and including v2.11.0, and master at `d552a7e`. I read the three sinks at tag v2.11.0 and at master and ran the reproducers against master.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/xuri/excelize/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.7.0"
      }, {
        "fixed" : "2.11.1-0.20260812075026-be7a16390fa6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/qax-os/excelize/security/advisories/GHSA-rxcj-4pj5-74gr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/qax-os/excelize/pull/2375"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/qax-os/excelize/commit/be7a16390fa69c71d3ca618c741d1a2b5ed362cd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/qax-os/excelize"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-129", "CWE-476" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-07T20:22:54Z",
    "nvd_published_at" : null
  }
}