Add ssh -L / ssh.connect_remote() workaround when AllowTcpForwarding is disabled#2538
Merged
peace-maker merged 5 commits intoGallopsled:devfrom Mar 30, 2025
Merged
Conversation
dc0ec3c to
1323dc5
Compare
…ding` is disabled Use a netcat process on the remote to connect to the specified host:port and tunnel the traffic using normal `ssh.process` I/O. This was inspired by the "Circumventing Disabled SSH Port-Forwarding with a Multiplexer" article by @guysv in the Paged Out! zine no. 5. It allows to use `gdb.debug(arg, ssh=ssh)` to debug processes on pwn.college.
1323dc5 to
306a859
Compare
Xeonacid
reviewed
Jan 31, 2025
Co-authored-by: Xeonacid <h.dwwwwww@gmail.com>
guysv
reviewed
Feb 14, 2025
pwnlib/tubes/ssh.py
Outdated
| if parent.which('nc'): | ||
| ncat = 'nc' | ||
| elif parent.which('ncat'): | ||
| ncat = 'ncat' |
There was a problem hiding this comment.
maybe add a fallback to bash's /dev/tcp? might be worth checking out.
There was a problem hiding this comment.
chatgpt crafted
bash -c 'exec 3<>/dev/tcp/localhost/1337; cat <&3 & cat >&3; kill $!'
to connect to localhost:1337 (tying stdin & stdout)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use a netcat process on the remote to connect to the specified host:port and tunnel the traffic using normal
ssh.processI/O.This was inspired by the "Circumventing Disabled SSH Port-Forwarding with a Multiplexer" article by @guysv in the Paged Out! zine no. 5.
Debugging works now instead of throwing a
paramiko.ssh_exception.ChannelException: ChannelException(1, 'Administratively prohibited')exception on pwn.college.