Documentation

Go to Portal Website

Task Hijacking Prevention

PlanPlatformsMASVS
TeamAndroidMASVS-PLATFORM-1

Overview

TaskHijackingPrevention mitigates StrandHogg 1.0 and 2.0 task-affinity hijacking attacks by hardening the application's task configuration at build time. It clears android:taskAffinity attributes and disables android:allowTaskReparenting on all activities, preventing malicious applications from inserting themselves into the protected app's task stack or hijacking its identity in the recent apps switcher.

Optionally, the launcher activity can be configured with launchMode="singleTask" to further restrict task behavior, though this may impact certain user workflows.

How It Works

Android's task system organizes activities into logical stacks. By default, activities from different applications can share the same task if they have matching taskAffinity values. Malicious apps can exploit this behavior to:

  1. StrandHogg 1.0: Set a matching taskAffinity to inject a phishing overlay into the victim app's task, tricking users into entering credentials into the attacker's UI.
  2. StrandHogg 2.0: Use reflection and accessibility services to dynamically hijack task identities without requiring matching package names.

TaskHijackingPrevention applies the following build-time manifest modifications:

Default Behavior

  1. Clear Task Affinity: Sets android:taskAffinity="" on the <application> element and all <activity> elements, ensuring activities do not share tasks with external apps.
  2. Disable Task Reparenting: Sets android:allowTaskReparenting="false" on the <application> element and all non-launcher activities, preventing the system from moving activities between tasks.

Optional Enhancements

Allowlist

Activities specified in the allowlist configuration array are excluded from modifications, preserving their original task attributes for compatibility with special-purpose activities.

Leanback Launcher

By default (includeLeanbackLauncher=true), Android TV leanback launcher activities are treated identically to standard launchers and receive the same protections. This can be disabled by setting includeLeanbackLauncher=false.

Threats Mitigated

How to Enable the Control

Navigate to Preventative Controls from the AppTego portal, and expand the App Component Security section. Under this section you will find the Task Hijacking Prevention control. Click Enable to enable it for the next build or for it to be applied with a live push (if enabled).

API Configuration Example

{
  "TaskHijackingPrevention": {
    "protection": true
  }
}
FieldPurpose
protectionEnables task hijacking prevention for protected apps.

Configuration

The control accepts the following optional parameters in the tenant configuration JSON:

{
  "TaskHijackingPrevention": {
    "protection": true,
    "taskAffinityOverride": "",
    "allowlist": ["com.example.app.SpecialActivity"],
    "forceSingleTaskLauncher": false,
    "includeLeanbackLauncher": true
  }
}

Caveats

Support Matrix

PlatformMinimum VersionNotes
AndroidAPI 26 (8.0)Supported. Applied via manifest merge at build time.
iOSNot supported. Task-affinity attacks are Android-specific.

See Also