GHSA-j49h-6577-5xwq

Suggest an improvement
Source
https://github.com/advisories/GHSA-j49h-6577-5xwq
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/01/GHSA-j49h-6577-5xwq/GHSA-j49h-6577-5xwq.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-j49h-6577-5xwq
Aliases
Published
2026-01-27T00:57:19Z
Modified
2026-02-03T03:05:45.673223Z
Severity
  • 5.9 (Medium) CVSS_V4 - CVSS:4.0/AV:A/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N CVSS Calculator
Summary
gmrtd ReadFile Vulnerable to Denial of Service via Excessive TLV Length Values
Details

Unbounded TLV length in ReadFile can cause Denial of Service

Summary

A Denial of Service vulnerability was identified in ReadFile() where unbounded TLV length values could lead to excessive CPU and memory usage when processing data from a malicious or non-compliant NFC source. This issue has been fixed by enforcing strict limits on acceptable TLV lengths.

Affected Versions

  • Affected: All versions prior to v0.17.2
  • Fixed in: v0.17.2

Details

ReadFile() processes BER-TLV encoded data returned from an NFC or APDU source via a Transceiver interface. Prior to the fix, the implementation did not enforce an upper bound on long-form TLV length values.

A malicious or non-compliant NFC endpoint could advertise an excessively large length (up to 4 GB), causing the library to:

  • Perform a very large number of read iterations
  • Allocate excessive memory
  • Consume significant CPU resources
  • Block execution for an extended period

While such lengths are unrealistic for compliant MRTD or ISO 7816 devices, they can be produced by emulated or malicious sources, or by untrusted inputs routed through higher-level APIs.

Impact

Applications using gmrtd to read data from NFC or APDU sources may experience:

  • Excessive CPU usage
  • Memory exhaustion
  • Application hangs or denial of service

No confidentiality or data integrity impact has been identified.

Resolution

This issue has been resolved in v0.17.2.

The fix introduces:

  • Enforcement of maximum allowable TLV lengths
  • Upper bounds on the number of read operations required to retrieve a file
  • Rejection of APDUs that exceed the requested response length

Recommendation

Users should upgrade to v0.17.2 or later.

No additional mitigation is required once the library is updated.

Credits

Discovered and reported by @ramrunner.

Database specific
{
    "github_reviewed_at": "2026-01-27T00:57:19Z",
    "severity": "MODERATE",
    "cwe_ids": [
        "CWE-400",
        "CWE-770"
    ],
    "github_reviewed": true,
    "nvd_published_at": "2026-01-27T21:16:03Z"
}
References

Affected packages

Go / github.com/gmrtd/gmrtd

Package

Name
github.com/gmrtd/gmrtd
View open source insights on deps.dev
Purl
pkg:golang/github.com/gmrtd/gmrtd

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.17.2

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/01/GHSA-j49h-6577-5xwq/GHSA-j49h-6577-5xwq.json"