Ir al contenido

ANDROID FORENSIC AND STATIC ANALYSIS

Before touching a single key, we understand what we're doing. We're emulating the following adversary techniques:

0views

Before touching a single key, we understand what we are doing. We are emulating the following adversary techniques:

  • T1592.002 (Gather Victim Host Information: Software): We will analyze packages.xml to see what is installed.
  • T1409 (Stored Data Manipulation): We will study how applications store data to potentially modify it (such as the WhatsApp example).
  • T1555 (Credentials from Password Stores): We will search for passwords or PINs in unencrypted SQLite databases.

The packages.xml file is the Android “Registry”. For a Red Teamer, it is a treasure map that tells us which applications have excessive privileges that we could hijack.

Since we are on Windows 11, we can open the file with Chrome as requested, but an advanced analyst would also use the CLI (PowerShell) to filter quickly.

CLI Command (PowerShell) for quick searching:

# Busca línies que continguin el nom del paquet
Select-String -Path ".\packages.xml" -Pattern "com.roidapp.photogrid"

This is an image editing application.

  • Typical Permissions: It will request access to WRITE_EXTERNAL_STORAGE (to save photos) and INTERNET (for ads or uploading photos).
  • Security Interpretation:
    • READ_PHONE_STATE: Often used for advertising networks to obtain the IMEI (unique identifier). It is a privacy risk.
    • INTERNET: If the application has vulnerabilities, an attacker could use this permission to exfiltrate the edited photos.

B) com.google.android.calendar.uid.shared (ID 10055)

Sección titulada «B) com.google.android.calendar.uid.shared (ID 10055)»

Here we are talking about Shared User IDs.

  • Concept: Android allows different applications to run with the same UID (User ID) if they are signed with the same digital certificate.
  • What permissions should an application have here?
    • If an application shares a UID with the calendar, it automatically inherits the ability to read and write calendar events (READ_CALENDAR, WRITE_CALENDAR) without needing to explicitly ask the user again, as the system considers them “the same entity”.
    • Risk: If an attacker compromises a secondary application with this UID, they gain access to the victim's entire schedule (meetings, contacts, locations).

C) com.surpax.ledflashlight.panel (Flashlight)

Sección titulada «C) com.surpax.ledflashlight.panel (Linterna)»

This is a classic case of an “Over-privileged Application”.

  • Analysis: A flashlight only needs access to CAMERA (to activate the LED) and perhaps WAKE_LOCK (to prevent it from turning off).
  • Suspicious Permissions (Malware/Adware): If we find permissions such as ACCESS_FINE_LOCATION (GPS), READ_CONTACTS, or INTERNET, they are inappropriate.
  • Why? A flashlight does not need to know where you are or who your friends are. This indicates that the application is collecting data to sell it or is a camouflaged Trojan.

Here we enter data analysis (Data Mining). SQLite is the most widely used database engine on mobile devices. Many developers fail to encrypt these databases (SQLCipher), leaving data exposed if the file system is accessed.

SQLite is a C language library that implements a small, fast, self-contained, highly reliable, and fully functional SQL database engine.

  • Key Feature: It is Serverless. There is no server process (like MySQL); the database is a single file on the disk (.db or .sqlite). This makes it trivial to steal and open on another computer.

We open master.db. Below are the answers based on the standard structure of this challenge:

This table records sent/received files (evidence of exfiltration or lateral movement).

  • SQL query to count files:

    SELECT COUNT(*) FROM FileTransfers;

    image.png

  • SQL query for names and IDs:

    SELECT * FROM FileTransfers;

    image.png

    • Number of files: 2.
    • File Names: We look for the column containing the path or name.
      • Name 1: 1.
      • Name 2: 1406832981515.jpg.
    • Destination User ID: 10.

Here we look for persistence or privileged access.

  • SQL query to find the PIN:

    SELECT * FROM Profile;

    image.png

    • Pin: 790B122S
  • Identification of victims or collaborators.

    SELECT * FROM Users WHERE UserId=10;

    image.png

    • Username: harry q smith

The most critical part for intelligence.

  • Table used: TextMessages

  • Find the message “Round 3 reply”:

    SELECT * FROM TextMessages WHERE Content LIKE "%Round 3 reply%";

    image.png

    • Timestamp: 1406832884
    • GMT Date: 2014-07-31 18:54:44 (July 31, 2014)

We must analyze this data to better understand the context and the situation. We can use this information to make informed decisions and take appropriate actions.