Vulnerabilities in pkg:golang/github.com/gotd/td

PACKAGE
Advisory Identifier: GHSA-whmm-qj9r-wvr2
Advisory Summary

CVE-2026-54638 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-789: Memory Allocation with Excessive Size Value) affecting Github.com/gotd/td libraries in the Go ecosystem. The issue involves td has pre-auth denial of service via unbounded memory allocation in proto.unencryptedmessage.decode. Remediation is available by upgrading affected packages to version 0.145.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/gotd/td

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/gotd/td. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-whmm-qj9r-wvr2 CVE-2026-54638 HIGH td has pre-auth denial of service via unbounded memory allocation in proto.UnencryptedMessage.Decode

CVE-2026-54638 at a Glance

CVE Identifier CVE-2026-54638
GHSA Identifier GHSA-whmm-qj9r-wvr2
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-789: Memory Allocation with Excessive Size Value
Affected Product Github.com/gotd/td
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-54638

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

github.com/gotd/td fixed: 0.145.1
Upgrade github.com/gotd/td to 0.145.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gotd/td

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-54638, inspect your project dependencies for Github.com/gotd/td:

inspect dependencies for github.com/gotd/td

Analyze the terminal output to locate any version of Github.com/gotd/td in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.145.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-789: Memory Allocation with Excessive Size Value, where the product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated. In Github.com/gotd/td, 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

### Impact A remote, unauthenticated attacker can cause excessive memory allocation (and resulting CPU / GC pressure, potentially OOM termination) by sending a crafted unencrypted MTProto packet. `(*proto.UnencryptedMessage).Decode` read an attacker-controlled 32-bit `dataLen` field and immediately allocated a buffer of that size via `make([]byte, dataLen)` **before** validating that the underlying buffer actually contained that many bytes. A 20-byte packet declaring a ~1.75 GB payload (e.g. `dataLen = 0x70000000`) forces the runtime to provision and zero-initialize a multi-gigabyte heap allocation before the length is rejected. Unencrypted messages are part of the unauthenticated MTProto handshake path, so no credentials or established session are required to reach the vulnerable code. Impact is limited to availability; there is no evidence of memory corruption, out-of-bounds access, or code execution. ### Patches Fixed in **v0.145.1** by validating `dataLen` against the remaining buffer length before allocation (commit `9d5d1f31e`). ### Workarounds Upgrade to v0.145.1 or later. There is no in-process workaround for affected versions short of avoiding exposure of the unauthenticated MTProto parsing path to untrusted peers.

CVE-2026-54638 Affected Github.com/gotd/td Versions

1 component(s)
Fixed Versions:
0.145.1
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gotd/td
Go
< 0.145.1
0.145.1

References

Frequently Asked Questions

What is CVE-2026-54638?
CVE-2026-54638 is a security vulnerability in Github.com/gotd/td involving td has pre-auth denial of service via unbounded memory allocation in proto.UnencryptedMessage.Decode under CWE-789: Memory Allocation with Excessive Size Value.
Which Github.com/gotd/td versions are affected?
Affected versions include releases prior to 0.145.1 across affected packages: github.com/gotd/td.
What version fixes CVE-2026-54638?
Upgrading to 0.145.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gotd/td affected?
Yes, github.com/gotd/td is affected in releases prior to 0.145.1. Upgrade your dependency to 0.145.1 or later.
What is the CVSS score of CVE-2026-54638?
CVE-2026-54638 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-54638?
CVE-2026-54638 is classified under CWE-789: Memory Allocation with Excessive Size Value (The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.).
How can I check Go dependencies for CVE-2026-54638?
Run the dependency tree command: 'inspect dependencies for github.com/gotd/td'. 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-whmm-qj9r-wvr2",
  "modified" : "2026-07-28T22:15:28Z",
  "published" : "2026-07-28T22:15:28Z",
  "aliases" : [ "CVE-2026-54638" ],
  "summary" : "td has pre-auth denial of service via unbounded memory allocation in proto.UnencryptedMessage.Decode",
  "details" : "### Impact\n\nA remote, unauthenticated attacker can cause excessive memory allocation (and resulting CPU / GC pressure, potentially OOM termination) by sending a crafted unencrypted MTProto packet.\n\n`(*proto.UnencryptedMessage).Decode` read an attacker-controlled 32-bit `dataLen` field and immediately allocated a buffer of that size via `make([]byte, dataLen)` **before** validating that the underlying buffer actually contained that many bytes. A 20-byte packet declaring a ~1.75 GB payload (e.g. `dataLen = 0x70000000`) forces the runtime to provision and zero-initialize a multi-gigabyte heap allocation before the length is rejected.\n\nUnencrypted messages are part of the unauthenticated MTProto handshake path, so no credentials or established session are required to reach the vulnerable code.\n\nImpact is limited to availability; there is no evidence of memory corruption, out-of-bounds access, or code execution.\n\n### Patches\n\nFixed in **v0.145.1** by validating `dataLen` against the remaining buffer length before allocation (commit `9d5d1f31e`).\n\n### Workarounds\n\nUpgrade to v0.145.1 or later. There is no in-process workaround for affected versions short of avoiding exposure of the unauthenticated MTProto parsing path to untrusted peers.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gotd/td"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.145.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gotd/td/security/advisories/GHSA-whmm-qj9r-wvr2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gotd/td/issues/1711"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gotd/td/commit/9d5d1f31ea5022d9798d84ccce15de2e91ba6baa"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gotd/td"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gotd/td/releases/tag/v0.145.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770", "CWE-789" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-28T22:15:28Z",
    "nvd_published_at" : null
  }
}