Skip to content

Commit 03a20f6

Browse files
authored
Split .NET features from windows file & process rules (#1130)
* remove .NET features * create separate read-file-in-dotnet.yml * remove .NET features * create separate write-file-dotnet.yml * split create process rule into windows & .NET * change static scope to instruction * change static scope to insn and add dotnet match * change static & dynamic scope to insn & call and add dotnet match * change static scope to insn
1 parent 3ce071c commit 03a20f6

6 files changed

Lines changed: 87 additions & 38 deletions

File tree

host-interaction/file-system/read/read-file-on-windows.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,3 @@ rule:
2828
- api: LZRead
2929
- api: _read
3030
- api: fread
31-
- api: System.IO.File::ReadAllBytes
32-
- api: System.IO.File::ReadAllBytesAsync
33-
- api: System.IO.File::ReadAllLines
34-
- api: System.IO.File::ReadAllLinesAsync
35-
- api: System.IO.File::ReadAllText
36-
- api: System.IO.File::ReadAllTextAsync
37-
- api: System.IO.File::ReadLines

host-interaction/file-system/write/write-file-on-windows.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,3 @@ rule:
3636
- api: ZwWriteFile
3737
- api: _fwrite
3838
- api: fwrite
39-
- api: System.IO.File::WriteAllBytes
40-
- api: System.IO.File::WriteAllBytesAsync
41-
- api: System.IO.File::WriteAllLines
42-
- api: System.IO.File::WriteAllLinesAsync
43-
- api: System.IO.File::WriteAllText
44-
- api: System.IO.File::WriteAllTextAsync
45-
- api: System.IO.File::AppendAllLines
46-
- api: System.IO.File::AppendAllLinesAsync
47-
- api: System.IO.File::AppendAllText
48-
- api: System.IO.File::AppendAllTextAsync
49-
- api: System.IO.File::AppendText
50-
- api: System.IO.FileInfo::AppendText
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
rule:
2+
meta:
3+
name: create process in .NET
4+
namespace: host-interaction/process/create
5+
authors:
6+
- moritz.raabe@mandiant.com
7+
- social.tarang@gmail.com
8+
scopes:
9+
static: instruction
10+
dynamic: call
11+
mbc:
12+
- Process::Create Process [C0017]
13+
examples:
14+
- 692f7fd6d198e804d6af98eb9e390d61:0x6000003
15+
features:
16+
- or:
17+
- api: System.Diagnostics.Process::Start

host-interaction/process/create/create-process-on-windows.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,29 @@ rule:
55
authors:
66
- moritz.raabe@mandiant.com
77
scopes:
8-
static: basic block
8+
static: instruction
99
dynamic: call
1010
mbc:
1111
- Process::Create Process [C0017]
1212
examples:
1313
- 9324D1A8AE37A36AE560C37448C9705A:0x406DB0
1414
- Practical Malware Analysis Lab 01-04.exe_:0x4011FC
15-
- 692f7fd6d198e804d6af98eb9e390d61:0x6000003
1615
features:
17-
- or:
18-
- api: kernel32.WinExec
19-
- api: kernel32.CreateProcess
20-
- api: shell32.ShellExecute
21-
- api: shell32.ShellExecuteEx
22-
- api: advapi32.CreateProcessAsUser
23-
- api: advapi32.CreateProcessWithLogon
24-
- api: advapi32.CreateProcessWithToken
25-
- api: kernel32.CreateProcessInternal
26-
- api: ntdll.NtCreateUserProcess
27-
- api: ntdll.NtCreateProcess
28-
- api: ntdll.NtCreateProcessEx
29-
- api: ntdll.ZwCreateProcess
30-
- api: ZwCreateProcessEx
31-
- api: ntdll.ZwCreateUserProcess
32-
- api: ntdll.RtlCreateUserProcess
33-
- api: System.Diagnostics.Process::Start
16+
- and:
17+
- os: windows
18+
- or:
19+
- api: kernel32.WinExec
20+
- api: kernel32.CreateProcess
21+
- api: shell32.ShellExecute
22+
- api: shell32.ShellExecuteEx
23+
- api: advapi32.CreateProcessAsUser
24+
- api: advapi32.CreateProcessWithLogon
25+
- api: advapi32.CreateProcessWithToken
26+
- api: kernel32.CreateProcessInternal
27+
- api: ntdll.NtCreateUserProcess
28+
- api: ntdll.NtCreateProcess
29+
- api: ntdll.NtCreateProcessEx
30+
- api: ntdll.ZwCreateProcess
31+
- api: ZwCreateProcessEx
32+
- api: ntdll.ZwCreateUserProcess
33+
- api: ntdll.RtlCreateUserProcess

nursery/read-file-in-dotnet.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
rule:
2+
meta:
3+
name: read file in .NET
4+
namespace: host-interaction/file-system/read
5+
authors:
6+
- moritz.raabe@mandiant.com
7+
- anushka.virgaonkar@mandiant.com
8+
scopes:
9+
static: instruction
10+
dynamic: call
11+
mbc:
12+
- File System::Read File [C0051]
13+
features:
14+
- and:
15+
- format: dotnet
16+
- or:
17+
- api: System.IO.File::ReadAllBytes
18+
- api: System.IO.File::ReadAllBytesAsync
19+
- api: System.IO.File::ReadAllLines
20+
- api: System.IO.File::ReadAllLinesAsync
21+
- api: System.IO.File::ReadAllText
22+
- api: System.IO.File::ReadAllTextAsync
23+
- api: System.IO.File::ReadLines

nursery/write-file-in-dotnet.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
rule:
2+
meta:
3+
name: write file in .NET
4+
namespace: host-interaction/file-system/write
5+
authors:
6+
- william.ballenthin@mandiant.com
7+
- anushka.virgaonkar@mandiant.com
8+
scopes:
9+
static: instruction
10+
dynamic: call
11+
mbc:
12+
- File System::Writes File [C0052]
13+
features:
14+
- and:
15+
- format: dotnet
16+
- or:
17+
- api: System.IO.File::WriteAllBytes
18+
- api: System.IO.File::WriteAllBytesAsync
19+
- api: System.IO.File::WriteAllLines
20+
- api: System.IO.File::WriteAllLinesAsync
21+
- api: System.IO.File::WriteAllText
22+
- api: System.IO.File::WriteAllTextAsync
23+
- api: System.IO.File::AppendAllLines
24+
- api: System.IO.File::AppendAllLinesAsync
25+
- api: System.IO.File::AppendAllText
26+
- api: System.IO.File::AppendAllTextAsync
27+
- api: System.IO.File::AppendText
28+
- api: System.IO.FileInfo::AppendText

0 commit comments

Comments
 (0)