-
Notifications
You must be signed in to change notification settings - Fork 164
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
Update and refactor memory allocation/permission rules #836
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now named: allocate or change RWX memory
lib/allocate-rw-memory.yml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now called: allocate or change RW memory
- api: kernel32.VirtualProtect | ||
- api: kernel32.VirtualProtectEx | ||
- api: NtAllocateVirtualMemory | ||
- api: ZwAllocateVirtualMemory | ||
- api: NtMapViewOfSection | ||
- api: ZwMapViewOfSection | ||
- api: NtProtectVirtualMemory | ||
- api: ZwProtectVirtualMemory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the removed APIs to change memory protection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a nice cleanup
- basic block: | ||
- and: | ||
# xor ecx, ecx ; lpAddress | ||
# mov edx, 31Fh ; dwSize | ||
# mov r8d, 1000h ; flAllocationType | ||
# lea r9d, [rcx+40h] ; flProtect | ||
# call cs:VirtualAlloc | ||
- match: allocate memory | ||
- or: | ||
- number: 0x40 | ||
- instruction: | ||
- mnemonic: lea | ||
- offset: 0x40 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to allocate RWX memory
/ allocate RW memory
@jtothej feel free to review and provide feedback here, as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a beautiful update that really shows how we can abstract logic with capa. thanks @mr-tz !
per the comments in #798 / https://github.com/mandiant/capa-rules/pull/798/files#r1264358655