{"id":"CVE-2021-36159","aliases":["ALPINE-CVE-2021-36159","BELL-CVE-2021-36159","EUVD-2021-22783","GHSA-cqp5-89fm-vp89"],"status":"published","title":"libfetch before 2021-07-26, as used in apk-tools, xbps, and other products, mishandles numeric...","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.","severity":{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-11","score":0.02637,"percentile":0.85758,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-125"],"published":"2021-08-03T13:22:54Z","modified":"2026-10-23T17:17:56Z","fixes":[{"ecosystem":"Alpine:v3.10","package":"apk-tools","fixed_in":["2.10.7-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.11","package":"apk-tools","fixed_in":["2.10.7-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.12","package":"apk-tools","fixed_in":["2.10.7-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.13","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.14","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.15","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.16","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.17","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.18","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.19","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.20","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.21","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.22","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.23","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.24","package":"apk-tools","fixed_in":["2.12.6-r0"],"sources":["osv"]}],"affected":[{"source":"osv","ecosystem":"Alpine:v3.10","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.10.7-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.11","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.10.7-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.12","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.10.7-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.13","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.14","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.15","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.16","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.17","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.18","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.19","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.20","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.21","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.22","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.23","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.24","package":"apk-tools","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.12.6-r0"}]}]}],"products":[{"vendor":"freebsd","product":"libfetch"}],"references":[{"url":"https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10749","tags":["x_refsource_MISC","x_transferred","Exploit","Third Party Advisory","evidence"]},{"url":"https://github.com/freebsd/freebsd-src/commits/main/lib/libfetch","tags":["x_refsource_MISC","x_transferred","Patch","Third Party Advisory","fix"]},{"url":"https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc%40%3Cdev.kafka.apache.org%3E","tags":["mailing-list","x_refsource_MLIST","x_transferred","web"]},{"url":"https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc%40%3Cusers.kafka.apache.org%3E","tags":["mailing-list","x_refsource_MLIST","x_transferred","web"]},{"url":"https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7%40%3Cusers.kafka.apache.org%3E","tags":["mailing-list","x_refsource_MLIST","x_transferred","web"]},{"url":"https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7%40%3Cdev.kafka.apache.org%3E","tags":["mailing-list","x_refsource_MLIST","x_transferred","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-36159"},{"url":"https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc@%3Cdev.kafka.apache.org%3E"},{"url":"https://lists.apache.org/thread.html/r61db8e7dcb56dc000a5387a88f7a473bacec5ee01b9ff3f55308aacc@%3Cusers.kafka.apache.org%3E"},{"url":"https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7@%3Cdev.kafka.apache.org%3E"},{"url":"https://lists.apache.org/thread.html/rbf4ce74b0d1fa9810dec50ba3ace0caeea677af7c27a97111c06ccb7@%3Cusers.kafka.apache.org%3E"},{"url":"https://github.com/advisories/GHSA-cqp5-89fm-vp89"},{"url":"https://security.alpinelinux.org/vuln/CVE-2021-36159","tags":["advisory"]},{"url":"https://docs.bell-sw.com/security/cves/CVE-2021-36159","tags":["advisory"]}],"sources":{"cve":[{"id":"CVE-2021-36159","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.","status":"published","published":"2021-08-03T13:22:54Z","modified":"2024-08-04T00:47:43.816Z","updated_at":"2026-11-02T14:33:05.989686Z"}],"euvd":[{"id":"EUVD-2021-22783","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.","status":"published","published":"2021-08-03T13:22:54Z","modified":"2024-08-04T00:47:43Z","updated_at":"2026-11-03T03:24:29.877227Z"}],"ghsa":[{"id":"GHSA-cqp5-89fm-vp89","title":"libfetch before 2021-07-26, as used in apk-tools, xbps, and other products, mishandles numeric...","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.","status":"published","published":"2022-05-24T19:09:52Z","modified":"2023-01-30T05:01:14Z","cwes":["CWE-125"],"updated_at":"2026-11-02T14:46:22.009402Z"}],"nvd":[{"id":"CVE-2021-36159","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.","status":"published","published":"2021-08-03T14:15:08.233Z","modified":"2026-06-17T03:58:26.08Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical","assessor":"primary"},{"version":"2.0","score":6.4,"vector":"AV:N/AC:L/Au:N/C:P/I:N/A:P","level":"medium","assessor":"primary"}],"cwes":["CWE-125"],"updated_at":"2026-11-02T14:06:56.562207Z"}],"osv":[{"id":"ALPINE-CVE-2021-36159","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.","status":"published","published":"2021-08-03T14:15:08.233Z","modified":"2026-10-23T17:17:56.198606684Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-02T15:27:48.646074Z"},{"id":"BELL-CVE-2021-36159","title":"CVE-2021-36159 does not affect BellSoft software","status":"withdrawn","published":"2023-08-31T12:15:10.392566Z","modified":"2026-01-26T09:47:22.228714Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-02T15:28:16.5265Z"},{"id":"CVE-2021-36159","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.","status":"published","published":"2021-08-03T14:15:08.233Z","modified":"2026-03-15T22:41:06.829109Z","cvss":[{"version":"3.1","score":9.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H","level":"critical"}],"updated_at":"2026-11-02T15:44:20.434873Z"}]}}
