I am having some issues when trying to use a teleport node as a sort of proxy to scan resources inside networks behind that said proxy node.
My setup looks like this: I have a node inside my Teleport cluster that i would like to use to proxy nmap scans to resources behind this node (the resources are disconnected from the internet, the teleport node acts as the only link to the outside, to access the resources you need to first ssh into "proxy node" and then you gain access to the resources inside the said network).
I want to be able to do this remotely from another teleport agent so I basically start a dynamic port forward: tsh ssh -D 1080 <teleport_node>
Then I use this new socks5 proxy in conjuction with proxychains to scan a resource in the network i mentioned before: proxychains4 nmap -sT -Pn -sV -n <resource_ip>
The result is that somehow... all ports are open and tcpwrapped. The same command but using scanme.nmap.org as the resource never actually ends (or i never waited enough for it to end, but i don't think it actually ever ends).
Removing the -sV flag from nmap does make it "work" but renders the output absolutely useless because all ports are seen as open.
Doing the same exact thing as above but instead using standard ssh (OpenSSH) to dynamically port forward traffic results in the expected outcome: ssh -D 127.0.0.1:1080 <teleport_node>
Does anybody have any idea if tsh somehow changes the way that a normal dynamic port forward works as opposed to using ssh?
nmapdoesn't use normal TCP/IP sockets; rather they use raw sockets which essentially bypasses a lot of the networking stack in the OS.