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

support wildcards and skips for bytes feature #233

Open
mike-hunhoff opened this issue Aug 13, 2020 · 4 comments
Open

support wildcards and skips for bytes feature #233

mike-hunhoff opened this issue Aug 13, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@mike-hunhoff
Copy link
Collaborator

Add support for wildcards and skips for bytes feature similar to Yara hexadecimal strings.

@mike-hunhoff mike-hunhoff added the enhancement New feature or request label Aug 13, 2020
@mike-hunhoff mike-hunhoff changed the title allow wildcards and skips for bytes feature support wildcards and skips for bytes feature Aug 13, 2020
@williballenthin
Copy link
Collaborator

we can support this by translating the bytes literal into a regular express (python supports byte literals in regexes).

how would you use this feature?

@kulinacs
Copy link

kulinacs commented Apr 2, 2021

I was looking for this feature to write rules for direct syscall invocations - commonly generated by tooling like SysWhispers.

4C 8B D1                mov     r10, rcx
B8 ?? ?? ?? ??          mov     eax, ??
0F 05                   syscall
C3                      retn

should be a pretty straight forward byte sequence for a capa rule, but I'm not sure how I would implement without byte wildcards.

edit: I kept working on this and I think I should be able to do it with mnemonics after reading the Heaven's Gate rule. probably a similar situation for a lot these

@mr-tz
Copy link
Collaborator

mr-tz commented Apr 5, 2021

edit: I kept working on this and I think I should be able to do it with mnemonics after reading the Heaven's Gate rule. probably a similar situation for a lot these

right, in capa we could match on a basic block containing something like:

  features:
    - and:
      - mnemonic: syscall
      - mnemonic: retn

Do you have a file/hash you can share for this specific example?

@kulinacs
Copy link

kulinacs commented Apr 5, 2021

I was using WdToggle, a Beacon Object File using the InlineWhispers library to test - https://github.com/outflanknl/WdToggle

BOF's are a bit odd to run against capa, since they're more structured than shellcode but not PE's, but running them as shellcode seems to work just fine. WdToggle was an arbitrary choice on my end - mostly because it was linked in the InlineWhispers repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants