sshuttle / sshuttle/sshuttle

Usernames with colons are wrongly parsed

Open
#994 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
13.6k
Forks
795
Avg merge
8h 49m
Merged PRs (30d)
12

Description

Hello,

When I use a username with colon like 'proxyuser:target' the username is converted to proxyuser, preventing me to connect to the proxy.

# sshuttle -r proxyuser:target@10.4.42.52:2222 10.254.0.0/24 -vv
Starting sshuttle proxy (version 1.2.0).
c : Starting firewall manager with command: ['/usr/local/bin/sshuttle', '-v', '-v', '--method', 'auto', '--firewall']
fw: Starting firewall with Python version 3.9.2
fw: which() found 'iptables' at /usr/sbin/iptables
fw: which() found 'iptables' at /usr/sbin/iptables
fw: ready method name nat.
c : Using default IPv4 listen address 127.0.0.1
c : IPv6 enabled: Using default IPv6 listen address ::1
c : Method: nat
c : IPv4: on
c : IPv6: on
c : UDP : off (not available with nat method)
c : DNS : off (available)
c : User: off (available)
c : Subnets to forward through remote host (type, IP, cidr mask width, startPort, endPort):
c :   (<AddressFamily.AF_INET: 2>, '10.254.0.0', 24, 0, 0)
c : Subnets to exclude from forwarding:
c :   (<AddressFamily.AF_INET: 2>, '127.0.0.1', 32, 0, 0)
c :   (<AddressFamily.AF_INET6: 10>, '::1', 128, 0, 0)
c : Trying to bind redirector on port 12300
c : TCP redirector listening on ('::1', 12300, 0, 0).
c : TCP redirector listening with <socket.socket fd=5, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=0, laddr=('::1', 12300, 0, 0)>.
c : TCP redirector listening on ('127.0.0.1', 12300).
c : TCP redirector listening with <socket.socket fd=7, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 12300)>.
c : Starting client with Python version 3.9.2
c : Connecting to server...
c : which() found 'sshpass' at /usr/bin/sshpass
c : executing: ['/usr/bin/sshpass', '-e', 'ssh', '-p', '2222', 'proxyuser@10.4.42.52', '--', '/bin/sh -c \'P=python3; $P -V 2>/dev/null || P=python; exec "$P" -c \'"\'"\'import sys, os; verbosity=2; stdin = os.fdopen(0, \'"\'"\'"\'"\'"\'"\'"\'"\'rb\'"\'"\'"\'"\'"\'"\'"\'"\'); exec(compile(stdin.read(1785), \'"\'"\'"\'"\'"\'"\'"\'"\'assembler.py\'"\'"\'"\'"\'"\'"\'"\'"\', \'"\'"\'"\'"\'"\'"\'"\'"\'exec\'"\'"\'"\'"\'"\'"\'"\'"\')); sys.exit(98);\'"\'"\'; exit 97\'']
c :  > channel=0 cmd=PING len=7 (fullness=0)
proxyuser@10.4.42.52: Permission denied (publickey,keyboard-interactive).
c : fatal: failed to establish ssh session (2)

The ssh command should be ssh -p 2222 proxyuser:target@10.4.42.52 instead of ssh -p 2222 proxyuser@10.4.42.52

Is it possible to fix this? How could I help?

Thank you very much!

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 with sshuttle's command-line handling of the -r remote specification and trace how the username and host are passed to SSH. Reproduce the reported command, then add coverage for a colon-containing username. Done means the generated SSH command preserves proxyuser:target before the @ and the connection uses that complete username.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.