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.82k stars 1.08k forks source link

Incompatible architecture error on macOS 13.5 with proxychains-ng and Ruby #569

Closed labolado closed 5 months ago

labolado commented 5 months ago

I am experiencing an issue when using proxychains-ng on macOS 13.5 with Ruby. Here are the details:

System Information:

Steps to Reproduce:

  1. Install proxychains-ng using Homebrew.
  2. Configure the proxy in /opt/homebrew/etc/proxychains.conf.
  3. Run the following command:
proxychains4 ruby -v

Expected Result: Ruby version information should be displayed through proxychains4.

Actual Result:

$ csrutil status
System Integrity Protection status: disabled.

$ ruby -v
ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]

$ proxychains4 ruby -v
[proxychains] config file found: /opt/homebrew/etc/proxychains.conf
[proxychains] preloading /opt/homebrew/lib/libproxychains4.dylib
dyld[3873]: terminating because inserted dylib '/opt/homebrew/lib/libproxychains4.dylib' could not be loaded: tried: '/opt/homebrew/lib/libproxychains4.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/libproxychains4.dylib' (no such file), '/opt/homebrew/lib/libproxychains4.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need ''))
dyld[3873]: tried: '/opt/homebrew/lib/libproxychains4.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/libproxychains4.dylib' (no such file), '/opt/homebrew/lib/libproxychains4.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need ''))
zsh: abort      proxychains4 ruby -v

Interestingly, curl works fine with proxychains4:

$ proxychains4 curl -V
[proxychains] config file found: /opt/homebrew/etc/proxychains.conf
[proxychains] preloading /opt/homebrew/lib/libproxychains4.dylib
[proxychains] DLL init: proxychains-ng 4.17-git-1-gfffd253
curl 8.8.0 (aarch64-apple-darwin22.6.0) libcurl/8.8.0 (SecureTransport) OpenSSL/3.3.1 zlib/1.2.11 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libssh2/1.11.0 nghttp2/1.61.0 librtmp/2.3 OpenLDAP/2.6.8
Release-Date: 2024-05-22

Additional Information:

The issue seems to be related to an architecture mismatch with the dynamically linked library /opt/homebrew/lib/libproxychains4.dylib.

Could you please provide guidance on how to resolve this architecture compatibility issue?

Thank you!

labolado commented 5 months ago

" CFLAGS="-arch arm64e" LDFLAGS="-arch arm64e" ./configure --prefix=/usr/local --bindir=/usr/local/bin --libdir=/usr/local/lib --fat-binary-m1" not work for me.

$ ./proxychains4 curl ip.me
zsh: killed     ./proxychains4 curl ip.me
rofl0r commented 5 months ago

follow the steps here https://github.com/rofl0r/proxychains-ng/issues/481#issuecomment-1455369572 including the command to enable arm64e preview abi.

rofl0r commented 5 months ago

you can also try to replace the configure file with this one: https://0x0.st/Xccz.sh

curl https://0x0.st/Xccz.sh -o configure && chmod +x configure

then ./configure --fat-binary-m2

let me know if it works.

labolado commented 5 months ago

It works, but I cannot set boot-args in recovery mode.

shutdown & long press Power button to recovery mode -> Terminal

csrutil disable

reboot

enable arm64e support

sudo nvram boot-args=-arm64e_preview_abi git clone https://github.com/rofl0r/proxychains-ng cd proxychains-ng CFLAGS="-arch arm64e" LDFLAGS="-arch arm64e" ./configure --prefix=/usr/local --bindir=/usr/local/bin --libdir=/usr/local/lib --fat-binary-m1 make ./proxychains4 -f /opt/homebrew/etc/proxychains.conf ruby -v ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]

rofl0r commented 5 months ago

right. but could you please test the new configure script i uploaded. if it works i'll merge it into master and make the --fat-binary-m2 option available

labolado commented 5 months ago

you can also try to replace the configure file with this one: https://0x0.st/Xccz.sh

curl https://0x0.st/Xccz.sh -o configure && chmod +x configure

then ./configure --fat-binary-m2

let me know if it works.

It works.