rofl0r / rofl0r/proxychains-ng

segfault while proxying ssh on OpenBSD-current [OpenSSH_7.1 LibreSSL 2.3.2]

Open
#96 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
10.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hi,
I don't know if it is an OpenBSD specific issue. I got a segfault in proxychains-ng when using a socks5 proxy to tunnel a ssh connection. SSH print "get_hostfile_hostname_ipaddr: getnameinfo failed" which causes the segfault.

tail -n 1 /tmp/px.conf

socks5 127.0.0.1 8888

./proxychains4 -f /tmp/px.conf ssh -vvvvvv root@192.168.130.5

Below is the gdb output with DEBUG activated. A more verbose output with SSH debug activated on http://pastebin.com/ZEwxmfYm

Starting program: /usr/bin/ssh root@192.168.130.5
DEBUG:init_lib_wrapper called from gcc_init
DEBUG:pid[1209]:at_init
[proxychains] DLL init: proxychains-ng 4.10
DEBUG:loaded symbol 'connect' real addr 0x1c671ccc7060 wrapped addr 0x1c66b3595f2a
DEBUG:loaded symbol 'sendto' real addr 0x1c671ccc64e0 wrapped addr 0x1c66b35969ab
DEBUG:loaded symbol 'gethostbyname' real addr 0x1c670a38bdc0 wrapped addr 0x1c66b359656e
DEBUG:loaded symbol 'getaddrinfo' real addr 0x1c670a387840 wrapped addr 0x1c66b35965dd
DEBUG:loaded symbol 'freeaddrinfo' real addr 0x1c670a3b2200 wrapped addr 0x1c66b35966a2
DEBUG:loaded symbol 'gethostbyaddr' real addr 0x1c670a38bb90 wrapped addr 0x1c66b3596887
DEBUG:loaded symbol 'getnameinfo' real addr 0x1c670a389230 wrapped addr 0x1c66b3592344
DEBUG:loaded symbol 'close' real addr 0x1c671ccc7120 wrapped addr 0x1c66b3595e61
DEBUG:pid[1209]:wait_data
DEBUG:[play] socks5 127.0.0.1:8888
DEBUG:getaddrinfo: 192.168.130.5 22
DEBUG:pid[1209]:proxy_getaddrinfo
DEBUG:pid[1209]:mygetservbyname_r
DEBUG:pid[1209]:pc_getnameinfo
DEBUG:pid[1209]:connect
DEBUG:target: 192.168.130.5
DEBUG:port: 22
DEBUG:pid[1209]:connect_proxy_chain
DEBUG:[play] socks5 127.0.0.1:8888
[proxychains] Strict chain ... 127.0.0.1:8888 DEBUG:pid[1209]:timed_connect
DEBUG:
connect ret=0
DEBUG:pid[1209]:chain_step
... 192.168.130.5:22 DEBUG:pid[1209]:tunnel_to
DEBUG:host dns
... OK
DEBUG:pid[1209]:pc_getnameinfo
DEBUG:freeaddrinfo 0x1c66e6008600
DEBUG:pid[1209]:proxy_freeaddrinfo
DEBUG:pid[1209]:pc_getnameinfo
get_hostfile_hostname_ipaddr: getnameinfo failed
Program exited with code 0377.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported command with proxychains4, /tmp/px.conf, and an SSH connection through the SOCKS5 proxy on OpenBSD-current. Trace the logged proxy_getaddrinfo, pc_getnameinfo, and proxy_freeaddrinfo paths around the getnameinfo failure; done means the connection no longer segfaults and SSH can proxy successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.