-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
tlsi net/http: HTTP/1.x transport connection broken: malformed HTTP response #5373
tlsi net/http: HTTP/1.x transport connection broken: malformed HTTP response #5373
Comments
@SuperXiaoxiong can you provide template? |
|
Seems to work without $ docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.13-management PS C:\Users\user\Desktop> .\nuclei.exe -tlsi -t .\template.yaml -u https://... -debug
...
[INF] [c027dc71-857c-4298-affc-231355ebd25d] Dumped HTTP request for https://...
GET / HTTP/1.1
Host: ...
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 Edg/108.0.1462.42
Connection: close
Accept: */*
Accept-Language: en
Accept-Encoding: gzip
[WRN] [c027dc71-857c-4298-affc-231355ebd25d] Could not execute step: [:RUNTIME] got err while executing https://1.... <- GET ... giving up after 2 attempts: Get "https://...": net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x00\x00\x1e\x04\x00\x00\x00\x00\x00\x00\x05\x00\x10\x00\x00\x00\x03\x00\x00\x00\xfa\x00\x06\x00\x10\x01@\x00\x01\x00\x00\x10\x00\x00\x04\x00\x10\x00\x00" Without the |
@SuperXiaoxiong |
@SuperXiaoxiong As a veeeeery ugly and never production-ready workaround and only if your target HTTP server supports HTTP2 you can address this by rebuilding nuclei with a go mod replace directive on retryablehttp-go and forcing the client ( // Do wraps calling an HTTP method with retries.
func (c *Client) Do(req *Request) (*http.Response, error) {
...
} else {
// Attempt the request with standard behavior
resp, err = c.HTTPClient2.Do(req.Request)
} Note this might break a lot of stuff and has only been tested against a docker container behind a reverse proxy that supports HTTP/2. Unfortunately just using the |
@ehsandeep this is a bit cleaner but still hacky. diff --git a/do.go b/do.go
index 8ca57f7..09acaae 100644
--- a/do.go
+++ b/do.go
@@ -53,6 +53,12 @@ func (c *Client) Do(req *Request) (*http.Response, error) {
// Check if we should continue with retries.
checkOK, checkErr := c.CheckRetry(req.Context(), resp, err)
+ // if err is about malformed responses then an HTTP/1.1 transport received an HTTP/2 response. Retry with http/2.
+ if err != nil && strings.Contains(err.Error(), "net/http: HTTP/1.x transport connection broken: malformed HTTP response") {
+ resp, err = c.HTTPClient2.Do(req.Request)
+ checkOK, checkErr = c.CheckRetry(req.Context(), resp, err)
+ }
+
// if err is equal to missing minor protocol version retry with http/2
if err != nil && strings.Contains(err.Error(), "net/http: HTTP/1.x transport connection broken: malformed HTTP version \"HTTP/2\"") {
resp, err = c.HTTPClient2.Do(req.Request) Seems to work for this particular template. If this is something PD wants to battle-test before merging I could open a PR on retryablehttp-go for it. |
Here are the same case
the template
|
resolved via retryablehttp-go projectdiscovery/retryablehttp-go#282 |
use tlsi parameter will cause transport connection broken: malformed HTTP response
.\nuclei.exe -tlsi -v -u target -t "rabbitmq1.yaml" -duc -debug
no tlsi parameter will get the correct result
[c027dc71-857c-4298-affc-231355ebd25d:word-1] [http] [low] xxx
if without -debug and -v
Expect :
If no random ja request retry should follow a failed random tlsi request
The text was updated successfully, but these errors were encountered: