/* Hagaseca / THost9 install step seen over ADB on 2026-12-01 (two honeypots): after pushing the APK to /data/data/com.android.shell/.hg_apk the sender runs echo '' | base64 -d | gzip -d | sh -s -- '' '' Decoded script: sha256 4f27474d7eb759f15cc0b587a829a24d1453888b6f9eb7741d99eff3435f234c (2163 bytes); gzip blob sha256 8898cf05c31555905174adcb1273076257570fca85c8bc7fc879aeda1d9e8407 (945 bytes). These are text rules for shell histories, logcat/adb logs, ttylogs and carved scripts. Tested with YARA 4.5 on 2026-12-01 on text extracted from honeypot logs (the script was never captured as a file). */ rule Hagaseca_THost9_Install_Script_Decoded { meta: description = "Decoded Hagaseca/THost9 ADB install script: streams the pushed APK into pm install, copies it under /data/.hg and /system/app when root, grants permissions, enables the accessibility service and starts .Fore" date = "2026-12-01" sha256 = "4f27474d7eb759f15cc0b587a829a24d1453888b6f9eb7741d99eff3435f234c" strings: $a1 = "PKG=com.hagaseca.thost9" ascii $a2 = "TH9=\"$1\"" ascii $a3 = "APK_LEN=\"$2\"" ascii $b1 = "mkdir -p /data/.hg/$PKG" ascii $b2 = "ln -s /data/.hg/$PKG /system/app" ascii $b3 = "install -r -g -S $APK_LEN" ascii $b4 = "package_verifier_user_consent -1" ascii $b5 = "dumpsys deviceidle whitelist +$PKG" ascii $b6 = "$PKG/.AS" ascii $b7 = "am startservice $PKG/.Fore" ascii $b8 = "else echo low: $VER" ascii condition: filesize < 200KB and ( (1 of ($a*) and 3 of ($b*)) or 5 of ($b*) ) } rule Hagaseca_THost9_Install_Cmdline_Encoded { meta: description = "Hagaseca/THost9 install command line as typed over ADB: base64 gzip script piped to sh with the .hg_apk path and its size as arguments" date = "2026-12-01" cmdline_sha256 = "0f6433744c26fcf1fdc7fbd64eff16f5a58f8bb4bf47c2ff7baf72c6aeb729ca" strings: $blob = "H4sIAAAAAAAC/41VbW+bSBD+7l8xRehsdAWSfDklHD1ZjZtYTR3LkLsPbQ9tYI1XARbtLrFq8eM7y4ttnCZ3fAB2dl6eeXZ2Jry99A3z3PBG0+Xn6G62wNUFrpafb/yY586GpETSmDhqw6W69EZ" ascii $pipe = "| base64 -d | gzip -d | sh -s -- '" ascii $path = "/.hg_apk'" ascii condition: filesize < 20MB and ( $blob or ( $pipe and $path in (@pipe .. @pipe + 200) ) ) }