Skip to content

Commit

Permalink
adding new rules based on private Linux sample(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-hunhoff committed Sep 1, 2023
1 parent a20c17d commit 51bc0a5
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 4 deletions.
1 change: 1 addition & 0 deletions communication/socket/receive/receive-data-on-socket.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ rule:
- api: System.Net.Sockets.Socket::EndReceive
- api: System.Net.Sockets.Socket::EndReceiveFrom
- api: System.Net.Sockets.Socket::EndReceiveMessageFrom
- api: recvmsg
1 change: 1 addition & 0 deletions host-interaction/file-system/create/create-directory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rule:
- api: ZwCreateDirectoryObject
- api: SHCreateDirectory
- api: SHCreateDirectoryEx
- api: mkdir
- api: _mkdir
- api: _wmkdir
- api: System.IO.Directory::CreateDirectory
Expand Down
1 change: 1 addition & 0 deletions host-interaction/file-system/delete/delete-directory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ rule:
- or:
- api: RemoveDirectory
- api: RemoveDirectoryTransacted
- api: rmdir
- api: _rmdir
- api: _wrmdir
- api: System.IO.DirectoryInfo::Delete
Expand Down
4 changes: 4 additions & 0 deletions host-interaction/file-system/meta/get-file-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ rule:
- api: System.IO.File::GetLastWriteTime
- api: System.IO.File::GetLastWriteTimeUtc
- property/read: System.IO.FileSystemInfo::Attributes
- api: stat
- api: fstat
- api: lstat
- api: fstatat
2 changes: 2 additions & 0 deletions host-interaction/file-system/meta/set-file-attributes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ rule:
- api: System.IO.File::SetLastWriteTime
- api: System.IO.File::SetLastWriteTimeUtc
- property/write: System.IO.FileSystemInfo::Attributes
- api: utime
- api: utimes
2 changes: 2 additions & 0 deletions host-interaction/process/terminate/terminate-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ rule:
- api: System.Diagnostics.Process::WaitForExitAsync
- api: System.Environment::Exit
- api: System.Windows.Forms.Application::Exit
- api: exit
- api: Exit
- and:
- optional:
- match: open process
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rule:
meta:
name: get current user on Linux
namespace: collection
namespace: host-interaction/session
authors:
- [email protected]
scope: function
Expand All @@ -13,9 +13,8 @@ rule:
- and:
- os: linux
- or:
- and:
- api: geteuid
- api: getpwuid
- api: geteuid
- api: getpwuid
- api: getlogin
- api: getlogin_r
- api: cuserid
1 change: 1 addition & 0 deletions host-interaction/thread/terminate/terminate-thread.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ rule:
- api: kernel32.TerminateThread
- api: PsTerminateSystemThread
- api: System.Threading.Thread.Abort
- api: pthread_terminate
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rule:
meta:
name: communicate with Kernel module via Netlink socket on Linux
namespace: host-interaction/kernel
authors:
- [email protected]
description: Netlink is used to transfer information between the kernel and user-space processes (https://man7.org/linux/man-pages/man7/netlink.7.html)
scope: basic block
features:
- and:
- os: linux
- api: socket
- number: 0x10 = AF_NETLINK
11 changes: 11 additions & 0 deletions nursery/create-detached-thread-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rule:
meta:
name: create detached thread on Linux
namespace: host-interaction/thread
authors:
- [email protected]
scope: basic block
features:
- and:
- os: linux
- api: pthread_detach
13 changes: 13 additions & 0 deletions nursery/get-current-pid-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rule:
meta:
name: get current PID on Linux
namespace: host-interaction/process
authors:
- [email protected]
scope: basic block
features:
- and:
- os: linux
- or:
- api: getpid
- api: getppid
13 changes: 13 additions & 0 deletions nursery/get-file-system-information-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rule:
meta:
name: get file system information on Linux
namespace: host-interaction/file-system
authors:
- [email protected]
scope: basic block
features:
- and:
- os: linux
- or:
- api: statfs
- api: fstatfs
2 changes: 2 additions & 0 deletions nursery/get-system-information-on-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rule:
namespace: host-interaction/os/info
authors:
- [email protected]
- [email protected]
scope: function
att&ck:
- Discovery::System Information Discovery [T1082]
Expand All @@ -15,3 +16,4 @@ rule:
- and:
- api: system
- string: "lshw"
- api: sysinfo
13 changes: 13 additions & 0 deletions nursery/get-user-database-entry-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
rule:
meta:
name: get user database entry on Linux
namespace: host-interaction/session
authors:
- [email protected]
scope: basic block
features:
- and:
- os: linux
- or:
- api: getpwuid
- api: getpwuid_r
12 changes: 12 additions & 0 deletions nursery/persist-via-gnome-autostart-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule:
meta:
name: persist via GNOME autostart on Linux
namespace: persistence
authors:
- [email protected]
scope: function
features:
- and:
- os: linux
- match: host-interaction/file-system/write
- substring: "X-GNOME-Autostart-enabled=true"
2 changes: 2 additions & 0 deletions nursery/set-current-directory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ rule:
- or:
- api: System.IO.Directory::SetCurrentDirectory
- api: kernel32.SetCurrentDirectory
- api: chdir
- api: fchdir
15 changes: 15 additions & 0 deletions nursery/set-thread-name-on-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
rule:
meta:
name: set thread name on Linux
namespace: host-interaction/thread
authors:
- [email protected]
scope: basic block
features:
- and:
- os: linux
- or:
- api: pthread_setname_np
- and:
- api: prctl
- number: 0xF = PR_SET_NAME

0 comments on commit 51bc0a5

Please sign in to comment.