Skip to content

add get http custom header#1147

Merged
mike-hunhoff merged 3 commits intomandiant:masterfrom
msanchit-dev:get-http-custom-headers
Mar 31, 2026
Merged

add get http custom header#1147
mike-hunhoff merged 3 commits intomandiant:masterfrom
msanchit-dev:get-http-custom-headers

Conversation

@msanchit-dev
Copy link
Copy Markdown
Contributor

ref #3

  • Adds detection for HttpQueryInfo usage with HTTP_QUERY_CUSTOM.
  • passes lint checks (without example).

Rationale
The Malware Case Study describes how Zeus Malware uses the HTTP_QUERY_CUSTOM flag within the HttpQueryInfo() API to validate its Command-and-Control (C2) communications. By querying for a non-standard "HALL" header in the server's response, the malware performs a stealthy handshake to confirm it has reached an authentic drop site.

BreadBear is a prototype malware based on Bleeding Bear. In the proposed attack chain, HTTP_QUERY_CUSTOM is used to programmatically retrieve the Content-Length of a stage 3 payload from a Discord CDN response. This allows the malware to allocate a precise amount of memory via malloc() for the incoming base64-encoded binary.

The ddabx.dll malware uses the HTTP_QUERY_CUSTOM flag with HttpQueryInfo() to extract command-and-control (C2) data hidden within non-standard HTTP headers like g_InstallPath and g_InstallDll. By searching for these custom headers instead of the standard response body, the malware effectively bypasses basic web filters and security tools that only inspect common traffic fields.

Attackers can use custom HTTP headers to perform OSINT reconnaissance by finding leaked source code or internal configurations on platforms like GitHub using Google dorking.

Copy link
Copy Markdown
Collaborator

@mike-hunhoff mike-hunhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @msanchit-dev , I've left a quick comment for your review.

Copy link
Copy Markdown
Contributor Author

@msanchit-dev msanchit-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mike-hunhoff . I have incorporated your feedback.

@msanchit-dev msanchit-dev force-pushed the get-http-custom-headers branch from 0595008 to 0158196 Compare March 30, 2026 16:38
@mike-hunhoff
Copy link
Copy Markdown
Collaborator

@msanchit-dev lints are failing - please ensure all lints pass locally before requesting another review.

@msanchit-dev
Copy link
Copy Markdown
Contributor Author

My apologies for not running lint again after renaming the rule. I had run it earlier but missed to run it after the rename. I have fixed the lint error:

$ python ../capa/scripts/lint.py --thorough -t "get custom HTTP header" -v .
INFO     lint: collecting potentially referenced samples                                                                                                                                              lint.py:1238
INFO     lint: no lints failed, nice!      

@mike-hunhoff mike-hunhoff merged commit 2af9fbf into mandiant:master Mar 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants