TAJ APPS

How to extract the C2 server from Android malware (APK)

Every Android banking trojan, SMS stealer and remote-access tool reports to a command-and-control (C2) server. Finding that server is the most useful thing you can pull out of a sample: it is the indicator you block, share and hunt with. This guide walks through how analysts recover the C2 from an APK, from a quick static look to full detonation, the traps that send you to the wrong address, and how to automate the whole job.

What "the C2" means in Android malware

The C2 is the infrastructure the malware talks to: where it registers the infected phone, uploads stolen SMS, contacts and screenshots, and fetches its next command. In current Android families it usually takes one of these forms:

The harder the family tries to hide its C2, the less a static look will show you, which is why most real investigations end up running the sample.

Before you start: work safely

Treat every sample as live. Analyse it on an isolated device or emulator that holds no personal accounts, never on your own phone, and send its traffic out through a dedicated network exit so the attacker does not see your office address. Defang every indicator you write down (hxxp://203.0.113[.]7/gate.php) so nobody opens it by accident.

Step 1: Triage the APK statically

Start with what you can learn without running anything. Hash the file and check it against MalwareBazaar or your threat-intelligence platform. Open it with jadx or apktool and read the manifest: requests for Accessibility, SMS, notification access, overlay (SYSTEM_ALERT_WINDOW) and device admin together are the signature of a banking trojan. Note the package name, the main activity and any services that start on boot.

Step 2: Look for the configuration

Search the decompiled code and the assets/ and res/raw/ folders for URLs, IP addresses and ports. Many families keep their C2 list in a config file in assets, or as a Base64, XOR or AES-encrypted string decoded at startup. If you can find the decryption routine, you can usually decrypt the string offline; for known families, config extractors such as those built on Androguard save time. Be careful with what you find: an APK is full of SDK, analytics, advertising and documentation URLs that are not the C2.

Step 3: Unpack droppers and protected samples

If the code is tiny and mostly loads something else, you are looking at a dropper or a packed sample. The real payload is decrypted from assets and loaded with DexClassLoader or InMemoryDexClassLoader, or wrapped by a commercial protector such as Jiagu or Virbox. Run it and dump the loaded DEX from memory with Frida, or catch the second-stage APK when it is written to disk, then repeat steps 1 and 2 on the real payload. Some protectors check the date, the device or a licence and quit, so expect to adjust the environment.

Step 4: Detonate it on a device that looks real

Modern samples refuse to work on an obvious emulator: they read build properties, CPU and sensor data, look for emulator files and check for root. Use a device with a believable identity. Then get the sample past its activation gates: most banking trojans do nothing until you grant Accessibility, make them the default SMS app or accept device admin, and some wait for a push message or a specific date. Drive the interface the way a victim would, and give the sample time.

Step 5: Capture and read the traffic

Record all network traffic during the run. Plain HTTP shows the registration request immediately; for TLS, hook the sample's networking with Frida (SSL-pinning bypass or key logging) or route it through an intercepting proxy such as mitmproxy. Look for the first request after start-up, periodic beacons, POST requests carrying the device ID, and connections to bare IP addresses on odd ports. The address the sample itself contacts and gets commands from is your strongest C2 evidence.

Step 6: Resolve dead drops and DGAs

If the traffic goes to Telegram, a paste site, a social network or a Firebase database, the sample is probably fetching its real C2 from there. Follow the pointer: read the channel or document it requests, decode the value and confirm that the sample then connects to it. For a DGA, recover the algorithm and seed from the code and generate today's domains; the one that resolves is usually the live C2.

Step 7: Verify it really is the C2, then share it

Before you publish an indicator, check that it belongs to the attacker. Rule out:

Then check whether it is still alive: does the server answer the protocol the sample uses? A C2 that has been taken down is still worth sharing, labelled as dead. Share confirmed C2s in a structured form (STIX 2.1, CSV) and report them to community feeds such as ThreatFox and URLhaus.

Common pitfalls

Automating it with Privara Unmask

Doing all of this by hand takes hours per sample. Privara Unmask is an Android malware sandbox built to do exactly this job: you upload an APK and it runs the static triage, config decryption and unpacking, detonates the sample on an Android 17 device with a believable identity (retrying on Android 14 when a protector refuses 17), drives it past its activation gates, captures and decrypts the traffic, follows dead drops, and then checks every candidate before calling it a C2: an AI verifier rules out libraries, lookup services and vendor backends, and a liveness probe says whether the server still answers.

You get the C2 with its evidence, a PDF report and STIX 2.1, CSV and JSON exports. It is pay per result: $25 when a live C2 is found, $9 for a dead C2 and nothing when no C2 is found, with a free trial until your first C2. Use it from the web panel, the Unmask API or from Claude, where it is listed in the connector directory. The capability report shows results on public samples, and our research pages list recovered C2s by family.

Frequently asked questions

Can I find the C2 without running the malware?

Sometimes. If the address is hard-coded or in a config file you can decrypt, static analysis is enough. Packed samples, dead drops, DGAs and samples that only reveal the C2 after activation need dynamic analysis on a device.

Which tools do analysts use?

For static work jadx, apktool and Androguard; for dynamic work an instrumented device or emulator with Frida, a packet capture and an intercepting proxy such as mitmproxy; MobSF combines several of these. Automated sandboxes run the whole chain for you.

Why is the C2 I found not answering?

Android malware infrastructure is short-lived: servers are taken down, domains expire and operators move. A dead C2 is still a valid indicator for hunting and blocking, so record it and mark it as dead.

How do I know an address is not just a library or an ad server?

Check where it came from. An address the sample itself contacted and received commands from is strong evidence; an address that only appears in a library, a documentation link or a lookup service is not the C2.

Where should I report a C2 I recovered?

Share it with community feeds such as abuse.ch ThreatFox and URLhaus, and with your own threat-intelligence platform as STIX 2.1, with the sample hash and the evidence for the address.

Recover the C2 from your sample

Upload an APK to Privara Unmask and get the command-and-control server with its evidence. Free until your first C2.

Try Unmask free →