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

fix logic after dynamic update #857

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ rule:
examples:
- 773290480d5445f11d3dc1b800728966:0x140001140
features:
- and:
# static
- basic block:
- and:
- api: SLIsGenuineLocal
- basic block:
- and:
- api: UuidFromString
- string: "55c92734-d682-4d71-983e-d6ec3f16059f"
# dynamic
- call:
- and:
- api: SLIsGenuineLocal
- call:
- and:
- api: UuidFromString
- string: "55c92734-d682-4d71-983e-d6ec3f16059f"
- or:
- and:
# static
- basic block:
- and:
- api: SLIsGenuineLocal
- basic block:
- and:
- api: UuidFromString
- string: "55c92734-d682-4d71-983e-d6ec3f16059f"
- and:
# dynamic
- call:
- and:
- api: SLIsGenuineLocal
- call:
- and:
- api: UuidFromString
- string: "55c92734-d682-4d71-983e-d6ec3f16059f"
16 changes: 9 additions & 7 deletions communication/socket/create-vmci-socket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,27 @@ rule:
authors:
- [email protected]
scopes:
static: function
static: basic block
dynamic: thread
mbc:
- Communication::Socket Communication::Create Socket [C0001.003]
references:
- https://www.vmware.com/products/beta/ws/VMCIsockets.pdf
examples:
- 9ed5660c6a442dbba9e2ba795ccc913c1f1517ce89854fe4287c1c8b36b21d52:0x180001241
- 9ed5660c6a442dbba9e2ba795ccc913c1f1517ce89854fe4287c1c8b36b21d52:0x1800011D0
features:
- or:
- and:
- os: windows
- api: DeviceIoControl
- number: 0x81032068 = VMCI_SOCKETS_GET_AF_VALUE
- optional:
- or:
- api: socket
- api: DeviceIoControl
- number: 0x81032068 = VMCI_SOCKETS_GET_AF_VALUE
- and:
- os: linux
- api: ioctl
- number: 0x7B8 = VMCI_SOCKETS_GET_AF_VALUE
- call:
- and:
- api: ioctl
- number: 0x7B8 = VMCI_SOCKETS_GET_AF_VALUE
- optional:
- api: socket
mr-tz marked this conversation as resolved.
Show resolved Hide resolved
60 changes: 31 additions & 29 deletions host-interaction/file-system/read/read-file-via-mapping.yml
Copy link
Contributor

Choose a reason for hiding this comment

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

For this rule, we could pull the optional node out of both static and dynamic blocks, which would make the rule shorter in size, remove repetition, but would add an extra level of depth to the rule (introduction of an or between the basic block and call subscopes). I prefer how it is now... but maybe we should some syntactic sugar in the future for:

- or:
  - basic block:
    - featureA
    - featureB
    - featureC
  - call:
    - featureA
    - featureB

maybe something like:

- basic block | call:
  - featureA
  - featureB
  - featureC

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, this could be nice

Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,40 @@ rule:
examples:
- Practical Malware Analysis Lab 01-01.exe_:0x401440
features:
- and:
# static
- basic block:
- and:
- api: kernel32.MapViewOfFile
- or:
- number: 4 = FILE_MAP_READ
- number: 6 = FILE_MAP_WRITE | FILE_MAP_READ
- optional:
- api: kernel32.UnmapViewOfFile
- and:
- match: get file size
- or:
- and:
# static
- basic block:
- and:
- api: kernel32.CreateFileMapping
- api: kernel32.MapViewOfFile
- or:
- number: 2 = PAGE_READONLY
- number: 4 = PAGE_READWRITE
# dynamic
- call:
- and:
- api: kernel32.MapViewOfFile
- or:
- number: 4 = FILE_MAP_READ
- number: 6 = FILE_MAP_WRITE | FILE_MAP_READ
- optional:
- api: kernel32.UnmapViewOfFile
- and:
- match: get file size
- number: 4 = FILE_MAP_READ
- number: 6 = FILE_MAP_WRITE | FILE_MAP_READ
- optional:
- api: kernel32.UnmapViewOfFile
- and:
- match: get file size
- basic block:
- and:
- api: kernel32.CreateFileMapping
- or:
- number: 2 = PAGE_READONLY
- number: 4 = PAGE_READWRITE
- and:
# dynamic
- call:
- and:
- api: kernel32.CreateFileMapping
- api: kernel32.MapViewOfFile
- or:
- number: 2 = PAGE_READONLY
- number: 4 = PAGE_READWRITE
- number: 4 = FILE_MAP_READ
- number: 6 = FILE_MAP_WRITE | FILE_MAP_READ
- optional:
- api: kernel32.UnmapViewOfFile
- and:
- match: get file size
- call:
- and:
- api: kernel32.CreateFileMapping
- or:
- number: 2 = PAGE_READONLY
- number: 4 = PAGE_READWRITE
Loading