IPv6 address truncation and image proxy SSRF error leakage
Description
Two security issues were identified and fixed in v1.16.0 (#2016).
- IPv6 IP Truncation
The vote deduplication and comment IP tracking code used strings.Split(r.RemoteAddr, ":")[0] to extract the client IP. For IPv6 addresses, this truncates to only the first segment (e.g. "2001" for any 2001:... address), causing unrelated users sharing that prefix to be treated as the same IP. This allows vote manipulation and bypasses rate limiting across independent users.
- Image Proxy SSRF with Error Leakage
The /api/v1/img image proxy endpoint leaked internal network topology through verbose transport error messages (e.g. "connection refused", "no route to host", "no such host"). An attacker could port-scan internal services by observing error response differences. No SSRF-safe transport was in place to block private/reserved IP ranges.
Fixed in commit aca0cff, released in v1.16.0.