//nefariousplan

CVE-2026-41178: opentelemetry-go's Baggage DoS Shipped Under "Fixed" In The CHANGELOG

vendor

pattern

cve

proof of concept

opentelemetry-go pull request 7880 was titled Comply with W3C Baggage specification limits. The merge commit landed on 2026-02-28 and shipped in v1.41.0 four days later. Its only baggage-package line in the v1.41.0 CHANGELOG is filed under Fixed. The PR removed two upfront length checks on the grounds that the W3C Baggage specification does not require them. The W3C Baggage specification governs what propagators MUST preserve through cooperating systems. It does not govern what parsers MAY reject from adversaries. CVE-2026-41178 is what happens when a maintainer reads those two sentences as the same statement.

The PR deleted two guards and added a new write to the global logger

CVE-2026-41178 was disclosed as GHSA-5wrp-cwcj-q835 on 2026-05-28. Before PR #7880, baggage/baggage.go declared three resource limits and used them as three independent guards:

const (
    maxMembers               = 180
    maxBytesPerMembers       = 4096
    maxBytesPerBaggageString = 8192
)

Parse rejected the raw header before parsing it if the input exceeded 8192 bytes:

if n := len(bStr); n > maxBytesPerBaggageString {
    return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n)
}

parseMember rejected each member before percent-decoding it if the member exceeded 4096 bytes:

func parseMember(member string) (Member, error) {
    if n := len(member); n > maxBytesPerMembers {
        return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n)
    }
    ...

PR #7880 deleted both. The PR description explains why, in Sam Xie's own words:

Removed maxBytesPerMembers (4096), this per-member limit was not part of the W3C spec

The maxBytesPerMembers constant disappeared from the source and so did the parseMember length check that read it. The Parse-level upfront len(bStr) check disappeared as well. The PR description framed the replacement as "Added limit checking in extractMultiBaggage for multiple baggage headers," and the replacement is a counter that runs inside the parse loop, summing the byte size of admitted valid members:

if newTotalBytes > maxBytesPerBaggageString {
    truncateErr = errors.Join(truncateErr, errBaggageBytes)
    break
}

That counter only advances when parseMember returns a Member, that is, when the member is valid. An invalid member takes the other branch:

m, err := parseMember(memberStr)
if err != nil {
    truncateErr = errors.Join(truncateErr, err)
    continue // skip invalid member, keep processing
}

The continue walks the loop forward. The byte-size counter never advances. A header whose every member is invalid never trips the budget, because the budget counts only successful admissions. There is no upper bound on how many invalid members the loop processes.

That was the first half of the change. The second half was in propagation/baggage.go. Before #7880, extractSingleBaggage silently dropped parse errors:

bag, err := baggage.Parse(bStr)
if err != nil {
    return parent
}

After #7880, every parse error is forwarded to the global error handler:

bag, err := baggage.Parse(bStr)
if err != nil {
    errorhandler.GetErrorHandler().Handle(err)
}
if bag.Len() == 0 {
    return parent
}

errorhandler.GetErrorHandler() defaults to a handler that writes a log.Print line to stderr.

Removing a per-member length limit because a spec does not require it is a reasonable code-hygiene argument in isolation. Forwarding parse errors to the global error handler so operators can observe them is a reasonable observability argument in isolation. Neither half is the bug. The composition is the bug. After PR #7880, an attacker-controlled baggage header of any size is fully tokenized and percent-decoded; every member that fails parsing has its name appended to an errors.Join chain; the joined error is then handed to a logger that writes a stderr line per member.

The PoC measures the amplification

Robert Pająk's published PoC is forty-four lines of Go. The interesting loop is six:

const n = 5000
var b strings.Builder
b.Grow(n * 8)
for i := 0; i < n; i++ {
    if i > 0 {
        b.WriteByte(',')
    }
    fmt.Fprintf(&b, "bad%04d", i)
}
input := b.String()

Each member is the literal string bad0000, bad0001, through bad4999. None contain =. None are valid baggage members. The constructed input is 39,999 bytes; the W3C-spec upper bound for a baggage header is 8,192 bytes. The PoC then calls baggage.Parse(input) and times it. The committed stdout.log:

input_len=39999 members=5000 bag_len=0 err_len=194999 contains_last=true dur=5.961434ms

err_len=194999 is the size of the joined error string baggage.Parse returned. The error string contains the literal name of every invalid member, comma-joined. The PoC's contains_last=true confirms that bad4999, the 5000th invalid member, made it into the error string; the parser walked the full input.

The PoC's second call is propagation.Baggage{}.Extract, which routes the same input through the propagator and lands the joined error on the global error handler. The committed stderr.log has 5,000 lines:

2026/04/09 20:43:06 invalid baggage list-member: "bad0000"
invalid baggage list-member: "bad0001"
invalid baggage list-member: "bad0002"
...
invalid baggage list-member: "bad4998"
invalid baggage list-member: "bad4999"

Five thousand log lines per request. ~6 ms of CPU per request. ~195 KB of stderr per request. For one inbound header that never produced a single valid member.

Sam Xie wrote the fix and benchmarked it. The ParseOversized row from the PR #8222 body:

                   |  before (#7880)  |     after (#8222)    |
                   |     sec/op       |   sec/op             |
ParseOversized-10  |  22544795.0 ±1%  |   130.8 ±4%  -100.00%|
                   |      B/op        |     B/op             |
ParseOversized-10  |  801126.5 ±0%    |   88.0 ±0%   -99.99% |
                   |   allocs/op      |   allocs/op          |
ParseOversized-10  |  250007.0 ±0%    |    3.0 ±0%  -100.00% |

22 ms of CPU, 800 KB of allocations, and 250,000 heap allocations per parse of an oversized header. The post-fix numbers are 130 ns, 88 bytes, and 3 allocations. The benchmark was attached to the merged fix PR; the author of the fix is the author of the regression three months earlier.

The fix has three independent mitigations because the primitive has three multipliers

The patch is not one commit. It is two commits, by two different maintainers, addressing three different amplification sites in the request path. The structural shape of the fix is the structural shape of what the primitive cost.

Mitigation 1: restore the upfront raw-length check. Sam Xie's PR #8222, merged 2026-05-20:

+if n := len(bStr); n > maxBytesPerBaggageString {
+    return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n)
+}
+
 b := make(baggage.List)

The check that was in Parse before PR #7880, returning to Parse, against the same maxBytesPerBaggageString = 8192 constant. The deletion was reverted under the new framing "Add max baggage length as limitation."

Mitigation 2: cap accumulated error names per joined error. Same PR, separately:

 const (
+    maxParseErrors = 5
+
     maxMembers               = 64
     maxBytesPerBaggageString = 8192
 )

And in the loop:

 m, err := parseMember(memberStr)
 if err != nil {
-    truncateErr = errors.Join(truncateErr, err)
+    parseErrors++
+    if parseErrors <= maxParseErrors {
+        truncateErr = errors.Join(truncateErr, err)
+    }
     continue
 }

After the loop:

+if dropped := parseErrors - maxParseErrors; dropped > 0 {
+    truncateErr = errors.Join(truncateErr, fmt.Errorf("and %d more invalid member(s)", dropped))
+}

The joined error now contains at most five member names plus a summary count. The PoC's 195 KB error string would be approximately 200 bytes under this cap. The amplification ratio drops from "size of error scales linearly with attacker member count" to "size of error is a constant."

Mitigation 3: a process-lifetime sync.Once on every call into the global error handler. Robert Pająk's f02feacf8, the security-track commit merged 2026-05-26, message body Merge commit from fork:

+// handleExtractErrOnce limits error reporting for attacker-controlled baggage headers
+// to one process-wide emission, preventing repeated extraction from flooding logs.
+var handleExtractErrOnce sync.Once

Wrapped around every error handler call in the propagator:

 bag, err := baggage.Parse(bStr)
 if err != nil {
-    errorhandler.GetErrorHandler().Handle(err)
+    handleExtractErrOnce.Do(func() {
+        errorhandler.GetErrorHandler().Handle(err)
+    })
 }

The sync.Once is package-global and lives for the lifetime of the process. After the first malformed baggage header any service receives, the global error handler is never invoked for any baggage extraction error, on any header, on any request, for the remaining lifetime of the process. The mitigation reads as a rate-limit; it is not a rate-limit. It is an admission that attacker-controlled input cannot be trusted to drive any code path that synthesizes log output, ever, and the only mitigation the maintainers were willing to commit to was zero-after-one.

Three checks added or restored. The CHANGELOG entry that introduced the primitive removed two checks and added a new write to a logger. The arithmetic is straightforward.

The advisory's affected-version ranges do not match the source tree

The published CVE-2026-41178 advisory lists four vulnerability rows, two per affected Go package (go.opentelemetry.io/otel/baggage and go.opentelemetry.io/otel/propagation), and encodes them as two distinct version ranges per package:

vulnerable_version_range: "= 1.41.0",  first_patched_version: "1.42.0"
vulnerable_version_range: "= 1.43.0",  first_patched_version: "1.44.0"

The advisory's narrative text reinforces the framing: "Versions 1.41.0 and 1.43.0 removed raw-length rejection... Versions 1.42.0 and 1.44.0 fix the issue."

The git tree disagrees. The blob hashes for the two affected files at each release tag:

$ git ls-tree v1.41.0 baggage/baggage.go propagation/baggage.go
100644 blob 878ffbe43a52aebca6b70de2da2dbbe306990f9c  baggage/baggage.go
100644 blob 2ecca3fed1ec937527f6bcf0d2aa611baa531ce5  propagation/baggage.go

$ git ls-tree v1.42.0 baggage/baggage.go propagation/baggage.go
100644 blob 878ffbe43a52aebca6b70de2da2dbbe306990f9c  baggage/baggage.go
100644 blob 2ecca3fed1ec937527f6bcf0d2aa611baa531ce5  propagation/baggage.go

$ git ls-tree v1.43.0 baggage/baggage.go propagation/baggage.go
100644 blob 878ffbe43a52aebca6b70de2da2dbbe306990f9c  baggage/baggage.go
100644 blob 2ecca3fed1ec937527f6bcf0d2aa611baa531ce5  propagation/baggage.go

$ git ls-tree v1.44.0 baggage/baggage.go propagation/baggage.go
100644 blob b290c6d6cc86d6718394036370d981361c2f0823  baggage/baggage.go
100644 blob d81b709a2c15db85f710ffe30ec0f5f06c855e49  propagation/baggage.go

The bytes of both affected files are identical across v1.41.0, v1.42.0, and v1.43.0. The fix landed once, in v1.44.0. The CHANGELOG for v1.42.0 contains no baggage entry under any heading. The advisory's "1.41.0, fixed in 1.42.0" range describes a fix the code does not contain. The narrative of a regression that was removed and reintroduced describes a sequence of events that did not happen. The actual history is one introduction in v1.41.0, three minor releases (v1.41.0, v1.42.0, v1.43.0) shipping the regression byte-for-byte unchanged, one fix in v1.44.0. A consumer reading the advisory and pinning v1.42.0 retains the full primitive.

Compliance removed the check

The W3C Baggage specification is a propagation contract. It defines what cooperating systems MUST exchange and what they MAY drop. From §3.3.2 Limits:

A platform MUST propagate all list-members including any list-members added by the platform whenever both of these conditions are met:

  • Condition 1: The resulting baggage-string contains 64 list-members or less.
  • Condition 2: The resulting baggage-string is of size 8192 bytes or less.

... Note that the above limits are minimum requirements to comply with the specification. An implementor or platform MAY define higher limits and SHOULD propagate as much baggage information as is reasonable within their requirements.

The 8192-byte and 64-member values are minimum forwarding guarantees, with explicit permission to define higher limits. PR #7880's framing inverted the contract. The MAY-define-higher language was treated as authority to drop the upfront rejection. The MUST-propagate language for inputs under 8192 bytes was treated as a prohibition on rejecting inputs over 8192 bytes upfront. The spec said "you MUST accept at least this much for interoperability." The code read "you MUST NOT reject anything before parsing."

The spec is silent on what a parser does with an oversized adversarial input. Silence in a propagation contract is not authority. The two checks PR #7880 removed were defense-in-depth budgets on parser work, not propagation policy. They were justified by the parser's threat model (a network handler accepts any bytes a remote sends); the standard's job is to constrain cooperating systems, not to encode the parser's threat model. Conflating the two is how the checks were removed. This is Compliance Removed The Check, the parser-against-network instance: a defense-in-depth budget is deleted because a referenced standard does not require it, and the referenced standard does not address the threat the budget was for.

PR #7880's CHANGELOG entry, verbatim:

Update Baggage in go.opentelemetry.io/otel/propagation and Parse and New in go.opentelemetry.io/otel/baggage to comply with W3C Baggage specification limits. New and Parse now return partial baggage along with an error when limits are exceeded. Errors from baggage extraction are reported to the global error handler. (#7880)

The verb is "comply." The heading is "Fixed." A consumer reading the v1.41.0 CHANGELOG saw a defense-in-depth tightening and a new observability hook. The runtime saw a 22 ms CPU charge, 800 KB of allocations, and 250,000 heap allocations per attacker request.

PoC: open-telemetry/opentelemetry-go GHSA-5wrp-cwcj-q835

Three mitigations in the patch, three multipliers in the primitive, and a process-lifetime sync.Once on the global error handler is what the maintainers were willing to commit to once they decided baggage extraction errors could not be trusted to drive log output at all.