New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ncat client --ssl with -e does not work on Windows #1267

Closed
dmiller-nmap opened this Issue Jul 10, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@dmiller-nmap

dmiller-nmap commented Jul 10, 2018

Reported:

I was conducting a red team test the other day and noticed that when I was trying to send a cmd.exe using the --ssl option of ncat to a remote ncat listener on a Linux box, although the connection did return and we could see the shell popping, whenever you try typing any command, it becomes unresponsive and the ncat on the Windows box seems to be entering a big loop of printing out debugging messages becoming unresponsive as well.

When I used ncat through socat so that socat did the ssl encryption, it worked fine.

@schnippe

This comment has been minimized.

Show comment
Hide comment
@schnippe

schnippe Jul 17, 2018

please see duplicate #1274

schnippe commented Jul 17, 2018

please see duplicate #1274

@dmiller-nmap

This comment has been minimized.

Show comment
Hide comment
@dmiller-nmap

dmiller-nmap Jul 19, 2018

In my testing, change 420618c fixes the SSL error, but I don't get any further output from the shell. Entering dir doesn't return any output. On the client side (ncat --ssl -e cmd localhost) I see

NCAT DEBUG: i == WAIT_OBJECT_0

every time I strike Enter on the server (shell) side.

dmiller-nmap commented Jul 19, 2018

In my testing, change 420618c fixes the SSL error, but I don't get any further output from the shell. Entering dir doesn't return any output. On the client side (ncat --ssl -e cmd localhost) I see

NCAT DEBUG: i == WAIT_OBJECT_0

every time I strike Enter on the server (shell) side.

@nmap-bot nmap-bot closed this in f31ef12 Jul 23, 2018

@dmiller-nmap

This comment has been minimized.

Show comment
Hide comment
@dmiller-nmap

dmiller-nmap Jul 23, 2018

All right! Fix is in SVN, will be mirrored to Github within an hour. Problems included:

  1. WaitForMultipleObjects only tells you the first of the events that signalled,
  2. SSL_read doesn't clear the event, so WaitForMultipleObjects keeps notifying that the socket needs a read.

So the subprocess never got a chance to send any data to the socket.

dmiller-nmap commented Jul 23, 2018

All right! Fix is in SVN, will be mirrored to Github within an hour. Problems included:

  1. WaitForMultipleObjects only tells you the first of the events that signalled,
  2. SSL_read doesn't clear the event, so WaitForMultipleObjects keeps notifying that the socket needs a read.

So the subprocess never got a chance to send any data to the socket.

@gvanem

This comment has been minimized.

Show comment
Hide comment
@gvanem

gvanem Jul 25, 2018

How did this get closed? The fix doesn't even compile. See my comment here.

gvanem commented Jul 25, 2018

How did this get closed? The fix doesn't even compile. See my comment here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment