rofl0r / proxychains-ng

proxychains ng (new generation) - a preloader which hooks calls to sockets in dynamically linked programs and redirects it through one or more socks/http proxies. continuation of the unmaintained proxychains project. the sf.net page is currently not updated, use releases from github release page instead.
http://sourceforge.net/projects/proxychains-ng/files
GNU General Public License v2.0
9.74k stars 1.07k forks source link

Not work with Chromium #45

Closed cyvirus closed 2 years ago

cyvirus commented 9 years ago
root@ebers:~/Workspace/ebers/view# proxychains4 chromium-browser --user-data-dir=/tmp/chromium
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/local/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1
[proxychains] DLL init: proxychains-ng 4.8.1

Haven't any error, but chromium isn't work.

I tested with Version 39.0.2171.65 Ubuntu 14.04 (64-bit). I also try build from latest code of chromium and proxychains-ng, but receiving same results.

Help me!

hiendv commented 8 years ago

:+1: I have the same problem with google-chrome

rofl0r commented 8 years ago

try opening a shell, enter:

export LD_PRELOAD=/path/to/libproxychains4.so
chromium-browser --user-data-dir=/tmp/chromium
dx0x58 commented 8 years ago

Same problem. Ubuntu 15.04 x64

rofl0r commented 8 years ago

anyone tried what i said above ?

dx0x58 commented 8 years ago

Yes, i tried. The same result.

rofl0r commented 8 years ago

we need to figure out what chromium does that is incompatible with proxychains. a start would be if someone that has it installed can paste the output of "strace -f chromium" (while connecting to a single random site and then closing the browser - dont do it with several tabs open as that will heavily bloat strace's output)

sapphonie commented 8 years ago

Here's what chromium does with proxychains: http://pastebin.com/beDyp3P5 Normal chromium is too big to pastebin

rofl0r commented 8 years ago

thanks for the strace output. now we know that chromium uses a perl wrapper that searches for plugins and then starts the real binary:

execve("/usr/lib/chromium/chromium", ["/usr/lib/chromium/chromium", "--ppapi-flash-path=/usr/lib/Pepp"..., "--ppapi-flash-version=20.0.0.195"], [/* 43 vars */]) = 0

additionally we see that pulseaudio is used which does its own (eventually incompatible?) dlsym() tricks

open("/usr/lib/pulseaudio/libjson-c.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/libjson-c.so.2", O_RDONLY|O_CLOEXEC) = 11

if the problem is due to one of the above findings, it may help to try to 1) start chromium directly without the perl wrapper 2) disable pulseaudio (or recompile chromium without pulseaudio support, if feasible)

sapphonie commented 8 years ago

I think it might be a problem with proxychains, as anything chromium based (including opera, chrome, vivaldi, chromium, &tc) gives a

nanosleep({0, 2000001}, NULL) = 0

after a while with strace

rofl0r commented 8 years ago

to find out for sure we need a voluntary who can test chromium with

and someone who can build chromium without support for pulseaudio,

and/or somebody who knows/reads chromium code to find out if its doing something weird like doing the connect syscall directly or using raw sockets etc

rofl0r commented 8 years ago

i fixed a related problem a few days ago. you may wanna check out latest git and report if the problem still exists.

roastduck commented 8 years ago

Tested with Chrome, but still doesn't work.

greenSnot commented 7 years ago

+1

1600 commented 7 years ago

Unsolved still.

rofl0r commented 7 years ago

well, then i suppose someone should attach his debugger and find out why. i won't be that someone because chromium sources are > 2GB and compiling it from source takes hours.

nyancat18 commented 7 years ago

with chromium/inox works

but its slow as hell

arpitjindal97 commented 7 years ago

use the below command:

chromium --proxy-server="socks5://127.0.0.1:9050"

xuezhaojiang commented 7 years ago

I can't find a solution to solve the problem. And I wonder why the command "proxychains google-chrome" can't work. But I find a way to make it work.

proxychains bash
google-chrome
MicroBeast commented 6 years ago

Linux/Debian sid amd64.

Chromium based tested (x64):

Doing proxychains4 google-chrome|opera|vivaldi|yandex-browser (Chromium based) just work here. I don't need to do any tricks like LD_PRELOAD or weird need BASH mentioned above. I'm not sure why.

What's on me;

Only when using rofi, Google Chrome sometime stuck on its startup. On use, entire (any) browsers sometime hang for awhile, no errors. When it's (most of time) working, rendering/fetching speed, just normal.

Edited: typos

tonsimple commented 6 years ago

Have a chromium crash

command line output:

  user@debian:~$ proxychains4 /usr/bin/chromium
[proxychains] config file found: /etc/proxychains.conf
[proxychains] preloading /usr/lib/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.12-git-2-g46647be
[proxychains] DLL init: proxychains-ng 4.12-git-2-g46647be
[proxychains] DLL init: proxychains-ng 4.12-git-2-g46647be
[proxychains] DLL init: proxychains-ng 4.12-git-2-g46647be
[proxychains] DLL init: proxychains-ng 4.12-git-2-g46647be
[proxychains] DLL init: proxychains-ng 4.12-git-2-g46647be
[1:1:1029/162914.121982:FATAL:sandbox_linux.cc(180)] Check failed: sandbox::Credentials::MoveToNewUserNS(). 
#0 0x585908e8bfbe <unknown>
#1 0x585908ea061b <unknown>
#2 0x5859076be4bd <unknown>
#3 0x58590829b2d6 <unknown>
#4 0x585908aece36 <unknown>
#5 0x585908aee123 <unknown>
#6 0x585908aecb30 <unknown>
#7 0x5859075f4910 ChromeMain
#8 0x7fba8f641b45 __libc_start_main
#9 0x5859075f4789 <unknown>

Received signal 6
#0 0x585908e8baab <unknown>
#1 0x7fba96692890 <unknown>
#2 0x7fba8f655067 gsignal
#3 0x7fba8f656448 abort
#4 0x585908e8aa22 <unknown>
#5 0x585908ea0940 <unknown>
#6 0x5859076be4bd <unknown>
#7 0x58590829b2d6 <unknown>
#8 0x585908aece36 <unknown>
#9 0x585908aee123 <unknown>
#10 0x585908aecb30 <unknown>
#11 0x5859075f4910 ChromeMain
#12 0x7fba8f641b45 __libc_start_main
#13 0x5859075f4789 <unknown>
  r8: ffff97f659b0e2d8  r9: ffff97f659b0e2c8 r10: 0000000000000008 r11: 0000000000000202
 r12: 000017f50e2dfa80 r13: 000017f50e34d240 r14: 00007ffeb47c2d88 r15: 00007ffeb47c2d78
  di: 0000000000000001  si: 0000000000000001  bp: 000017f50e2e9000  bx: 0000000000000000
  dx: 0000000000000006  ax: 0000000000000000  cx: 00007fba8f655067  sp: 00007ffeb47c22a8
  ip: 00007fba8f655067 efl: 0000000000000202 cgf: 002b000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
[1999:1999:1029/162914.126396:FATAL:zygote_host_impl_linux.cc(196)] Check failed: ReceiveFixedMessage(fds[0], kZygoteHelloMessage, sizeof(kZygoteHelloMessage), &real_pid). 
#0 0x5556f6cc2fbe <unknown>
#1 0x5556f6cd761b <unknown>
#2 0x5556f64b2605 <unknown>
#3 0x5556f64b165e <unknown>
#4 0x5556f64b1c4e <unknown>
#5 0x5556f61437ec <unknown>
#6 0x5556f614c54a <unknown>
#7 0x5556f6142e7c <unknown>
#8 0x5556f6925123 <unknown>
#9 0x5556f6923b30 <unknown>
#10 0x5556f542b910 ChromeMain
#11 0x7e5e5b115b45 __libc_start_main
#12 0x5556f542b789 <unknown>

Aborted
user@debian:~$ 
tonsimple commented 6 years ago

Google suggests it's a sandboxing thing... but I don't wanna disable sandbox. Any hope that proxychains-ng will be made work with chromium's sandbox ?

moralrebuild commented 6 years ago

3 years passed, any joy?

sashage commented 6 years ago

a bit late, but maybe this helps for this particular problem: I use a workaround for chrome, which is technically not proxychains, but accomplishing the same effect:

I created the following script, which I use to proxy all traffic in chrome:

#!/bin/bash
function _start-with-proxy() {
    export SOCKS_SERVER=127.0.0.1:1080
        export SOCKS_VERSION=5
        chromium %U --user-data-dir="/home/[USER]/.chromium profiles/[PROFILEDIR]"
}
_start-with-proxy

I don't use flash, so I don't know if flash may bypass the proxy. DNS requests seem to get routed through the proxy though.

sinanna commented 6 years ago

@sashage Which tool do you use for running a proxy locally?

rofl0r commented 6 years ago

i'd recommend my own creation microsocks or tinyproxy (HTTP proxy, which can even forward requests to other SOCKS/HTTP proxies)

sashage commented 6 years ago

@sashage Which tool do you use for running a proxy locally?

I use Shadowsocks (https://github.com/shadowsocks/shadowsocks-libev)

rofl0r commented 6 years ago

it's unlikely we'll ever get the chromium sandbox compatible with proxychains. however there's a way to get proxychains working with chromium and that is running proxychains4 on a HTTP or SOCKS proxy like tinyproxy or microsocks (see comment https://github.com/rofl0r/proxychains-ng/issues/45#issuecomment-399437435) and then putting the http server adress into chromium's network config or using a SOCKS server via the trick mentioned in https://github.com/rofl0r/proxychains-ng/issues/45#issuecomment-397138270. in such scenario proxychains can route the connections of the proxy server software over your chain of proxies.

intika commented 5 years ago

Original proxychains v3/v4.3 works with chrome based apps... i think it's probably because of this feature (fixes programs that do dns-lookups in child processes like irssi. to achieve this, support for compilation without pthreads was sacrified.) added in 4.3... need to debug further to see what's going on

This feature should be optional anyway

EDIT: indeed i was right this is what get chromium in trouble https://github.com/rofl0r/proxychains-ng/commit/25afe98b2001f044bec9469a51cb048cd0cf2d47

EDIT II: use v4.3 https://github.com/rofl0r/proxychains-ng/tree/v4.3 if needed to make it work with chromium

EDIT III: temporary solution v4.3 with CVE-2015-3887 patch https://github.com/Intika-Linux-Network/Proxychains-NG

rofl0r commented 5 years ago

EDIT : indeed i was right this is what get chromium in trouble 25afe98

interesting find. thanks for digging.

Original proxychains works with chrome based apps https://github.com/haad/proxychains

that's not original at all. please do not link to that abomination any more. instead link to the v4.3 tag in this repo.

This feature should be optional anyway

that's a bold statement for someone who never contributed code to this project, even though i agree that it would be nice to have a switch to toggle it. but it will be a lot of work to do it. in all fairness it's not proxychains-ng's fault that chrome goes out of its way to make it hard to hook to its processes by using all kinds of sandboxing features.

that's why i generally suggest that people use proxychains-ng to proxify a local socks or http proxy like microsocks or tinyproxy, and put that local proxy's ip into the browser's proxy settings, which is totally reliable.

intika commented 5 years ago

that's a bold statement for someone who never contributed code to this project, even though i agree that it would be nice to have a switch to toggle it. but it will be a lot of work to do it.

Indeed it's kind a lot i trayed yesterday to make it optional, but i abandoned after 1h... i will see what i can do if i have the time.

that's why i generally suggest that people use proxychains-ng to proxify a local socks or http proxy like microsocks or tinyproxy, and put that local proxy's ip into the browser's proxy settings, which is totally reliable

Yes agree chrome and similar have a proxy setting, in this case proxychains-ng would be useful to make sure there is no leak.

do not link to that abomination

Proxychains is melted with all the dev that worked on the project i thought @haad was netcreature-from-sourceforge the original developer i did not dig deeper to check who is who

Note for newcomer: netcreature is the original developer (v3) @rofl0r took over providing v4.x (ng version) and @haad contributed to the code...

It's funny to compare those 2 files https://github.com/rofl0r/proxychains-ng/blob/master/AUTHORS and https://github.com/haad/proxychains/blob/master/AUTHORS

On its repo:

@haad: localnet, bugfixes, macos x support, bsd support, packaging

And here

@haad: collecting patches from px forum and putting it into a repo

loooool

rofl0r commented 5 years ago

Indeed it's kind a lot i trayed yesterday to make it optional, but i abandoned after 1h... i will see what i can do if i have the time.

a "traditional mode" basically would need to use the old proxyresolv script (which depends on dig for TCP-based DNS resolution but it could be changed to use eitherdig or drill - the latter is a modern replacement which has much less cruft), and would be incapable of resolving .onion hosts when used with tor (and would be much slower).

rofl0r commented 4 years ago

a "traditional mode" basically would need to use the old proxyresolv script (which depends on dig for TCP-based DNS resolution

i've implemented this now: 2ab631918d8c75c6382a2dcf3a321fb956801f8a

additionally i've implemented another new remote DNS mode which should fix issues with crapware like chromium forever: 7fe813949644b115b0127279517dc7c0ee2d63b9

please test!

nickchen120235 commented 3 years ago

a "traditional mode" basically would need to use the old proxyresolv script (which depends on dig for TCP-based DNS resolution

i've implemented this now: 2ab6319

additionally i've implemented another new remote DNS mode which should fix issues with crapware like chromium forever: 7fe8139

please test!

Confirmed this method works for discord (which is based on React and the Electron framework).

This also works for Google Chrome

My setup

Edit: sample systemd service file for the dns daemon

[Unit]
Description=DNS daemon for proxychains4
After=network-online.target nss-lookup.target
Wants=network-online.target

[Service]
User=nobody
CapabilityBoundingSet=CAP_NET_BINDING_SERVICE
AmbientCapabilities=CAP_NET_BINDING_SERVICE
NoNewPrivileges=true
ExecStart=/path/to/proxychains4-daemon
Restart=on-failure

[Install]
WantedBy=multi-user.target
qrzbing commented 2 years ago

Hi, I meet similar errors too. When I try to use proxychains4 for chrome on WSL2 in Win11 like this:

pc google-chrome

where pc means proxychains4 -q -f ~/proxychains4.conf, I got this error:

[1207/152542.626460:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1207/152542.626506:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[1]    1854 trace trap  proxychains4 -q -f ~/proxychains4.conf google-chrome
rofl0r commented 2 years ago

Hi, I meet similar errors too.

s/meet/encounter/. you can meet a person, but not a thing. it seems all chinese dicts get that wrong.

When I try to use proxychains4 for chrome on WSL2 in Win11 like this:

1) use proxy_dns_daemon mode 2) WSL isn't offcially supported, if it works it's by chance.

since @nickchen120235 confirmed that proxy_dns_daemon fixes the issue, i'm taking the opportunity to close this.