REDHAT-BUG-2524516: SSRF
OpenStack Glance is the image service for OpenStack. The web-download import method allows authenticated users to supply a URI from which Glance fetches image data server-side. The validateimporturi() function in glance/common/utils.py (line 225) validates the URI against configurable allow/deny lists for schemes, hosts, and ports. However, the default configuration shipped with Glance has empty allowedhosts and disallowedhosts lists, meaning no host filtering is applied. Only scheme filtering (http/https) and port filtering (80/443) are active by default.
The port check in validateimporturi() (line 270) is bypassed when no explicit port is specified in the URL, because urllib.parse.urlparse returns port=None for URLs using default ports (for example http://169.254.169.254/path), and the check short-circuits on the falsy None value.
This allows any authenticated user with the member role to make Glance issue HTTP/HTTPS requests to arbitrary internal hosts, including the cloud metadata service at 169.254.169.254. Because the fetched bytes become the image payload and are retrievable via GET /v2/images/{imageid}/file, this is a full-read SSRF that can exfiltrate internal service responses including cloud instance credentials.
The vulnerability exists in all versions of Glance that implement the web-download import method with the default importfilteringopts configuration. The web-download method is enabled by default via enabledimportmethods. Fix is not yet available (coordinating with upstream).
Affected code: - glance/common/utils.py: validateimporturi() (lines 225-274) - glance/async/flows/internalplugins/init.py: importfilteringopts defaults - glance/async/flows/internalplugins/webdownload.py: WebDownload.execute() - glance/api/v2/images.py: importimage() entry point
Reporter: Cyril Roelandt (OpenStack Glance PTL / Glance Core Security Team) Upstream: https://bugs.launchpad.net/glance/+bug/2158998 PSIRT Ticket: PSIRTSUPT-22366 Downstream tracker: OSPRH-32932