-
Notifications
You must be signed in to change notification settings - Fork 116
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
response: fix connect tunneling bug - v3 #426
base: 0.5.x
Are you sure you want to change the base?
Conversation
This test case shows unexpected state transitions when processing http tunnels and the emission of body data.
The response was emitting partial body data depending on how you fed the parser with inbound and outbound data chunks. It seems the intended behavior is to not emit body data if HTP_STREAM_TUNNEL will eventually be entered. The fix was to allow htp_connp_REQ_CONNECT_WAIT_RESPONSE to resume in order to enter the HTP_STREAM_TUNNEL state or complete the request. The tunneling transaction was also incomplete because the request side wasn't being finalized after entering HTP_STREAM_TUNNEL. See test case for example.
Thanks @cccs-sadugas Would you have a redmine ticket for this ? Suricata-verify test ? |
Running suricata on the pcap created by the test, I see this diff
I am not sure the fix is correct, As for the length, the PR looks to improve it... So, I guess I need to dig into this app_proto diff |
This delays the callback |
// was not suspended. Otherwise, yield back to inbound processing in | ||
// case we've suspended because of a CONNECT transaction and are about | ||
// to enter a tunneled state where we won't process body data. | ||
htp_status_t rc = HTP_DATA_OTHER; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why HTP_DATA_OTHER
? This prevents the completion of the transaction...
HTP_OK
looks better, does it not ?
Thanks for the initial feedback! I will try to create a redmine ticket, look at comments, and do more testing with Suricata in the next week or two. |
Hello @simdugas will you work on this again ? |
Yes, as soon as I find spare time to do so. Sorry for the delay! |
@simdugas did you not do a CV PR with the PCAP you showed me last week ? |
The response was emitting partial body data depending on how you fed the parser with inbound and outbound data chunks. It seems the intended behavior is to not emit body data if
HTP_STREAM_TUNNEL
will eventually be entered (please correct if mistaken).The fix was to allow
htp_connp_REQ_CONNECT_WAIT_RESPONSE
to resume in order to enter the HTP_STREAM_TUNNEL or complete the request.The tunneling transaction was also incomplete because the request side wasn't being finalized after entering
HTP_STREAM_TUNNEL
.See test case for example.