CVE-2026-46377: Dasel Index-out-of-range Panic Vulnerability

HIGH
Advisory Identifier: GHSA-m5j3-4634-c2vq
CVSS 7.5
CWE-129
Published
Advisory Summary

CVE-2026-46377 is a HIGH (CVSS 7.5) index-out-of-range panic vulnerability (CWE-129: Improper Validation of Array Index) affecting Dasel libraries in the Go ecosystem. The issue involves index-out-of-range panic in dasel selector lexer on trailing backslash in quoted string. Remediation is available in the latest vendor maintenance releases.

CVE-2026-46377 at a Glance

CVE Identifier CVE-2026-46377
GHSA Identifier GHSA-m5j3-4634-c2vq
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-129: Improper Validation of Array Index
Affected Product Dasel
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.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:N/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 None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-46377

To remediate this vulnerability, upgrade all affected Dasel 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/tomwright/dasel/v3 fixed: Latest secure release
Upgrade github.com/tomwright/dasel/v3 to Latest secure release
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/tomwright/dasel/v3

How to Check if You Are Affected

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

inspect dependencies for github.com/tomwright/dasel/v3

Analyze the terminal output to locate any version of Dasel in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), 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 Dasel, 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 `dasel`'s selector lexer panics with an index-out-of-range error when tokenizing a quoted string that ends with a trailing backslash (e.g., `"\` or `'\`). A 2-byte input causes an immediate process crash via Go runtime panic. I confirmed the issue on `v3.3.1` (`fba653c7f248aff10f2b89fca93929b64707dfc8`) and on `master` commit `0dd6132e0c58edbd9b1a5f7ffd00dfab1e6085ad`. I also verified the same code path is present in `v3.0.0` (`648f83baf070d9e00db8ff312febef857ec090a3`). No fix is available yet. ### Details The bug is in the escape sequence handler within `(*Tokenizer).parseCurRune` in [`selector/lexer/tokenize.go#L191-L194`](https://github.com/TomWright/dasel/blob/fba653c7f248aff10f2b89fca93929b64707dfc8/selector/lexer/tokenize.go#L191-L194): ```go if p.src[pos] == '\\' { pos++ buf = append(buf, rune(p.src[pos])) // line 193: no bounds check pos++ continue } ``` When a backslash is the last character inside quotes, `pos++` increments the position past the end of the input. The subsequent `p.src[pos]` attempts to read past the end of the slice, which Go turns into a runtime panic: `runtime error: index out of range [2] with length 2`. Notably, the same function already handles unterminated quoted strings by returning `UnexpectedEOFError`, but the escape sequence path does not perform a similar bounds check. Minimal trigger: `"\` or `'\` (2 bytes) Test environment: - MacBook Air (Apple M2), macOS / Darwin `arm64` - Go `1.26.1` - dasel `v3.3.1` (`fba653c7f248aff10f2b89fca93929b64707dfc8`) ### PoC ```go package main import ( "fmt" "runtime" "runtime/debug" "github.com/tomwright/dasel/v3/selector/lexer" ) func main() { fmt.Printf("Go version: %s\n", runtime.Version()) fmt.Printf("GOARCH: %s\n", runtime.GOARCH) fmt.Println() for _, input := range []string{`"\`, `'\`} { fmt.Printf("Input: %s\n", input) func() { defer func() { if r := recover(); r != nil { fmt.Printf("PANIC: %v\n", r) debug.PrintStack() } }() t := lexer.NewTokenizer(input) tokens, err := t.Tokenize() if err != nil { fmt.Printf("Error: %v\n", err) } else { fmt.Printf("OK: %d tokens\n", len(tokens)) } }() fmt.Println() } } ``` Observed output on `v3.3.1` in the test environment above: ```text Go version: go1.26.1 GOARCH: arm64 Input: "\ PANIC: runtime error: index out of range [2] with length 2 goroutine 1 [running]: ... github.com/tomwright/dasel/v3/selector/lexer.(*Tokenizer).parseCurRune(...) .../selector/lexer/tokenize.go:193 +0x1c2c ... Input: '\ PANIC: runtime error: index out of range [2] with length 2 goroutine 1 [running]: ... github.com/tomwright/dasel/v3/selector/lexer.(*Tokenizer).parseCurRune(...) .../selector/lexer/tokenize.go:193 +0x1c2c ... ``` ### Impact An attacker who can control or influence the selector/query string passed to dasel can trigger a Go runtime panic and crash the process unless the caller explicitly recovers from panics. The selector string is typically provided by the application developer, but there are deployment scenarios where it may be attacker-influenced: - Web applications using dasel for dynamic data querying - Applications that construct selectors from user input - Shared tooling environments where selectors are passed as parameters ### Suggested Fix Add a bounds check after incrementing `pos` past the backslash, consistent with the existing `UnexpectedEOFError` handling for unterminated quoted strings: ```go if p.src[pos] == '\\' { pos++ if pos >= p.srcLen { return Token{}, &UnexpectedEOFError{Pos: pos} } buf = append(buf, rune(p.src[pos])) pos++ continue } ```

CVE-2026-46377 Affected Dasel Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/tomwright/dasel/v3
Go
≥ 3.0.0
≤ 3.10.0

References

Frequently Asked Questions

What is CVE-2026-46377?
CVE-2026-46377 is a security vulnerability in Dasel involving Index-out-of-range panic in dasel selector lexer on trailing backslash in quoted string under CWE-129: Improper Validation of Array Index.
Which Dasel versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/tomwright/dasel/v3.
What version fixes CVE-2026-46377?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/tomwright/dasel/v3 affected?
Yes, github.com/tomwright/dasel/v3 is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-46377?
CVE-2026-46377 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-46377?
CVE-2026-46377 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-46377?
Run the dependency tree command: 'inspect dependencies for github.com/tomwright/dasel/v3'. 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-m5j3-4634-c2vq",
  "modified" : "2026-05-19T20:08:12Z",
  "published" : "2026-05-19T20:08:12Z",
  "aliases" : [ "CVE-2026-46377" ],
  "summary" : "Dasel: Index-out-of-range panic in dasel selector lexer on trailing backslash in quoted string",
  "details" : "### Summary\n\n`dasel`'s selector lexer panics with an index-out-of-range error when tokenizing a quoted string that ends with a trailing backslash (e.g., `\"\\` or `'\\`). A 2-byte input causes an immediate process crash via Go runtime panic.\n\nI confirmed the issue on `v3.3.1` (`fba653c7f248aff10f2b89fca93929b64707dfc8`) and on `master` commit `0dd6132e0c58edbd9b1a5f7ffd00dfab1e6085ad`. I also verified the same code path is present in `v3.0.0` (`648f83baf070d9e00db8ff312febef857ec090a3`). No fix is available yet.\n\n### Details\n\nThe bug is in the escape sequence handler within `(*Tokenizer).parseCurRune` in [`selector/lexer/tokenize.go#L191-L194`](https://github.com/TomWright/dasel/blob/fba653c7f248aff10f2b89fca93929b64707dfc8/selector/lexer/tokenize.go#L191-L194):\n\n```go\nif p.src[pos] == '\\\\' {\n    pos++\n    buf = append(buf, rune(p.src[pos]))  // line 193: no bounds check\n    pos++\n    continue\n}\n```\n\nWhen a backslash is the last character inside quotes, `pos++` increments the position past the end of the input. The subsequent `p.src[pos]` attempts to read past the end of the slice, which Go turns into a runtime panic: `runtime error: index out of range [2] with length 2`.\n\nNotably, the same function already handles unterminated quoted strings by returning `UnexpectedEOFError`, but the escape sequence path does not perform a similar bounds check.\n\nMinimal trigger: `\"\\` or `'\\` (2 bytes)\n\nTest environment:\n\n- MacBook Air (Apple M2), macOS / Darwin `arm64`\n- Go `1.26.1`\n- dasel `v3.3.1` (`fba653c7f248aff10f2b89fca93929b64707dfc8`)\n\n### PoC\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n\t\"runtime/debug\"\n\n\t\"github.com/tomwright/dasel/v3/selector/lexer\"\n)\n\nfunc main() {\n\tfmt.Printf(\"Go version: %s\\n\", runtime.Version())\n\tfmt.Printf(\"GOARCH: %s\\n\", runtime.GOARCH)\n\tfmt.Println()\n\n\tfor _, input := range []string{`\"\\`, `'\\`} {\n\t\tfmt.Printf(\"Input: %s\\n\", input)\n\t\tfunc() {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tfmt.Printf(\"PANIC: %v\\n\", r)\n\t\t\t\t\tdebug.PrintStack()\n\t\t\t\t}\n\t\t\t}()\n\t\t\tt := lexer.NewTokenizer(input)\n\t\t\ttokens, err := t.Tokenize()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"OK: %d tokens\\n\", len(tokens))\n\t\t\t}\n\t\t}()\n\t\tfmt.Println()\n\t}\n}\n```\n\nObserved output on `v3.3.1` in the test environment above:\n\n```text\nGo version: go1.26.1\nGOARCH: arm64\n\nInput: \"\\\nPANIC: runtime error: index out of range [2] with length 2\ngoroutine 1 [running]:\n...\ngithub.com/tomwright/dasel/v3/selector/lexer.(*Tokenizer).parseCurRune(...)\n    .../selector/lexer/tokenize.go:193 +0x1c2c\n...\n\nInput: '\\\nPANIC: runtime error: index out of range [2] with length 2\ngoroutine 1 [running]:\n...\ngithub.com/tomwright/dasel/v3/selector/lexer.(*Tokenizer).parseCurRune(...)\n    .../selector/lexer/tokenize.go:193 +0x1c2c\n...\n```\n\n### Impact\n\nAn attacker who can control or influence the selector/query string passed to dasel can trigger a Go runtime panic and crash the process unless the caller explicitly recovers from panics.\n\nThe selector string is typically provided by the application developer, but there are deployment scenarios where it may be attacker-influenced:\n- Web applications using dasel for dynamic data querying\n- Applications that construct selectors from user input\n- Shared tooling environments where selectors are passed as parameters\n\n### Suggested Fix\n\nAdd a bounds check after incrementing `pos` past the backslash, consistent with the existing `UnexpectedEOFError` handling for unterminated quoted strings:\n\n```go\nif p.src[pos] == '\\\\' {\n    pos++\n    if pos >= p.srcLen {\n        return Token{}, &UnexpectedEOFError{Pos: pos}\n    }\n    buf = append(buf, rune(p.src[pos]))\n    pos++\n    continue\n}\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/tomwright/dasel/v3"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "last_affected" : "3.10.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/TomWright/dasel/security/advisories/GHSA-m5j3-4634-c2vq"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/TomWright/dasel"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-129" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-19T20:08:12Z",
    "nvd_published_at" : null
  }
}