Fedora Account System
Red Hat Associate
Red Hat Customer
OpenStack Glance is the image service for OpenStack. The normalize_hostname() function in glance/common/utils.py performs DNS resolution via socket.getaddrinfo() to validate hostnames (line 216), but discards the resolved IP address and returns the original hostname string unchanged (line 222). When validate_import_uri() compares this unresolved hostname against the disallowed_hosts blocklist, IP-based blocklist entries (for example 169.254.169.254) never match attacker-controlled hostnames (for example evil.example.com) even when those hostnames resolve to the blocked IP. This allows authenticated users to bypass SSRF protections in the web-download image import method. A secondary TOCTOU condition exists: URI validation occurs at API request time (images.py:458) while the actual HTTP fetch occurs asynchronously in the import worker (web_download.py -> script_utils.get_image_data_iter -> urllib.request), allowing DNS rebinding between validation and fetch. The SafeRedirectHandler re-validates redirect targets using the same validate_import_uri(), inheriting the same weakness. Fix is not yet available (coordinating with upstream). Reporter: Cyril Roelandt (OpenStack Glance PTL, Glance Core Security Team) Upstream: https://bugs.launchpad.net/glance/+bug/2158999 PSIRT Ticket: PSIRTSUPT-22366 Downstream tracker: OSPRH-32931