5.9medium
gmrtd ReadFile Vulnerable to Denial of Service via Excessive TLV Length Values
- Severity
- 5.9medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.28% (higher than 22% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-j49h-6577-5xwqGO-2026-4379
Description
gmrtd is a Go library for reading Machine Readable Travel Documents (MRTDs). Prior to version 0.17.2, ReadFile accepts TLVs with lengths that can range up to 4GB, which can cause unconstrained resource consumption in both memory and cpu cycles. ReadFile can consume an extended TLV with lengths well outside what would be available in ICs. It can accept something all the way up to 4GB which would take too many iterations in 256 byte chunks, and would also try to allocate memory that might not be available in constrained environments like phones. Or if an API sends data to ReadFile, the same problem applies. The very small chunked read also locks the goroutine in accepting data for a very large number of iterations. projects using the gmrtd library to read files from NFCs can experience extreme slowdowns or memory consumption. A malicious NFC can just behave like the mock transceiver described above and by just sending dummy bytes as each chunk to be read, can make the receiving thread unresponsive and fill up memory on the host system. Version 0.17.2 patches the issue.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gmrtd gmrtd | < 0.17.2, before 0.17.2 | CVE List, NVD |
| github.com/gmrtd/gmrtd (Go) | before 0.17.2 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 5.9medium CVSS:4.0 | 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 |
| GitHub | medium CVSS:4.0 | 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 |
| NVD | 6.5medium CVSS:3.1 | CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
What each source says
CVE List
gmrtd is a Go library for reading Machine Readable Travel Documents (MRTDs). Prior to version 0.17.2, ReadFile accepts TLVs with lengths that can range up to 4GB, which can cause unconstrained resource consumption in both memory and cpu cycles. ReadFile can consume an extended TLV with lengths well outside what would be available in ICs. It can accept something all the way up to 4GB which would take too many iterations in 256 byte chunks, and would also try to allocate memory that might not be available in constrained environments like phones. Or if an API sends data to ReadFile, the same problem applies. The very small chunked read also locks the goroutine in accepting data for a very large number of iterations. projects using the gmrtd library to read files from NFCs can experience extreme slowdowns or memory consumption. A malicious NFC can just behave like the mock transceiver described above and by just sending dummy bytes as each chunk to be read, can make the receiving thread unresponsive and fill up memory on the host system. Version 0.17.2 patches the issue.
GitHub Advisory Database
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.
Go Vulnerability Database
gmrtd ReadFile Vulnerable to Denial of Service via Excessive TLV Length Values in github.com/gmrtd/gmrtd
NVD (es)
gmrtd es una librería Go para leer Documentos de Viaje de Lectura Mecánica (MRTDs). Antes de la versión 0.17.2, ReadFile acepta TLVs con longitudes que pueden oscilar hasta 4GB, lo que puede causar un consumo de recursos sin restricciones tanto en memoria como en ciclos de CPU. ReadFile puede consumir un TLV extendido con longitudes muy superiores a lo que estaría disponible en los ICs. Puede aceptar algo de hasta 4GB, lo que requeriría demasiadas iteraciones en bloques de 256 bytes, y también intentaría asignar memoria que podría no estar disponible en entornos restringidos como los teléfonos. O si una API envía datos a ReadFile, el mismo problema se aplica. La lectura en bloques muy pequeños también bloquea la goroutine al aceptar datos durante un número muy grande de iteraciones. Los proyectos que utilizan la librería gmrtd para leer archivos de NFCs pueden experimentar ralentizaciones extremas o consumo de memoria. Un NFC malicioso puede simplemente comportarse como el transceptor simulado descrito anteriormente y, simplemente enviando bytes ficticios como cada bloque a leer, puede hacer que el hilo receptor no responda y llenar la memoria del sistema anfitrión. La versión 0.17.2 corrige el problema.
References
| https://github.com/gmrtd/gmrtd/security/advisories/GHSA-j49h-6577-5xwq | advisory, vendor-advisory, web | |
| https://github.com/gmrtd/gmrtd/commit/54469a95e5a20a8602ac1457b2110bfeb80c8891 | fix, patch, web | |
| https://github.com/gmrtd/gmrtd/releases/tag/v0.17.2 | product, release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-24738 | advisory | |
| https://github.com/gmrtd/gmrtd | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-24738 changed 2026-01-28 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-j49h-6577-5xwq changed 2026-02-03 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-4379 changed 2026-03-03 | CC-BY-4.0 |
| NVD | CVE-2026-24738 changed 2026-06-17 | Public domain |