From f2ea7f021f3f866c536fa75e3b6ddd622778fc26 Mon Sep 17 00:00:00 2001 From: its-a-feature Date: Fri, 4 Oct 2024 16:26:08 -0500 Subject: [PATCH] fixing issue with httpx profile for query params --- .../poseidon/poseidon/agent_code/pkg/profiles/httpx.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Payload_Type/poseidon/poseidon/agent_code/pkg/profiles/httpx.go b/Payload_Type/poseidon/poseidon/agent_code/pkg/profiles/httpx.go index 3a5075f..f9c80c8 100644 --- a/Payload_Type/poseidon/poseidon/agent_code/pkg/profiles/httpx.go +++ b/Payload_Type/poseidon/poseidon/agent_code/pkg/profiles/httpx.go @@ -768,6 +768,7 @@ func (c *C2HTTPx) CreateDynamicMessage(content []byte, isGetTaskingRequest bool) utils.PrintDebug(fmt.Sprintf("Error creating new http request: %s", err.Error())) return nil, err } + q := req.URL.Query() switch variation.Client.Message.Location { case "cookie": req.AddCookie(&http.Cookie{ @@ -775,7 +776,7 @@ func (c *C2HTTPx) CreateDynamicMessage(content []byte, isGetTaskingRequest bool) Value: string(agentMessageBytes), }) case "query": - req.Form.Set(variation.Client.Message.Name, string(agentMessageBytes)) + q.Add(variation.Client.Message.Name, string(agentMessageBytes)) case "header": req.Header.Set(variation.Client.Message.Name, string(agentMessageBytes)) default: @@ -795,13 +796,11 @@ func (c *C2HTTPx) CreateDynamicMessage(content []byte, isGetTaskingRequest bool) } } // adding query parameters is a little weird in go - q := req.URL.Query() + for key, _ := range variation.Client.Parameters { q.Add(key, variation.Client.Parameters[key]) } - if len(variation.Client.Parameters) > 0 { - req.URL.RawQuery = q.Encode() - } + req.URL.RawQuery = q.Encode() return req, nil } func (c *C2HTTPx) GetDynamicMessageResponse(resp *http.Response, isGetTaskingRequest bool) ([]byte, error) {