SOCKS5 with username/password auth silently falls back to direct connection
Summary
The 0.3.24 changelog added "Native SOCKS5 proxy support — pass proxy='socks5://user:pass@host:port' directly. Credentials handled natively by Chrome." In practice, traffic appears to silently bypass the SOCKS5 proxy and exit via the host's direct network interface when credentials are included.
We'd love clarification on expected behavior here, or confirmation that this is a bug — happy to help test a fix.
Environment
[email protected][email protected]- Node 20 (inside a Cloud Run container)
- Chromium 146.0.7680.177.1 (CloakBrowser's bundled build)
- Linux x64
- Proxy provider: Smartproxy/Decodo dedicated ISP (
isp.decodo.com:10001), supports SOCKS5 per their docs (confirmed viacurl -x "socks5://user:[email protected]:10001"— works, exit IP matches the assigned Decodo IP)
What we did
import { launch } from 'cloakbrowser'
const browser = await launch({
headless: true,
proxy: 'socks5://USER:[email protected]:10001',
args: ['--fingerprint=12345', '--window-size=1920,1080'],
geoip: true,
humanize: true,
humanPreset: 'careful',
})
// Close default context to get recordVideo options applied
const defaultContext = browser.contexts()[0]
if (defaultContext) await defaultContext.close()
const context = await browser.newContext({ viewport: { width: 1920, height: 919 } })
const page = await context.newPage()
await page.goto('https://browserleaks.com/ip')What we expected
browserleaks.com/ip should show the Decodo exit IP (48.44.16.178 for port 10001).
What actually happened
- No errors at launch or during navigation
browserleaks.com/ipshows the Cloud Run egress IP (34.96.60.132— Google LLC), indicating traffic went direct and bypassed the SOCKS5 proxy- Interestingly, WebRTC leak test still reports the Decodo IP (
48.44.16.178), so something in the browser is aware of the proxy — just not the main HTTPS request path - DNS resolution also leaks to GCP internal resolvers, consistent with DNS not going through the SOCKS5 tunnel
Swapping the same URL to http://USER:[email protected]:10001 (HTTP proxy) works correctly — exit IP is Decodo. So the proxy credentials and endpoint are valid.
What we found looking at the source
In dist/proxy.js, resolveProxyConfig() detects SOCKS5 URLs and routes them around Playwright:
if (isSocksProxy(proxy)) {
// SOCKS5: bypass Playwright, pass directly to Chrome via --proxy-server.
if (typeof proxy === "string") {
return { proxyArgs: [`--proxy-server=${proxy}`] };
}
// ...
}The comment above this says "Playwright rejects SOCKS5 proxies with credentials in its proxy dict, so SOCKS5 is passed via --proxy-server Chrome arg instead." That correctly works around Playwright's rejection, but Chromium's --proxy-server flag has a long-standing limitation: it doesn't support username/password authentication for SOCKS5 proxies (Chromium issue tracker and related). Chrome strips the credentials, connects unauthenticated, the proxy rejects, and Chrome silently falls back to direct.
That would explain the symptoms we're seeing exactly — browser launches fine, WebRTC sees the SOCKS5 endpoint config, but actual HTTPS traffic takes the direct path.
Possible paths
A few things that would help, depending on what's going on:
- If this is expected / known: a note in the changelog or docs that
socks5://user:pass@host:portonly works for IP-allowlisted proxies (no credentials actually used) would save the next person a few hours - If this is a bug: a Chromium source patch to bypass the
--proxy-serverauth stripping for SOCKS5 would solve it — this seems to fit CloakBrowser's existing pattern of C++ patches - Alternative: document a recommended approach like a built-in local SOCKS5→HTTP bridge, or clarify whether passing the proxy as an object with separate
username/passwordgoes through a different code path that does handle auth
Happy to help test any of these — we have a reliable repro case.
Thanks for all the work on CloakBrowser, it's been fantastic for us otherwise. Detection scores dropped dramatically when we switched from our custom JS stealth stack to yours (CreepJS stealth: 100% → 0%, headless: 33% → 0%).
Source: CloakHQ/CloakBrowser