YARA · Signature Base (Florian Roth / Nextron)
SIGNATURE_BASE_HKTL_Khepri_Beacon_Sep21_1
Detects Khepri C2 framework beacons
- Author
- Florian Roth (Nextron Systems)
- Date
- 2021-09-08
- Modified
- 2023-12-05
- Score / Quality
- 90 / 85
What this rule detects
Detects Khepri C2 framework beacons
Targets: Windows PE, Linux ELF.
It defines 15 patterns (11 text, 4 hex, 0 regex).
Summary generated from the rule's metadata and condition.
Rule source
rule SIGNATURE_BASE_HKTL_Khepri_Beacon_Sep21_1 : FILE
{
meta:
= "Detects Khepri C2 framework beacons"
= "Florian Roth (Nextron Systems)"
= "b2c8aaf7-7953-55a3-8499-565800fa01f1"
= "2021-09-08"
= "2023-12-05"
= "https://github.com/geemion/Khepri/"
= "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/gen_khepri.yar#L2-L44"
= "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
= "86c48679db5f4c085fd741ebec5235bc6cf0cdf8ef2d98fd8a689ceb5088f431"
= "c688dbda6006ef28305285f6aeec24a23cbfe9174d09cf4e3586bd0cf7290e60"
= 90
= 85
= "FILE"
strings:
$x1 = "NT %d.%d Build %d ProductType:%s" ascii fullword
$xe1 = "YzIuQ01EUEFSQU0uY21k" ascii
$xe2 = "MyLkNNRFBBUkFNLmNtZ" ascii
$xe3 = "jMi5DTURQQVJBTS5jbW" ascii
$sx1 = "c2.ProcessItem.user" ascii fullword
$sx2 = "c2.CMDPARAM.cmd" ascii fullword
$sx3 = "c2.DownLoadFile.file_path" ascii fullword
$sa1 = "file size zero"
$sa2 = "cmd.exe /c "
$sa3 = "error parse param"
$sa4 = "innet_ip"
$op1 = { c3 b9 b4 98 49 00 87 01 5d c3 b8 b8 98 49 00 c3 8b ff }
$op2 = { 8b f1 80 3d 58 97 49 00 00 0f 85 96 00 00 00 33 c0 40 b9 50 97 49 00 87 01 33 db }
$op3 = { 90 d5 0c 43 00 34 0d 43 00 ea 0c 43 00 7e 0d 43 00 b6 0d 43 00 cc }
$op4 = { 69 c0 ff 00 00 00 8b 4d c0 23 88 40 7c 49 00 89 4d c0 8b 45 cc 0b 45 c0 89 45 cc 8b 45 d0 }
condition:
( uint16( 0 ) == 0x5a4d or uint32be( 0 ) == 0x7f454c46 ) and filesize < 2000KB and ( 1 of ( $x* ) or 2 of ( $sx* ) or all of ( $sa* ) or 3 of ( $op* ) ) or ( filesize < 10MB and 1 of ( $xe* ) ) or 5 of them
}
Strings (15 patterns)
| Identifier | Type | Value | Modifiers |
|---|---|---|---|
| $x1 | text | "NT %d.%d Build %d ProductType:%s" | ascii fullword |
| $xe1 | text | "YzIuQ01EUEFSQU0uY21k" | ascii |
| $xe2 | text | "MyLkNNRFBBUkFNLmNtZ" | ascii |
| $xe3 | text | "jMi5DTURQQVJBTS5jbW" | ascii |
| $sx1 | text | "c2.ProcessItem.user" | ascii fullword |
| $sx2 | text | "c2.CMDPARAM.cmd" | ascii fullword |
| $sx3 | text | "c2.DownLoadFile.file_path" | ascii fullword |
| $sa1 | text | "file size zero" | |
| $sa2 | text | "cmd.exe /c " | |
| $sa3 | text | "error parse param" | |
| $sa4 | text | "innet_ip" | |
| $op1 | hex | { c3 b9 b4 98 49 00 87 01 5d c3 b8 b8 98 49 00 c3 8b ff } | |
| $op2 | hex | { 8b f1 80 3d 58 97 49 00 00 0f 85 96 00 00 00 33 c0 40 b9 50 97 49 00 87 01 33 db } | |
| $op3 | hex | { 90 d5 0c 43 00 34 0d 43 00 ea 0c 43 00 7e 0d 43 00 b6 0d 43 00 cc } | |
| $op4 | hex | { 69 c0 ff 00 00 00 8b 4d c0 23 88 40 7c 49 00 89 4d c0 8b 45 cc 0b 45 c0 89 45 cc 8b 45 d0 } |
Condition
( uint16( 0 ) == 0x5a4d or uint32be( 0 ) == 0x7f454c46 ) and filesize < 2000KB and ( 1 of ( $x* ) or 2 of ( $sx* ) or all of ( $sa* ) or 3 of ( $op* ) ) or ( filesize < 10MB and 1 of ( $xe* ) ) or 5 of themIn plain words (Heuristic)
- The file must start with “MZ” — a Windows executable (PE).
- The file must start with the ELF header — a Linux/Unix executable.
- The file must be smaller than 2000KB (a cheap guard that skips large files).
- The file must be smaller than 10MB (a cheap guard that skips large files).
- All patterns in ( $sa* ) must match.
- At least 1 patterns in ( $x* ) must match.
- At least 2 patterns in ( $sx* ) must match.
- At least 3 patterns in ( $op* ) must match.
- At least 1 patterns in ( $xe* ) must match.
- At least 5 patterns in the rule must match.
Test this rule in your browser
Drop a file to scan it with this rule using YARA-X compiled to WebAssembly. Nothing is uploaded.
References
Sample hashes
Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).
- 86c48679db5f4c085fd741ebec5235bc6cf0cdf8ef2d98fd8a689ceb5088f431
Licence & attribution
Author: Florian Roth (Nextron Systems)
Source repository: Signature Base (Florian Roth / Nextron) @ 94a1c48d7a
Licence: Detection Rule License 1.1 (repository licence)
Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.
Rule id: b2c8aaf7-7953-55a3-8499-565800fa01f1
Tags:FILE
Related rules
- Hack toolSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2020-08-09
- Hack toolSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2022-12-27
- Hack toolSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2022-09-15
- Hack toolSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2021-03-03
- Hack toolSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2021-03-02
- Hack toolSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2020-04-07
- APT / threat actorSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2022-01-16
- APT / threat actorSignature Base (Florian Roth / Nextron)· Florian Roth (Nextron Systems)· 2022-01-16