Skip to content

Commit 4f20e44

Browse files
committed
Rename architecture-specific rules
1 parent 5f55ee4 commit 4f20e44

File tree

2 files changed

+23
-45
lines changed

2 files changed

+23
-45
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
rule:
22
meta:
3-
name: get number of processors via x86 assembly
3+
name: get number of processors
44
namespace: host-interaction/hardware/cpu
55
authors:
66

load-code/pe/enumerate-pe-sections.yml

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,34 @@ rule:
33
name: enumerate PE sections
44
namespace: load-code/pe
55
authors:
6-
- "@Ana06"
7-
- "@mr-tz"
6+
- sara-rn
87
scopes:
98
static: function
10-
dynamic: unsupported # requires offset, operand[1].offset, characteristic, mnemonic, basicblock features
11-
mbc:
12-
- Discovery::Code Discovery::Enumerate PE Sections [B0046.001]
13-
references:
14-
- https://0x00sec.org/t/reflective-dll-injection/3080
15-
- https://www.ired.team/offensive-security/code-injection-process-injection/reflective-dll-injection
9+
dynamic: unsupported # requires characteristic, offset, mnemonic features
1610
examples:
17-
- E4C33AC3638EEF68311F8AC0D72483C7:0x401510
11+
- 73CE04892E5F39EC82B00C02FC04C70F:0x406BA1
1812
features:
1913
- and:
2014
- os: windows
21-
# there should be some complexity to functions like this
22-
- count(basic blocks): 3 or more
23-
- optional:
24-
- offset: 0x3C = IMAGE_DOS_HEADER.e_lfanew
25-
- instruction:
26-
- or:
27-
- mnemonic: mov
28-
- mnemonic: movzx
29-
- operand[1].offset: 0x6 = IMAGE_NT_HEADERS.FileHeader.NumberOfSections
30-
- basic block:
15+
- or:
16+
- characteristic: loop
17+
- mnemonic: movzx
18+
- and:
19+
- offset: 0x3C = IMAGE_DOS_HEADER.PE.e_lfanew
3120
- or:
3221
- and:
33-
- description: IMAGE_FIRST_SECTION(nt_header)
34-
- instruction:
35-
- or:
36-
- mnemonic: add
37-
- mnemonic: mov
38-
- mnemonic: movzx
39-
- operand[1].offset: 0x14 = IMAGE_NT_HEADERS.FileHeader.SizeOfOptionalHeader
40-
- operand[1].offset: 0x18 = FileHeader.SizeOfOptionalHeader
22+
- arch: i386
23+
- offset: 0x78 = offset to IMAGE_DATA_DIRECTORY[IMAGE_DIRECTORY_ENTRY_EXPORT]
4124
- and:
42-
- description: (DWORD)dll_raw + dos_header->e_lfanew + sizeof(IMAGE_NT_HEADERS) + sizeof(IMAGE_SECTION_HEADER) * i
43-
- number: 0x28 = sizeof(IMAGE_SECTION_HEADER)
44-
- or:
45-
- and:
46-
- arch: i386
47-
- operand[1].offset: 0xF8 = sizeof(IMAGE_NT_HEADERS32)
48-
- and:
49-
- arch: amd64
50-
- operand[1].offset: 0x108 = sizeof(IMAGE_NT_HEADERS64)
51-
- 2 or more:
52-
- operand[1].offset: 0xC = IMAGE_SECTION_HEADER.VirtualAddress
53-
- operand[1].offset: 0x14 = IMAGE_SECTION_HEADER.PointerToRawData
54-
- operand[1].offset: 0x10 = IMAGE_SECTION_HEADER.SizeOfRawData
55-
# there's also offset 0x8 = IMAGE_SECTION_HEADER.Misc.PhysicalAddress, but it's likely too common
56-
- not:
57-
# non-zeroing XOR was observed in FPs
58-
- characteristic: nzxor
25+
- arch: amd64
26+
- offset: 0x88 = offset to IMAGE_DATA_DIRECTORY[IMAGE_DIRECTORY_ENTRY_EXPORT]
27+
- 3 or more:
28+
- offset: 0x14 = IMAGE_EXPORT_DIRECTORY.NumberOfFunctions
29+
- offset: 0x24 = IMAGE_EXPORT_DIRECTORY.AddressOfNameOrdinals
30+
- offset: 0x20 = IMAGE_EXPORT_DIRECTORY.AddressOfNames
31+
- offset: 0x18 = IMAGE_EXPORT_DIRECTORY.NumberOfNames
32+
- offset: 0x1C = IMAGE_EXPORT_DIRECTORY.AddressOfFunctions
33+
- optional:
34+
- or:
35+
- api: LoadLibrary
36+
- api: strcmp

0 commit comments

Comments
 (0)