# CVE-2021-27918: Infinite loop when decoding inputs in encoding/xml

- Severity: High 7.5 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 2.47%, higher than 84% of CVEs (2026-12-01)
- Published: 2021-03-10T23:54:43.000Z
- Modified: 2026-09-08T08:47:46.714Z
- Also known as: GO-2021-0234, BIT-GOLANG-2021-27918
- Weaknesses: CWE-835
- Assigned by: mitre

## Description

encoding/xml in Go before 1.15.9 and 1.16.x before 1.16.1 has an infinite loop if a custom TokenReader (for xml.NewTokenDecoder) returns EOF in the middle of an element. This can occur in the Decode, DecodeElement, or Skip method.

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- stdlib (Go): before 1.15.9; from 1.16.0-0 before 1.16.1
- golang go: before 1.15.9; from 1.16.0 before 1.16.1
- golang (Bitnami): before 1.15.9; from 1.16.0 before 1.16.1

## Every score

- NVD: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- NVD: CVSS:2.0 5.0 Medium `AV:N/AC:L/Au:N/C:N/I:N/A:P`
- Bitnami Vulnerability Database: rating High

## References

- <https://groups.google.com/g/golang-announce/c/MfiLYjG-RAw> (advisory, mailing-list, third-party-advisory, web)
- <https://security.gentoo.org/glsa/202208-02> (advisory, third-party-advisory, vendor-advisory)
- <https://go.dev/cl/300391> (fix)
- <https://go.googlesource.com/go/+/d0b79e3513a29628f3599dc8860666b6eed75372> (fix)
- <https://go.dev/issue/44913> (report)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-27918> (web)

## Sources

- CVE List: [CVE-2021-27918](https://www.cve.org/CVERecord?id=CVE-2021-27918), CVE Terms of Use, modified 2024-08-03
- Go Vulnerability Database: [GO-2021-0234](https://pkg.go.dev/vuln/GO-2021-0234), CC-BY-4.0, modified 2024-05-20
- NVD: [CVE-2021-27918](https://nvd.nist.gov/vuln/detail/CVE-2021-27918), Public domain, modified 2026-06-17
- Bitnami Vulnerability Database: [BIT-GOLANG-2021-27918](https://osv.dev/vulnerability/BIT-GOLANG-2021-27918), Apache-2.0, modified 2026-09-08

---

Page: https://cve.day/CVE-2021-27918 · Whole record: https://cve.day/CVE-2021-27918.json · Rebuilt by cve.day 2026-11-25T22:58:00.233Z
