Fixing direct syscall to use new format#795
Conversation
|
@jbx81-1337 what versions of Windows does this support? I gaether the best test is t get a Meterpreter session, then try to migrate? |
|
It should be supporting everything we currently support |
|
@bwatters-r7 This should be ready for review / testing |
|
Windows 10 x86 1511 |
|
I've verified this works on the following x64 builds: Win 11x64 24H2, 25H2, and 26H1 all crash after establishing a session without calling migrate. Tomorrow, I'll look into that and see if there's an issue with Defending being a lying jerk of a liar about being turned off. |
|
We are waiting to land this to a temporary branch, correct? |
|
@bwatters-r7 the fix i did now should fix the issue you were having. this should disable direct syscalls for systems before 6.1, meaning in theory we can land this to master. you call if you want me to point it to 6.5 just to be more in "peace". I would probably prefer have it in 6.5 as this give us marginally more flexibility research wise, also for future PRs |
There was a problem hiding this comment.
Pull request overview
Updates Meterpreter’s Windows direct-syscall integration to use the newer SyscallStub calling format, and adds an OS-version-based gate (via RtlGetVersion) before enabling direct syscalls.
Changes:
- Switch direct-syscall wrappers to pass an argument array + arg count into the new
SyscallStubsignature. - Add
winapi_ntdll_RtlGetVersionand expose it via theWinApi/MetApifunction table. - Add a Windows version check in
hasDirectSyscallSupport()before initializing/using direct syscalls.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| c/meterpreter/source/metsrv/winapi.h | Exposes winapi_ntdll_RtlGetVersion prototype. |
| c/meterpreter/source/metsrv/winapi.c | Updates syscall wrapper calling convention; adds version detection + gating; implements RtlGetVersion resolver. |
| c/meterpreter/source/metsrv/metapi.c | Extends the exported WinApi ntdll function table initialization to include RtlGetVersion. |
| c/meterpreter/source/common/common_winapi.h | Extends WinApiNtdll with RtlGetVersion function pointer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Christophe De La Fuente <christophe_delafuente@rapid7.com>

related to: rapid7/ReflectiveDLLInjection#21