Skip to content
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

Add new rule linked-against-minhook.yml #920

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions linking/static/minhook/linked-against-minhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
rule:
meta:
name: linked against MinHook
namespace: linking/static/minhook
authors:
- [email protected]
scopes:
static: file
dynamic: file
att&ck:
- Defense Evasion::Hijack Execution Flow [T1574]
references:
- https://www.codeproject.com/Articles/44326/MinHook-The-Minimalistic-x-x-API-Hooking-Libra
- https://github.com/TsudaKageyu/minhook
examples:
- 3d5a99114b24e4373b77077072e4ed52ffce9e2607ec6fe4ed2f08d3b1c59026
features:
- or:
- string: "MH_ERROR_ALREADY_INITIALIZED"
- string: "MH_ERROR_NOT_INITIALIZED"
- string: "MH_ERROR_ALREADY_CREATED"
- string: "MH_ERROR_NOT_CREATED"
- string: "MH_ERROR_ENABLED"
- string: "MH_ERROR_DISABLED"
- string: "MH_ERROR_NOT_EXECUTABLE"
- string: "MH_ERROR_UNSUPPORTED_FUNCTION"
- string: "MH_ERROR_MEMORY_ALLOC"
- string: "MH_ERROR_MEMORY_PROTECT"
- string: "MH_ERROR_MODULE_NOT_FOUND"
- string: "MH_ERROR_FUNCTION_NOT_FOUND"
- string: "MH_Initialize"
Copy link
Collaborator

Choose a reason for hiding this comment

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

are any of these exports?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When MinHook is compiled as a standalone DLL some of the symbols are exported, e.g. https://github.com/TsudaKageyu/minhook/blob/c1a7c3843bd1a5fe3eb779b64c0d823bca3dc339/dll_resources/MinHook.def

Copy link
Collaborator

Choose a reason for hiding this comment

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

do you think it's worth adding export features for these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added export features in d2d7791. I can imagine situations where these symbols are exported in executables compiled with MinHook.

- string: "MH_Uninitialize"
- string: "MH_CreateHook"
- string: "MH_CreateHookApi"
- string: "MH_CreateHookApiEx"
- string: "MH_RemoveHook"
- string: "MH_EnableHook"
- string: "MH_DisableHook"
- string: "MH_QueueEnableHook"
- string: "MH_QueueDisableHook"
- string: "MH_ApplyQueued"
- export: "MH_Initialize"
- export: "MH_Uninitialize"
- export: "MH_CreateHook"
- export: "MH_CreateHookApi"
- export: "MH_CreateHookApiEx"
- export: "MH_RemoveHook"
- export: "MH_EnableHook"
- export: "MH_DisableHook"
- export: "MH_QueueEnableHook"
- export: "MH_QueueDisableHook"
- export: "MH_ApplyQueued"
Loading