# CVE-2021-36159: libfetch before 2021-07-26, as used in apk-tools, xbps, and other products, mishandles numeric strings for the FTP and HTTP protocols.

- Severity: Critical 9.1 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/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.64%, higher than 85% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2021-08-03T13:22:54.000Z
- Modified: 2026-06-17T03:58:26.080Z
- Weaknesses: CWE-125
- Assigned by: mitre

## Description

libfetch before 2021-07-26, as used in apk-tools, xbps, and other products, mishandles numeric strings for the FTP and HTTP protocols. The FTP passive mode implementation allows an out-of-bounds read because strtol is used to parse the relevant numbers into address bytes. It does not check if the line ends prematurely. If it does, the for-loop condition checks for the '\0' terminator one byte too late.

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- freebsd libfetch: before 2021-07-26

## Every score

- NVD: CVSS:3.1 9.1 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H`
- NVD: CVSS:2.0 6.4 Medium `AV:N/AC:L/Au:N/C:P/I:N/A:P`

## References

- <https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10749> (exploit, third-party-advisory)
- <https://github.com/freebsd/freebsd-src/commits/main/lib/libfetch> (patch, third-party-advisory)
- <https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc%40%3Cdev.kafka.apache.org%3E> (mailing-list)
- <https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc%40%3Cusers.kafka.apache.org%3E> (mailing-list)
- <https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7%40%3Cusers.kafka.apache.org%3E> (mailing-list)
- <https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7%40%3Cdev.kafka.apache.org%3E> (mailing-list)

## Sources

- CVE List: [CVE-2021-36159](https://www.cve.org/CVERecord?id=CVE-2021-36159), CVE Terms of Use, modified 2024-08-04
- NVD: [CVE-2021-36159](https://nvd.nist.gov/vuln/detail/CVE-2021-36159), Public domain, modified 2026-06-17

---

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