Skip to main content

dasel CVE-2026-46377

| EUVDEUVD-2026-44995 MEDIUM
Improper Validation of Array Index (CWE-129)
2026-05-19 https://github.com/TomWright/dasel GHSA-m5j3-4634-c2vq
6.2
CVSS 3.1 · Vendor: https://github.com/TomWright/dasel
Share

Severity by source

Vendor (https://github.com/TomWright/dasel) PRIMARY
6.2 MEDIUM
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Primary rating from Vendor (https://github.com/TomWright/dasel) · only source for this CVE.

CVSS VectorVendor: https://github.com/TomWright/dasel

CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

Lifecycle Timeline

5
Patch available
Jul 16, 2026 - 22:19 EUVD
Severity Changed
Jul 16, 2026 - 19:22 NVD
HIGH MEDIUM
CVSS changed
Jul 16, 2026 - 19:22 NVD
7.5 (HIGH) 6.2 (MEDIUM)
Source Code Evidence Fetched
May 19, 2026 - 20:32 vuln.today
Analysis Generated
May 19, 2026 - 20:32 vuln.today

DescriptionCVE.org

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:

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
}

AnalysisAI

Denial of service in dasel (Go data selector library) v3.0.0 through v3.10.0 allows attackers who influence selector query strings to crash the host process via a 2-byte input. A trailing backslash inside a quoted selector (e.g., "\ or '\) triggers an index-out-of-range panic in the lexer's escape-sequence handler. Publicly available exploit code exists (PoC in the GHSA advisory), and no public exploit identified at time of analysis indicates in-the-wild abuse.

Technical ContextAI

dasel is a Go-based command-line tool and library for querying and modifying structured data (JSON, YAML, TOML, XML, CSV) using a selector syntax. The flaw lives in (*Tokenizer).parseCurRune at selector/lexer/tokenize.go:191-194, where the escape-sequence branch increments the position past a backslash and dereferences p.src[pos] without a bounds check. This maps to CWE-129 (Improper Validation of Array Index): the surrounding code correctly returns UnexpectedEOFError for unterminated quoted strings, but the escape path was overlooked. The affected CPE is pkg:go/github.com_tomwright_dasel_v3, covering the v3 module published at github.com/tomwright/dasel/v3.

RemediationAI

No vendor-released patch identified at time of analysis - the GHSA advisory (https://github.com/TomWright/dasel/security/advisories/GHSA-m5j3-4634-c2vq) lists no fixed version and the reporter confirms the bug persists on master. The reporter has proposed a one-line bounds check after the post-backslash pos++ that returns UnexpectedEOFError consistent with the existing unterminated-quote handling; downstream consumers can vendor this patch locally or pin a forked build until upstream merges a fix. As compensating controls, callers should validate or reject selector strings containing unescaped trailing backslashes before invoking the lexer, wrap dasel calls in a defer recover() to convert the panic into a handled error (trade-off: hides other genuine panics if too broad), or refuse to accept selectors from untrusted input entirely (trade-off: removes dynamic-query functionality). Monitor the upstream repository at https://github.com/TomWright/dasel for the fixed release.

Share

CVE-2026-46377 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy