Developer’s Guide to Removing Hackers from Mobile Devices (2025)

Developer's Guide to Removing Hackers from Mobile Devices (2025)

Every developer I know has, at some point, gotten the panicked message from a friend or family member: “I think my phone is hacked, can you look at it?” Because most non-technical guides online are either overly alarmist or dangerously oversimplified (“just factory reset it!”), I wanted to write the version I actually use — a methodical, developer-level process for confirming compromise, removing it, and locking the device down afterward, using real tools instead of guesswork.

Step 1: Confirm Compromise Before Acting

Before doing anything destructive, gather evidence. Overreacting (wiping a device that wasn’t actually compromised) destroys forensic value and doesn’t fix the real problem if the issue was, say, a compromised cloud account rather than the device itself.

Common Signs of a Compromised Mobile Device

SymptomPossible Cause
Rapid battery drainBackground spyware/malware, cryptomining
Unusual data usageData exfiltration to a remote command-and-control server
Unknown apps installedSideloaded malware or unauthorized app installation
Unexpected pop-ups/adsAdware, potentially bundled with a legitimate-looking app
Device running hot when idleBackground malicious processes
SMS/calls you didn’t makeSMS trojan or premium-rate fraud malware
Accounts showing unfamiliar login activityCredential compromise, possibly independent of device malware
Settings changed without your input (Accessibility Service, Device Admin enabled)Malware that escalated permissions post-install

Step 2: Triage With ADB (Android) or Configuration Profiles (iOS)

Android Triage

# Confirm device connection
adb devices

# List third-party (user-installed) apps
adb shell pm list packages -3

# Check for suspicious accessibility services enabled
adb shell settings get secure enabled_accessibility_services

# Check for device admin apps (used by malware to resist removal)
adb shell dumpsys device_policy | grep -i admin

# Review recent app installs by checking install timestamps
adb shell pm list packages -3 -f | while read -r line; do
  pkg=$(echo "$line" | sed 's/package://' | cut -d= -f2)
  adb shell dumpsys package "$pkg" | grep -E "firstInstallTime|lastUpdateTime"
done

iOS Triage

iOS’s sandboxing model makes traditional malware less common, but configuration profile abuse, malicious MDM enrollment, and jailbreak-based compromise do occur.

# Check for installed configuration profiles (Settings app, or via libimobiledevice on a connected Mac/PC)
ideviceprofile list

# Look for unexpected MDM enrollment
# Settings -> General -> VPN & Device Management

Any unfamiliar configuration profile or MDM enrollment the user didn’t set up themselves is a strong compromise indicator on iOS, since this is one of the primary mechanisms used for legitimate remote management — and abused for illegitimate surveillance (commonly in stalkerware cases).

Step 3: Identify and Remove the Malicious App(s)

flowchart TD
    A[Symptoms Reported] --> B[Connect via ADB / Inspect Profiles]
    B --> C[Enumerate Installed Apps & Permissions]
    C --> D{Suspicious App Identified?}
    D -->|Yes| E[Revoke Device Admin / Accessibility First]
    E --> F[Uninstall via adb uninstall or Settings]
    F --> G[Pull APK for Analysis if Needed]
    D -->|No, but symptoms persist| H[Check Account-Level Compromise]
    G --> I[Verify Removal & Monitor]
    H --> I

Malware often grants itself Device Admin or Accessibility Service privileges specifically to resist uninstallation attempts. Always revoke those privileges first, or the standard uninstall path may fail or be silently blocked.

# Revoke device admin rights before uninstalling
adb shell dpm remove-active-admin com.suspicious.app/.AdminReceiver

# Then uninstall
adb uninstall com.suspicious.app

# Verify it's gone
adb shell pm list packages -3 | grep suspicious

On the device UI itself (when ADB access isn’t available or convenient): Settings → Apps → [App Name] → Uninstall. If uninstall is greyed out, check Settings → Security → Device Admin Apps and deactivate the suspicious entry first.

Step 4: Address Account-Level Compromise (Often the Real Root Cause)

A huge number of “my phone is hacked” cases are actually account-level compromises — someone’s Google, Apple, or app-specific account credentials were phished or reused from a breached password database, and the “hacking” symptoms the user sees are really just unauthorized access to synced data, not device-level malware at all.

# Check Google account recent security activity
# (via browser) https://myaccount.google.com/security

# Review connected devices under the account
# https://myaccount.google.com/device-activity

Checklist for account hardening:

  1. Change the account password immediately, using a unique, strong password (ideally generated by a password manager).
  2. Enable multi-factor authentication (preferably an authenticator app or hardware security key over SMS-based MFA, since SMS is vulnerable to SIM-swapping).
  3. Review and revoke unfamiliar connected apps/devices under account security settings.
  4. Check for unauthorized email forwarding rules (a common persistence technique after account compromise) in Gmail/Outlook settings.
  5. Review recovery email/phone number settings, since attackers sometimes change these to maintain access even after a password reset.

Step 5: Deep Clean and Verification

For Android devices with confirmed or suspected deep compromise (e.g., a malicious app that gained system-level persistence, or symptoms that persist after standard removal):

# Full backup of user data before wiping (photos, documents — NOT apps, to avoid reinstalling malware)
adb pull /sdcard/DCIM ./backup_dcim
adb pull /sdcard/Documents ./backup_docs

# Factory reset via ADB (requires appropriate permissions/OEM unlock in some cases)
adb shell am broadcast -a android.intent.action.MASTER_CLEAR
# Alternatively via Settings -> System -> Reset Options -> Erase All Data (Factory Reset)

After a factory reset, do not restore from a full device backup if malware was suspected — full backups can reintroduce the malicious app along with your data. Instead, selectively restore photos, documents, and contacts, and manually reinstall apps from official stores only.

Step 6: Post-Incident Hardening

flowchart LR
    A[Device Cleaned] --> B[Enable Play Protect / App Store Verification]
    B --> C[Disable Sideloading / Unknown Sources]
    C --> D[Enable Biometric + Strong PIN Lock]
    D --> E[Enable Find My Device / Find My iPhone]
    E --> F[Apply OS and App Updates]
    F --> G[Enable MFA on All Accounts]
    G --> H[Periodic ADB/Permission Audits]

Special Case: Stalkerware and Targeted Surveillance

If the compromise appears targeted — a partner, family member, or employer with unusual insight into the victim’s activity, location, or messages — treat this differently from generic malware. Stalkerware apps are specifically designed to hide from the app drawer and standard uninstall paths, often disguising themselves as system utilities.

Handling Enterprise and BYOD Scenarios

If the compromised device is enrolled in a corporate Mobile Device Management (MDM) or Enterprise Mobility Management (EMM) platform, the process shifts somewhat. IT and security teams typically have visibility and remote action capability that individual users don’t, and coordinating through that channel first avoids duplicated or conflicting remediation steps.

For personally owned devices without any enterprise management, the responsibility falls entirely on the individual (or the developer helping them), which is exactly the scenario this guide is built around — but it’s worth recognizing when a case has moved beyond a single-device problem into something that needs organizational visibility.

Common Mistakes

Preventing Repeat Compromise Long-Term

Once a device is clean and accounts are secured, the final piece is building habits that meaningfully reduce the chance of a repeat incident, rather than just reacting the next time symptoms appear.

FAQs

Is a factory reset always necessary to remove malware? Not always — many Android malware infections can be fully removed by uninstalling the specific malicious app (after revoking any device admin/accessibility privileges it granted itself). Factory reset is a stronger, last-resort option for deeper or uncertain compromises.

Can iPhones get malware the same way Android phones do? Less commonly, due to Apple’s app sandboxing and App Store review process, but iOS devices can still be compromised via malicious configuration profiles, phishing leading to account compromise, or (rarely) sophisticated zero-click exploits, particularly against high-risk individuals.

How do I know if it’s a device problem or an account problem? Check account security activity pages (Google/Apple) for unfamiliar logins or devices first — if you see unauthorized access there but no suspicious apps on the device itself, it’s likely an account-level compromise, not device malware.

Should I involve law enforcement? For cases involving financial fraud, stalkerware from an abusive partner, or targeted surveillance, yes — document evidence first where safely possible, and report to appropriate authorities or platforms like the FBI’s IC3 (for the US) or your local equivalent.

Will antivirus apps catch everything? No single tool guarantees complete detection. Built-in protections (Play Protect, App Store review) plus careful permission auditing (as covered in this guide) provide much stronger practical protection than relying on a single third-party antivirus app alone.

Summary and Recommendations

Removing a hacker from a mobile device is rarely just about deleting one bad app — it’s a process: confirm compromise with real evidence, identify and remove malicious software (revoking its self-granted privileges first), address the very common possibility of account-level compromise, clean and selectively restore data, and harden the device against reinfection. Treat stalkerware cases with extra care given the potential safety implications. Done properly, this process gives both you and the device owner real confidence the problem is actually solved, not just hidden.

Further Reading and References

Exit mobile version