Skip to content

Lab 01 — Your first complete triage

Difficulty: Beginner Time: 90–150 minutes Prerequisites: README §1–§3, §8

SAFETY — read before you start. The target of this lab is examples/inert-sample/, which you will build yourself from sources that ship in this repository. It has no payload, no C2 client, no exfiltration, no evasion and no working persistence. Every capability path in it terminates in a call to Log.i(). All indicators it carries are RFC 2606 .invalid names that cannot resolve.

This lab installs nothing. The build script has no --install flag. You will not need a device, an emulator, or adb at any point.

Do not substitute a real malware sample for this exercise. If you eventually want to, read README §7.1 first and set up the isolation properly.


Objective

By the end of this lab you will have:

  1. Built the inert sample from source, out of tree, with no Gradle.
  2. Run a complete static triage against it.
  3. Read every line of the output and been able to say what each one means.
  4. Found the two places where the tool's output is weaker than it looks.
  5. Verified one of the tool's claims by hand, without the tool.

That fourth objective is the real one. A triage tool you cannot argue with is a triage tool you cannot use.


Background: the six questions

Section 3 of the README lays out a capability model. apk-triage.py implements it as six sections, in a deliberate order:

# Section The question
1 Identity What is this file?
2 Provenance Who signed it, and what is that worth?
3 Capability What could it do if every request were granted?
4 Persistence How does it survive a reboot, a swipe, a kill?
5 Native How much of it is not Java, and what runs earliest?
6 Loading Does the code you can see equal the code that runs?

There is deliberately no seventh section called "verdict". Keep that in mind as you read the output; the tool will not tell you what to think, and the lab is largely about noticing where you were expecting it to.


Setup

Step 0 — check your toolchain

# host
python3 --version              # 3.8 or newer
java -version                  # any JDK with javac and keytool
echo "$ANDROID_HOME"           # must point at an Android SDK
ls "$ANDROID_HOME"/build-tools # need aapt2, d8, zipalign, apksigner
ls "$ANDROID_HOME"/platforms   # need one android.jar

If ANDROID_HOME is empty, set it. On Windows with Git Bash the usual location is $LOCALAPPDATA/Android/Sdk; on macOS ~/Library/Android/sdk; on Linux ~/Android/Sdk.

An NDK is optional. Without one the build skips the native library and the triage tool reports "no native libraries", which is a legitimate result and which you should see at least once.

Step 1 — read the ground truth before you build

This is the step everybody skips and it is the most valuable one in the lab.

# host
cd 69-MalwareAnalysis/examples/inert-sample
python3 -B make-config-assets.py --show

You should see two JSON documents printed in full, plus the two keys. Read them. Note the campaign tag, the hostnames, the target package names and the poll intervals.

Mental Model You now know the answer before you run the tool. That is the only way to calibrate a tool you did not write. A triage tool you have never watched produce a known answer is a tool you cannot rely on when the answer is unknown.

Now read the manifest, once, with your own eyes:

# host
less AndroidManifest.xml

Write down, on paper, three things you expect the triage tool to flag. You will check them at the end.

Step 2 — build

# host
OUTDIR=/tmp/ch69 ./build.sh

Expected output, abridged (the exact SDK versions will differ):

SDK         .../Android/Sdk
build-tools 35.0.1
android.jar android-35/android.jar
outdir      /tmp/ch69

=== 1. generating config assets ===
wrote /tmp/ch69/work/assets/cfg-xor.bin  441 bytes  (plaintext was 441 bytes)
wrote /tmp/ch69/work/assets/cfg-aes.bin  928 bytes  (plaintext was 902 bytes)

=== 2. compiling resources ===
=== 3. linking ===
=== 4. compiling Java ===
dex: 11476 bytes
=== 5. native library (optional) ===
built lib/arm64-v8a/libinertstub.so with aarch64-linux-android21-clang
=== 6. assembling ===
entries: 9
generated a THROWAWAY signing key at /tmp/ch69/throwaway.ks

built /tmp/ch69/inert-sample.apk
      21308 bytes

Nothing was written into the repository.

Two things to notice immediately.

First, cfg-xor.bin is 441 bytes and its plaintext was 441 bytes. XOR does not change length. cfg-aes.bin is 928 against a 902-byte plaintext — 16 bytes of IV plus PKCS#7 padding to a 16-byte boundary. That arithmetic is a free sanity check on any blob you meet: if ciphertext length equals plaintext length, it is a stream cipher or XOR; if it is a multiple of 16 with a small excess, it is a block cipher.

Second, "nothing was written into the repository". Verify it:

# host — from the repository root
git status --short 2>/dev/null || find 69-MalwareAnalysis -name '*.apk' -o -name '*.dex' -o -name '*.so'

Nothing should appear. If something did, the build script has a bug and you should say so.


Part A — Identity

# host
cd ../..                       # back to 69-MalwareAnalysis
python3 -B scripts/apk-triage.py /tmp/ch69/inert-sample.apk --only identity

Measured output from the machine this chapter was written on:

1. IDENTITY -- what is this file
  file            inert-sample.apk
  size            20.8 KiB (21308 bytes)
  md5             c44732c35a1f35270208a52c85b25777
  sha1            36e4ec04e86768075ebe17cd09653fb8b4c43ae1
  sha256          bd123b446b378f6400177fe33325f853a2882722778c90ce75a37b0c7ade3c4c
  zip entries     12
  package         com.pentest.ch69.inert
  version         code=1 name=0.1-inert
  sdk             min=21 target=33
  application     allowBackup=false, extractNativeLibs=true,
                  hasFragileUserData=false, label=Inert Sample CH69
  dex             classes.dex  11.2 KiB  v035  10 classes, 88 methods, 185 strings
                  sha256 9ef03c6f536d760aac962f30f55deacce7205fd11f9e992b75c23a83b72bfbc3
  code fraction   53.9% of the file is DEX

A.1 — Your hashes will not match. Work out why.

Run it and compare. The sha256 of the APK will differ from the one above.

Question. Why? And which hash in that block should match?

Answer `build.sh` generates a fresh throwaway signing key on every new `$OUTDIR`. A different key produces a different signing block, which changes every whole-file hash — `md5`, `sha1`, `sha256`. The `classes.dex` SHA-256 **should** match, if you are on the same `d8` version and the same JDK, because the code is identical and the DEX is not touched by signing. **This is the whole lesson of section A.** When you want to claim that two samples are the same code, compare the DEX, not the container. Chapter 42 measured the extreme version: three APKs byte-identical in size at 12,757 bytes with DEX sizes of 7,384 / 2,920 / 7,180, because `apksigner` pads the signing block to a 4 KiB boundary. `ls -l *.apk` cannot tell you whether shrinking worked, and it cannot tell you whether two samples share code.

A.2 — The code fraction

Question. The tool reports code fraction 53.9%. What would a low number mean, and why does the tool not raise a signal here?

Answer A low code fraction — a small DEX inside a large file — is the classic packer shape. Chapter 40 §3.7 records a stub as typically 20–150 KB against a real app's several megabytes. If the code you can decompile is 90 KB and the file is 40 MB, the real code is elsewhere in the container. The tool raises that signal only when the DEX is under 200 KB **and** the file is over 2 MB. Here the file is 21 KB, so a small DEX is expected and the check correctly stays quiet. **The general point:** a threshold with only one side is a threshold that produces noise. "Small DEX" alone would fire on every small app.

A.3 — Verify one field by hand

The tool says the DEX has 10 classes and 185 strings. Check it without the tool:

# host
mkdir -p /tmp/ch69/x && cd /tmp/ch69/x
python3 -B -c "
import zipfile
zipfile.ZipFile('/tmp/ch69/inert-sample.apk').extract('classes.dex')
"
python3 -B -c "
import struct
d = open('classes.dex','rb').read()
print('magic      ', d[:8])
print('checksum   ', hex(struct.unpack_from('<I', d, 8)[0]))
print('file_size  ', struct.unpack_from('<I', d, 0x20)[0], 'actual', len(d))
print('header_size', struct.unpack_from('<I', d, 0x24)[0])
print('endian_tag ', hex(struct.unpack_from('<I', d, 0x28)[0]))
print('string_ids ', struct.unpack_from('<I', d, 0x38)[0])
print('type_ids   ', struct.unpack_from('<I', d, 0x40)[0])
print('method_ids ', struct.unpack_from('<I', d, 0x58)[0])
print('class_defs ', struct.unpack_from('<I', d, 0x60)[0])
"

The four DEX header invariants worth memorising, because chapter 40's memory-carving script validates candidates against exactly these:

Field Expected
header_size 0x70
endian_tag 0x12345678
file_size equal to the actual length
magic dex\n0??\0

Success criterion: your hand-computed string_ids and class_defs match what the tool printed.


Part B — Provenance

# host
python3 -B scripts/apk-triage.py /tmp/ch69/inert-sample.apk --only provenance
2. PROVENANCE -- who signed it, and what that is worth
  scheme          APK Signature Scheme v2      0x7109871a
  scheme          APK Signature Scheme v3      0xf05368c0
  scheme          padding                      0x42726577
  scheme          JAR signing (v1)             v1
------------------------------------------------------------------------------
  certificate     APK Signature Scheme v3
    subject       C=XX, O=Android Security Handbook, CN=CH69 Inert Sample
    issuer        C=XX, O=Android Security Handbook, CN=CH69 Inert Sample
    validity      260812174545Z .. 360809174545Z
    serial        37ff951c
    sha256        e434de8c3032b3425dfa993ea371947e9488dc12cf0be57b9d51a5a93a927b28
    sha1          3f6a9ce261a5cbc8e5760ac85c8e850e2e043f35
  note            certificate e434de8c3032b342... is self-signed --
                  which is NORMAL for Android and is not a finding

B.1 — Cross-check with the authoritative tool

The triage tool did not verify anything. It parsed the signing block and read the certificates out of it. Verify properly:

# host
"$ANDROID_HOME"/build-tools/*/apksigner verify -v --print-certs /tmp/ch69/inert-sample.apk

Question. The triage tool and apksigner should agree on the certificate SHA-256. What does apksigner tell you that the triage tool cannot?

Answer `apksigner` tells you whether the signature **verifies** — that every digest in the signing block matches the content it covers. The triage tool checks no digest at all, and says so in its header and in its output. This gap is not academic. A file can carry a perfectly readable certificate and a broken signature, and Janus-style attacks live in exactly that gap: two different payloads, one signature block. **Always run both, and quote `apksigner`'s output separately in a report.**

B.2 — What the subject line is worth

The certificate says O=Android Security Handbook, CN=CH69 Inert Sample.

Question. Write one sentence you could put in a report about that, and one sentence you could not.

Answer **Could:** "The signing certificate's subject is `C=XX, O=Android Security Handbook, CN=CH69 Inert Sample`; the certificate is self-signed with SHA-256 `e434de…`." **Could not:** "The sample was produced by the Android Security Handbook organisation." The subject fields are free text typed into `keytool` by whoever generated the key. They are worth **recording** — because if the same odd string appears on another sample it is a weak corroborating link — and worth **nothing** as identity evidence. The same applies to the validity dates: they record what was typed, not when anything was built.

B.3 — The field that is not in the file at all

Question. Where did this APK come from? Can the triage tool tell you?

Answer No, and it says so explicitly in its output. **Installer attribution is not a property of the APK.** It is recorded by `PackageInstallerService` on the device at install time. On a device you would ask:
adb shell dumpsys package <pkg> \
  | grep -E 'installerPackageName|installInitiator|originating|packageSource'
And you would weight the three fields unequally: | Field | Trust | Why | |---|---|---| | `installerPackageName` | Low | `adb install -i com.android.vending` sets it to anything | | `installInitiator` | Higher | Recorded by the system from the UID that opened the session | | `originating` | Contextual | Where the installer said it came from | Chapter 09 §5.5 measured the first row. It is why an app checking `getInstallerPackageName()` for anti-sideloading is defeated by one flag.

Part C — Capability

# host
python3 -B scripts/apk-triage.py /tmp/ch69/inert-sample.apk --only capability

This is the longest section of the output. Read all of it before answering.

C.1 — Weighting

The tool prints a weight per permission: [***], [** ], [* ].

Question. RECEIVE_BOOT_COMPLETED is weighted [** ] and INTERNET is weighted [* ], while READ_SMS is [***]. Argue that this weighting is correct, then argue that it is wrong.

Answer **Correct:** the weight measures how rarely legitimate the request is *outside a narrow app class*. `INTERNET` is held by almost every app ever written and carries no information at all. `RECEIVE_BOOT_COMPLETED` is very common but at least implies a background function. `READ_SMS` is restricted by Play policy, requires a runtime grant, and has a small set of legitimate uses. **Wrong:** weighting individual permissions at all is the wrong model, because the signal is the *combination*. A dual-SIM management utility legitimately holds `READ_SMS`, `RECEIVE_SMS` and `READ_PHONE_STATE` and would score three `[***]` rows. Meanwhile a genuinely hostile app might hold only `BIND_ACCESSIBILITY_SERVICE` and `INTERNET`. **The resolution, and the reason the tool prints reasoning next to every row:** the weight is a queue order, not a severity. Chapter 52 makes the same point about its confidence model — *confidence orders your queue; it does not rank importance.*

C.2 — The descriptors, and a real gap

Look carefully at this part of the output:

  CAPABILITY DESCRIPTORS found in res/xml -- this is where
  the real answer lives, not in the class name:
    res/xml/accessibility_config.xml       <accessibility-service>
        accessibilityEventTypes          0xffffffff
        accessibilityFeedbackType        0x10
        accessibilityFlags               0x52
        canRetrieveWindowContent         true
        notificationTimeout              100
        packageNames                     ABSENT -- every package
    res/xml-v22/accessibility_config.xml   <accessibility-service>
        accessibilityEventTypes          0xffffffff
        ...
        canPerformGestures               true
        canRetrieveWindowContent         true
        packageNames                     ABSENT -- every package
    res/xml/device_admin.xml               <device-admin>
        uses-policies                    (empty)

Question. The source directory contains one accessibility descriptor. The APK contains two. Why, and what would go wrong if a tool read only res/xml/?

Answer `aapt2` split the resource by API qualifier, because `android:canPerformGestures` was introduced at API 22. The base `res/xml/` variant is the API 21 fallback and **does not carry that attribute**; the `res/xml-v22/` variant does. A tool reading only `res/xml/` would report a service that can read window content but **not** synthesise input — which under-reports the capability, because the variant a modern device actually loads is the `-v22` one. The same applies to `-v21`, `-v24`, `-v31` and every other qualifier. Any manifest or resource reading that does not enumerate every variant is answering a question about an API level it did not choose. This was not planned when the sample was written. It appeared the first time `apk-triage.py` walked `res/xml*`. That is why the tool prints each variant separately instead of merging them: **a discrepancy you can see is worth more than a summary you have to trust.**

C.3 — The false positive the tool does not make

The accessibility service is declared android:exported="true".

Question. Generic manifest scanners flag exported services. Why is this one not a finding?

Answer Because it *must* be exported, so that `system_server` can bind it — and because the `android:permission` attribute restricts binding to holders of `BIND_ACCESSIBILITY_SERVICE`, which is a **signature-level permission held only by the system**. The declaration is correct. Flagging it produces a false positive that generic scanners emit constantly and that experienced reviewers reject on sight. This is the general shape of a false positive: *a control read without the control that governs it.* `exported="true"` means nothing until you have read `android:permission`.

C.4 — The device-admin trap

The device-admin descriptor has an empty <uses-policies> element and the tool weights it [* ].

Question. Does that mean it is harmless?

Answer No, and this is the most counter-intuitive fact in the chapter. **Uninstall resistance comes from being an ACTIVE admin at all, not from any policy it requested.** The package manager refuses to uninstall a package with an active `DeviceAdminReceiver`, regardless of what the policy list contains. So an empty policy list is not a weaker declaration for *that* purpose. What the policy list tells you is what *else* the admin could do — `wipe-data`, `reset-password`, `force-lock` — and those are the rows that would push the weight up. "Requests no policies, therefore harmless" is a sentence a reviewer will catch.

Part D — Persistence

# host
python3 -B scripts/apk-triage.py /tmp/ch69/inert-sample.apk --only persistence
4. PERSISTENCE -- how it survives a reboot, a swipe, a kill
  [** ] ContentProvider    .BootstrapProvider
      authorities=com.pentest.ch69.inert.bootstrap initOrder=900 exported=false
  [** ] boot receiver      .BootReceiver
      BOOT_COMPLETED, MY_PACKAGE_REPLACED, QUICKBOOT_POWERON
  [** ] foreground service .SentinelService
      type=dataSync stopWithTask=false
  [** ] multi-process      :guard
      1 extra process name(s)
  [*  ] foreground service .GuardService

D.1 — Why the provider is first

Question. The tool lists the provider before the boot receiver. Why is that ordering right?

Answer Because the provider is the earliest thing that runs, and because it runs on *every* process start, not only after a reboot. `ContentProvider.onCreate()` is called from `ActivityThread.installContentProviders()`, which `handleBindApplication()` invokes **before** `Instrumentation.callApplicationOnCreate()`. Chapter 09 measured the gap on a device: provider at `11:20:31.118`, `Application.onCreate` at `11:20:31.141` — 23 ms, provider first. The consequence: any "initialise security first" logic in `Application.onCreate()` has already been preceded. And the supply-chain consequence, which is why chapter 09 calls this the single most useful piece of knowledge in it for malware analysis: a provider declared in a *dependency's* manifest is merged into the host app's manifest and runs inside the host app's process, with the host's UID and permissions, before the host's first line of code.

D.2 — Read the foreground service type

The tool prints type=dataSync, not type=0x1.

Question. Why does that matter, and why is dataSync specifically worth noticing?

Answer `android:foregroundServiceType` is stored as an integer bitmask. A tool that prints the raw value has told you nothing. `dataSync` matters because since **API 34 the declared type is enforced** — the platform throws if a service starts with a type it did not declare, and the app must hold the matching permission. That makes the declared type **a claim the sample is making about itself**, and comparing the claim with what the code does is a cheap, high-value check. `dataSync`, `specialUse` and `shortService` are the types most often claimed dishonestly, because they are the vaguest.

D.3 — The multi-process signal, and the sentence not to write

Question. The sample declares android:process=":guard" on one service. Write the finding sentence, correctly.

Answer **Correct:** "One service runs in a second process (`:guard`). A second process is terminated independently of the first, so a single process kill does not stop the application. Both services additionally declare `stopWithTask="false"`, so neither is stopped when the user swipes the task away." **Wrong:** "The sample spawns a second process to escalate privileges." A second process has the **same UID, the same SELinux label, the same data directory and the same granted permissions.** It buys survivability, never privilege. This is the single most common error in junior malware write-ups and a reviewer will catch it.

D.4 — What the manifest cannot tell you

Question. Name three persistence mechanisms that would be completely invisible to this section of the report.

Answer 1. **JobScheduler** — a periodic job that the *system* restarts, including after a reboot. It survives `am force-stop`, which a process pair does not. 2. **WorkManager** (`androidx.work`) — the same, wrapped. 3. **AlarmManager**, particularly `setExactAndAllowWhileIdle`. All three are **code, not manifest**. A manifest with no persistence hooks is not an app with no persistence. The tool says this in its own output — "That does NOT mean there is none" — and the string-pool section is where you go looking. On a device:
adb shell dumpsys jobscheduler | grep -A 20 <pkg>
adb shell dumpsys alarm | grep -A 10 <pkg>
A fourth, and it is the one people forget: **another package.** A dropper's stage two persists independently of stage one.

Part E — Native and loading

# host
python3 -B scripts/apk-triage.py /tmp/ch69/inert-sample.apk --only native,loading
5. NATIVE
  lib/arm64-v8a/libinertstub.so            6.8 KiB
      ELF64 aarch64  entropy 3.80  has .symtab
      DT_INIT=False DT_INIT_ARRAY=True DT_NEEDED=3
      JNI_OnLoad=True  Java_* symbols=2  RegisterNatives=True

6. LOADING
  assets/cfg-aes.bin       928 B  H=7.75  ratio=1.00
  assets/cfg-xor.bin       441 B  H=6.11  ratio=0.80

E.1 — The instrumentation decision

Question. DT_INIT_ARRAY=True. What does that change about how you would instrument this library, and why?

Answer You must **spawn-gate**, not attach. The load order is:
dlopen("lib.so")
  -> relocations
  -> DT_INIT, then every DT_INIT_ARRAY entry     <-- code runs HERE
  -> dlopen RETURNS
  -> ART calls dlsym("JNI_OnLoad") and invokes it
Everything in the third line has finished before ART knows the library exists. Attaching to a running process misses it. Hooking `JNI_OnLoad` misses it. You have to own the process before the linker runs:
frida -U -f <pkg> --no-pause -l hook-dlopen.js
or hook `android_dlopen_ext`, which is called before the constructors. Chapter 15 §3.12 owns this, and its list of what lives in that window is: unpacking, `ptrace(PTRACE_TRACEME)`, `TracerPid` reads, `/proc/self/maps` scanning for `frida`, integrity checks and licence checks.

E.2 — The blind spot

Question. RegisterNatives=True with only 2 Java_* symbols. What is missing from the file, and how would you recover it?

Answer The **Java-to-native mapping for every dynamically registered method.** A `native` Java method can be bound two ways. Statically, the C function is named `Java___` and appears in the ELF dynamic symbol table, so a static read recovers the mapping. Dynamically, `JNI_OnLoad` calls `RegisterNatives()` with a table of `{name, signature, function pointer}` — and the C function can be `static`, therefore absent from every symbol table. Nothing on disk records which Java method it serves. Two recoveries: 1. **Runtime** — hook `art::JNI::RegisterNatives`. [`52-StaticAnalysis/scripts/blindspot-recorder.js`](../../52-StaticAnalysis/scripts/blindspot-recorder.js) does exactly this. 2. **Manual** — read the `JNINativeMethod` table out of `JNI_OnLoad` in a disassembler. Chapter 57's job. Verify the gap yourself:
cd /tmp/ch69/x
python3 -B -c "
import zipfile
zipfile.ZipFile('/tmp/ch69/inert-sample.apk').extract('lib/arm64-v8a/libinertstub.so')
"
python3 ../../15-Native-Code/scripts/elf-inspect.py lib/arm64-v8a/libinertstub.so --dynsyms | grep -i java
You will see `Java_com_pentest_ch69_inert_NativeProbe_staticallyNamed` and **not** `dynamicallyRegistered`, even though [`NativeProbe.java`](../examples/inert-sample/NativeProbe.java) declares both.

E.3 — Entropy and its limits

cfg-aes.bin has entropy 7.75 and a compression ratio of 1.00. cfg-xor.bin has entropy 6.11 and a ratio of 0.80.

Question. Both are encrypted. Why is one much more obvious than the other, and what would you conclude about a third file with entropy 7.9 and ratio 1.00?

Answer AES output is indistinguishable from random, so it maxes out both measures — entropy near 8 and no compressibility. XOR output has the *same byte-frequency structure as the plaintext*, permuted. JSON is highly redundant, so XORed JSON is still compressible: ratio 0.80. That 0.80 is itself a signal — **an encrypted blob that compresses is not well-encrypted.** About the hypothetical third file: entropy 7.9 with ratio 1.00 says "incompressible", which is consistent with encryption, with **compression**, and with **media**. A PNG, a JPEG and a nested zip all look exactly like that. Chapter 52 states the rule and it is worth memorising: **high entropy is not evidence of encryption. The signal is entropy plus context** — the compression ratio, a magic number that does not match the extension, and a size in a plausible range.

Part F — Signals and the missing verdict

# host — the whole report
python3 -B scripts/apk-triage.py /tmp/ch69/inert-sample.apk | tail -60

Fifteen signals are printed, ranked.

F.1 — Compare with your paper note

Get out the three things you wrote down in Step 1 before building.

Question. Did the tool find all three? Did it find anything you missed? Did it flag something you would rate lower than it did?

There is no single right answer here. The exercise is to notice that you and the tool disagree somewhere, which is the normal and healthy state.

F.2 — Fifteen signals, how many findings?

Question. The tool prints fifteen signals for a sample that is provably harmless. What does that tell you about the relationship between signals and findings?

Answer That there is none, mechanically. Chapter 52's arithmetic, restated: a **hit** is one match on one line; a **lead** is a distinct construct with its sites attached; a **finding** is a lead that survived validation — it is really there, it is reachable, you know who can reach it and what reaching it gets them. Measured ratios elsewhere in this repository: 16,836 hits → 168 leads, then 15 of 17 high-confidence leads rejected by hand (88%). 132 high-confidence storage hits, all 132 false positives. 12 of 14 apps with a pinning surface, only 4 actually pinning. **A tool that emits a verdict is a tool that will be believed.** That is why `apk-triage.py` has no verdict line, deliberately, and says so in its banner.

F.3 — Write the escalation paragraph

Using only what the tool printed, write a paragraph of no more than 120 words justifying escalation to full analysis for a sample with this profile.

Model answer > The sample declares an accessibility service whose descriptor requests every > event type from every package, with window-content retrieval and gesture > dispatch and no `packageNames` filter; combined with a declared notification > listener and `READ_SMS`/`RECEIVE_SMS`, this constitutes a second-factor > interception and device-control capability. `REQUEST_INSTALL_PACKAGES` in a > 21 KB application is the dropper shape. Persistence is deliberate rather than > incidental: a `ContentProvider` executing before `Application.onCreate()`, a > boot receiver also listening for `MY_PACKAGE_REPLACED`, and two services in > two processes both declaring `stopWithTask="false"`. Two encrypted > configuration assets are present. **Recommend full analysis.** No claim is > made here about whether any capability is exercised. Note the last sentence. It is the difference between a triage note and a guess.

Success criteria

You have completed this lab when you can:

  • Build the sample out of tree, with nothing written into the repository.
  • Explain why the APK hash differs between builds and the DEX hash does not.
  • Verify the DEX header fields by hand and match the tool's numbers.
  • State what a certificate SHA-256 does and does not establish, in one sentence each.
  • Explain why installer attribution is absent from the file.
  • Explain why res/xml-v22/ exists and what a tool that ignores it misses.
  • Explain why exported="true" on the accessibility service is not a finding.
  • Explain where device-admin uninstall resistance actually comes from.
  • Write the multi-process finding sentence without the word "privilege".
  • Name three persistence mechanisms invisible to a manifest reading.
  • Explain why DT_INIT_ARRAY changes your instrumentation technique.
  • Demonstrate the RegisterNatives blind spot with elf-inspect.py.
  • Explain why high entropy is not evidence of encryption.
  • Write a 120-word escalation paragraph that makes no unsupported claim.

Hints

The build fails with "failed to load XML file" on Git Bash The SDK tools are native Windows binaries and do not understand `/c/Users/...` paths. `build.sh` handles this with a `cygpath -w` wrapper called `p()`. If you are invoking `aapt2` by hand, wrap every path the same way. Also: XML comments must not contain `--`.
"error: set ANDROID_HOME to your Android SDK"
export ANDROID_HOME="$LOCALAPPDATA/Android/Sdk"    # Windows, Git Bash
export ANDROID_HOME="$HOME/Library/Android/sdk"     # macOS
export ANDROID_HOME="$HOME/Android/Sdk"             # Linux
The native library was skipped No NDK was found. That is fine — the rest of the lab works, and section 5 of the report will say "no native libraries", which is a legitimate result. To get the library, install an NDK through the SDK manager or set `ANDROID_NDK_HOME`.
`apksigner` is not on PATH
"$ANDROID_HOME"/build-tools/*/apksigner verify -v --print-certs /tmp/ch69/inert-sample.apk
On Windows it is `apksigner.bat`.

Next