Repository navigation
Fix local DNS leak when fetching feeds through a proxy - #9451
Conversation
Follow-up to FreshRSS#9390: `getRetryAfterFile()` passed the full URL to `Minz_Request::serverIsPublic()`, which then resolved the target hostname with the local resolver (`dns_get_record()`), even when a proxy was configured. With a socks5h/socks4a proxy this leaks the target hostname to the local DNS and defeats remote name resolution. - `Minz_Request::serverIsPublic()`: add an `$allowDnsResolve` parameter, and forward it to the recursive call so the guard holds for the whole recursion. - `FreshRSS_http_Util::getRetryAfterFile()`: do not resolve the host name when a proxy is configured (`$proxy === ''`), since the proxy is responsible for DNS. Also, `SimplePie\File`: for socks4a / socks5h, skip `get_curl_resolve_info()` and `CURLOPT_RESOLVE`, as those proxy types already resolve the host name at the proxy side. Pre-resolving locally would degrade socks5h to socks5, and leak the target hostname. Other proxy types keep the FreshRSS#8950 SSRF / DNS-rebinding protection.
|
Thanks! Could you please send the SimplePie part as a PR to https://github.com/FreshRSS/simplepie ? |
|
Same fix applied to |
FreshRSS/FreshRSS#9451 Follow-up of #83 Co-authored-by: tomac4t <[email protected]>
|
Losing the allowlist check sounds worse to me than the issue. |
| if ($proxy_type === CURLPROXY_SOCKS4A || $proxy_type === CURLPROXY_SOCKS5_HOSTNAME) { | ||
| $resolve = []; | ||
| } else { | ||
| $resolve = $this->get_curl_resolve_info($proxy_url); | ||
| if ($resolve === null) { | ||
| $this->error = 'Failed to fetch this URL, because the proxy’s IP is not in the allowlist [' . |
There was a problem hiding this comment.
This removes the allowlist check for socks4a/socks5h proxies (which introduces SSRF again).
Changes should be limited only to the serverIsPublic() function.
|
@tomac4t Please check if it is sufficient for your use-case |
|
Sorry, I might not have time to check it until tomorrow.
于 2026年10月17日 UTC 15:38:15,Alexandre Alapetite ***@***.***> 写道:
…Alkarex left a comment (FreshRSS/FreshRSS#9451)
@tomac4t Please check if it is sufficient for your use-case
|
|
@Alkarex I’m glad to see this merged; it allows me to use a WireGuard/Socks5 proxy without worrying about information leaking to my ISP. Since I run FreshRSS on a Raspberry Pi at home, this perfectly addresses my use case. $domainWide = self::$retry_after_domain_wide[$domain] ??= Minz_Request::serverIsPublic($url, allowDnsResolve: $proxy === '');This check might be a bit too simplistic—strictly speaking, it should only apply to SOCKS4A and SOCKS5H—but since it’s not straightforward for me to modify, I’ve opted for the simplest implementation. |
Not completely, because #8976 is still unsolved for example. |
Follow-up to #9390:
getRetryAfterFile()passed the full URL toMinz_Request::serverIsPublic(), which then resolved the target hostname with the local resolver (dns_get_record()), even when a proxy was configured. With a socks5h/socks4a proxy this leaks the target hostname to the local DNS and defeats remote name resolution.Minz_Request::serverIsPublic(): add an$allowDnsResolveparameter, and forward it to the recursive call so the guard holds for the whole recursion.FreshRSS_http_Util::getRetryAfterFile(): do not resolve the host name when a proxy is configured ($proxy === ''), since the proxy is responsible for DNS.Also,
SimplePie\File: for socks4a / socks5h, skipget_curl_resolve_info()andCURLOPT_RESOLVE, as those proxy types already resolve the host name at the proxy side. Pre-resolving locally would degrade socks5h to socks5, and leak the target hostname. Other proxy types keep the #8950 SSRF / DNS-rebinding protection.Closes #9423
Pull request checklist:
Additional information can be found in the documentation.