Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

hyper-util: SOCKS5 connector sends a bracketed IPv6 literal as a domain name

Aperta Adatta ai principianti
#4,206 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 4 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Inizia da src/client/legacy/connect/proxy/socks/v5/mod.rs e analizza come l’host di destinazione viene interpretato come indirizzo SOCKS5. Esegui una richiesta SocksV5 a https://[::1]:443, quindi verifica che la richiesta codificata utilizzi ATYP 0x04 con i 16 byte IPv6 grezzi, invece di ATYP 0x03 con il testo tra parentesi quadre.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

My Claude discovered this.

Fable:

Affects hyper-util 0.1.20 (src/client/legacy/connect/proxy/socks/v5/mod.rs), seen through reqwest 0.13.5 with a socks5:// proxy (local DNS mode).

What happens

reqwest resolves the target locally and builds the destination URI with the address; an IPv6 address is written in brackets, as a URI requires (https://[2606:4700::6810:102]:443). SocksV5 then takes dst.host(), which for an IPv6 authority still carries the brackets ([2606:4700::6810:102]), and does:

let address = match host.parse::<IpAddr>() {
    Ok(ip) => Address::Socket(SocketAddr::new(ip, port)),
    Err(_) => ... Address::Domain(host, port)

"[2606:4700::6810:102]".parse::<IpAddr>() fails, so the literal goes out as ATYP 0x03 (domain name) with the brackets in the string. A SOCKS5 server that joins host and port (tailscaled's does, with Go's net.JoinHostPort) ends up with [[2606:4700::6810:102]]:443 and fails with "missing port in address". IPv4 literals have no brackets, so they parse and go out as ATYP 0x01.

Fix

Strip the URI brackets before parsing the host as an IP address, so an IPv6 literal goes out as ATYP 0x04:

-        let address = match host.parse::<IpAddr>() {
+        let bare = host.strip_prefix('[').and_then(|h| h.strip_suffix(']')).unwrap_or(&host);
+        let address = match bare.parse::<IpAddr>() {
             Ok(ip) => Address::Socket(SocketAddr::new(ip, port)),

A test: a SocksV5 request to https://[::1]:443 must encode ATYP 0x04 with the 16 raw bytes, not ATYP 0x03 with the text [::1].

How it showed up

A Rust server fetching pages through a Tailscale exit node (tailscaled --socks5-server) with reqwest::Proxy::all("socks5://…") and a custom resolver: every host with an AAAA record failed with error sending request (cause: the proxy's "missing port in address"), and hosts with only A records worked. Ordering the resolver's answers IPv4-first works around it.

Lingua principale
Rust
Stelle
16.3k
Fork
1.8k
Merge medio
2g 8h
PR unite (30g)
11

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hyperium/hyper

Tutte le issue di hyperium/hyper

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.