text
stringlengths
0
1.99k
-[ lkm - hkcap.c:
Creates /proc/acpi/pcicard to communicate with the userland:
............................................................................
echo -n "${DECODEKEY}" > /proc/acpi/pcicard
............................................................................
The kernel module intercepts every new TCP connection and checks if the
secret TCP-SEQ and IP-ID is used (on any port!). This check is done in
`syn_active_check()`. The TCP window size field is used to set the
backdoor-protocol (SYN_KNOCK or SYN_KNOCK_SSL mostly).
If this condition is met, it triggers these two steps:
1. Start a userland master.c process (and passes MASTER_TRANS_STRAIGHT_ARGV
as parameter to the command line option -m).
2. It redirects the TCP stream to the userland master.c process (and thus
stealing it from the intended service).
The master.c then serves the bidding of the attacker.
-[ master - master.c:
The userland companion runs as a hidden process on the victim's server. It
handles the SSL handshake and comes with a standard functionality to
spawn a root shell or proxy a connection into the internal network.
The main routine is in master_main_handle().
-[ client - tcat.c:
Contains all the functionality to "knock" a victim's LKM (backdoor) via
TCP-SEQ+IP-ID and establish an SSL connection to the master.c process
started (by the LKM) on the victim's server.
-[ client - kernel.c:
It contains the pre-defined and secret TCP-SEQ numbers and IP-IDs. Any
combination can be used to "knock" the remote backdoor. These are not
dynamically generated and are identical for every installation.
-[ client - protocol.c:
Contains various stubs and static strings to access the backdoor via SMTP,
HTTP, or HTTPS (TLS) protocol.
............................................................................
char smtp_e1[] = "250-example.com\r\n250-STARTTLS\r\n250 SMTPUTF8\r\n";
char smtp_tls1[] = "220 Ready to start TLS\r\n";
char smtp_starttls[] = "starttls\r\n";
char smtp_hello[] = "HELO Alice\r\n";
............................................................................
----------------------------------------------------------------------------
It is trivial to detect the LKM locally.
Detecting the LKM remotely might be trivial as well but further testing is
needed:
>>> Password authentication is done _after_ the SSL handshake <<<
Thus it should be possible to "knock" the backdoor with a TCP connection
(SEQ=920587710 and ID=10213) and port number to a service that normally
does not support SSL (like port 80, port 22, or port 25).
1. Establish a TCP connection
2. Send a TLS-CLIENT-HELLO
3. A compromised server will respond with a valid TLS-SERVER-HELLO whereas
any other server will not.
----[ 2.3 Private Cobalt Strike Beacon
Drop Location: mnt/hgfs/Desktop/111/beacon
This is a custom Cobalt Strike C2 Beacon. This source code was being worked
on using Intellij IDEA IDE. beacon/.idea/workspace.xml contains pointers to
open files and positions in those files as well as the recent project search
history. The last updates in the source code were made in June 2024.
The config.cpp file contains two cobalt-strike config binary blobs. Those
are valid blobs that can be parsed with CobaltStrikeParser script from
SentinelOne and contains the following settings:
............................................................................
BeaconType - HTTP
Port - 8172
SleepTime - 60842
MaxGetSize - 1048576
Jitter - 0
MaxDNS - Not Found
PublicKey_MD5 - c5b6350189a4d960eee8f521b0a3061d
C2Server - 192.168.179.112,/dot.gif
UserAgent - Mozilla/5.0 (compatible; MSIE 9.0;
Windows NT 6.1; WOW64; Trident/5.0; BOIE9;ENUSSEM)
HttpPostUri - /submit.php
..
Watermark_Hash - BeudtKgqnlm0Ruvf+VYxuw==
Watermark - 126086
............................................................................
KIM's version also includes early revision of code that in 2025 was included
in the LKM backdoor from above (hkcap.c). However, it is incomplete and
missing some key files (like config.h)