Skip to content

injection_createremotethread: detect CreateRemoteThreadEx / NtCreateThreadEx by target ProcessId - #609

Open
systems1024github wants to merge 1 commit into
CAPESandbox:masterfrom
systems1024github:fix-createremotethread-ex
Open

systems1024github wants to merge 1 commit into
CAPESandbox:masterfrom
systems1024github:fix-createremotethread-ex

Conversation

@systems1024github

Copy link
Copy Markdown

Fixes #607

On Windows 10/11 guests, injection_createremotethread does not fire on the classic VirtualAllocEx + WriteProcessMemory + CreateRemoteThread injection:

  • capemon logs the call as CreateRemoteThreadEx, which the exact-name test (== "CreateRemoteThread") misses;
  • the inner NtCreateThreadEx is called with a process handle of its own, not the one returned by OpenProcess/NtOpenProcess, so the handle lookup fails too. capemon does log the target's ProcessId.

This change accepts CreateRemoteThreadEx and, when the handle is not one the signature saw opened, falls back to the call's ProcessId if it is one of self.process_pids. The existing handle path is unchanged.

Tested on a Windows 11 guest:

  • before: the injection 4916 -> 6140 (explorer.exe) was not flagged;
  • after: the signature fires, "hello-inject.exe(3048) -> explorer.exe(2920)", severity 3.

The two PID pairs come from two different runs of the same sample, so they differ.

Checked with python -m py_compile, black --check, isort --check-only and the CI's flake8 --select=E9,F63,F7,F82.

🤖 Generated with Claude Code

https://claude.ai/code/session_013ZmeuAL8LRvUVBUbjrEu8j

…hreadEx by target ProcessId

Fixes CAPESandbox#607

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZmeuAL8LRvUVBUbjrEu8j
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.

injection_createremotethread misses Windows 10/11 remote-thread injection (CreateRemoteThreadEx / NtCreateThreadEx)

1 participant