Repository navigation
New function to retrieve pre-auth server banner - #274
dmiller-nmap wants to merge 1 commit into
Conversation
|
I had to guess on an upper safe limit for how much memory to allocate for this banner ( |
|
That could prove useful, thanks! |
|
I think this functionality should be moved from userauth_list() and added to every authentication method (password, publickey, hostbased) instead. btw. is the do-while necessary? |
|
It would be nice to be able to have the banner available no matter what auth was attempted, since the spec says:
I chose to implement it most simply as part of The do/while loop is used in order to handle the possibility of multiple banners sent in one reply, as well as to loop back and grab the next message (userauth success or failure) after the banner. There's probably a better way to do this like dispatching based on the type of message extracted, but this worked at the moment. |
| session->userauth_list_state = libssh2_NB_state_idle; | ||
| return NULL; | ||
| } | ||
| if (session->userauth_list_data[0] == SSH_MSG_USERAUTH_BANNER) { |
There was a problem hiding this comment.
Does not check userauth_list_data_len before accessing first byte of data.
| return NULL; | ||
| } | ||
| if (session->userauth_list_data[0] == SSH_MSG_USERAUTH_BANNER) { | ||
| methods_len = _libssh2_ntohu32(session->userauth_list_data + 1); |
There was a problem hiding this comment.
Does not check to see if length is > 5 before accessing next 4 bytes.
|
I've added a couple comments to this code. There is a PR coming which resolves both of these issues but you'll need to rebase this feature after that fix is landed. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This feature is just what I'm looking for. Are there any plans to revisit this issue? Thanks! |
This is currently working privately to collect
SSH_MSG_USERAUTH_BANNERcontents via a NSE script for Nmap.Reference: RFC 4252, section 5.4