Fixed passing custom headers to powershell stager #548
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I had the same issues as in #230 but have a suggestion for a fix that does not break the ability to add multiple custom headers.
When iterating over
customHeaders
(line 632), it seems that all headers apart from thecookie
header(s) should be passed to the stager. I think it's wrong to only add header values and not the keys to the filtered list, which previously was the case and was the cause why the filtered list didn't work. By appending the key (which in reality isheaderkey: headervalue
) to theremove
list (which is the filtered list) and passing this list joined by,
to the stager, the stager code (e.g.empire/server/data/agent/stagers/http.ps1
) correctly picks up the custom headers, splits them by,
and treats the entries in that list as header keys and header values when splitting them by:
:The following
DefaultProfiles
work for http listeners with the modified code: