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

Port 0 and NCAT (observation/proposal) #1560

Closed
Zibri opened this issue Apr 17, 2019 · 4 comments
Closed

Port 0 and NCAT (observation/proposal) #1560

Zibri opened this issue Apr 17, 2019 · 4 comments

Comments

@Zibri
Copy link

Zibri commented Apr 17, 2019

ncat -lkp 0 works
but ncat hostname 0 does not.

also:
it would be interesting for testing purposes to be able to set port 0 as source port, but for nmap port 0 means "any port".

Can this be change to consider port 0 as a port?!

@dmiller-nmap
Copy link

Thanks for this report! You're right, Ncat currently refuses to attempt a connection to port 0. I will remove that restriction, since in my testing it appears to be capable of making a client connection to server port 0.

You said that ncat -lkp 0 works, but if you check the output of netstat, you'll see that Ncat is not actually listening on port 0. While the TCP spec does not specify any special handling for port 0, most socket implementations treat the port value 0 as a request to assign an ephemeral port when calling bind(2).

Nmap does not appear to have any problems using port 0 as a source port with -g0. Did you mean something else?

@Zibri
Copy link
Author

Zibri commented Apr 18, 2019 via email

@dmiller-nmap
Copy link

I see. You had said "nmap" not "ncat" when you mentioned source port, so that is what I was responding to. (-g is the source port option for Nmap).

Using a source port of 0 for either listen or connect mode will not be possible with existing socket implementations. Nmap is only able to do so because it uses raw sockets to build TCP packets directly, which is not something that is available for Ncat.

@Zibri
Copy link
Author

Zibri commented Apr 19, 2019

Ooops.. yes, I meant ncat.
Well it would be nice to have it in ncat anyways. But I understand what you mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants