Skip to content

YARA · Signature Base (Florian Roth / Nextron)

SIGNATURE_BASE_HKTL_Khepri_Beacon_Sep21_1

Detects Khepri C2 framework beacons

Hack toolSignature Base (Florian Roth / Nextron)Detection Rule License 1.1Compiles with YARA-X
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

hktl-khepri-beacon-sep21-1.yarDetection Rule License 1.1
rule SIGNATURE_BASE_HKTL_Khepri_Beacon_Sep21_1 : FILE
{
	meta:
		description = "Detects Khepri C2 framework beacons"
		author = "Florian Roth (Nextron Systems)"
		id = "b2c8aaf7-7953-55a3-8499-565800fa01f1"
		date = "2021-09-08"
		modified = "2023-12-05"
		reference = "https://github.com/geemion/Khepri/"
		source_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/yara/gen_khepri.yar#L2-L44"
		license_url = "https://github.com/Neo23x0/signature-base/blob/94a1c48d7ab499879287ff611dfe7f9c56376030/LICENSE"
		hash = "86c48679db5f4c085fd741ebec5235bc6cf0cdf8ef2d98fd8a689ceb5088f431"
		logic_hash = "c688dbda6006ef28305285f6aeec24a23cbfe9174d09cf4e3586bd0cf7290e60"
		score = 90
		quality = 85
		tags = "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)

IdentifierTypeValueModifiers
$x1text"NT %d.%d Build %d ProductType:%s"ascii fullword
$xe1text"YzIuQ01EUEFSQU0uY21k"ascii
$xe2text"MyLkNNRFBBUkFNLmNtZ"ascii
$xe3text"jMi5DTURQQVJBTS5jbW"ascii
$sx1text"c2.ProcessItem.user"ascii fullword
$sx2text"c2.CMDPARAM.cmd"ascii fullword
$sx3text"c2.DownLoadFile.file_path"ascii fullword
$sa1text"file size zero"
$sa2text"cmd.exe /c "
$sa3text"error parse param"
$sa4text"innet_ip"
$op1hex{ c3 b9 b4 98 49 00 87 01 5d c3 b8 b8 98 49 00 c3 8b ff }
$op2hex{ 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 }
$op3hex{ 90 d5 0c 43 00 34 0d 43 00 ea 0c 43 00 7e 0d 43 00 b6 0d 43 00 cc }
$op4hex{ 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

In 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.

Drop a file here or click to chooseScanned locally with YARA-X. Files up to 200 MB.

Open in editor

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)

Original rule

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