repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
android-vpn-bypass.mdMarkdown68 lines4.7 KiBsource raw download

title: "Android VPN Bypass" section: "Mobile" sectionSlug: "mobile-pentesting" sourcePath: "src/mobile-pentesting/android-app-pentesting/android-vpn-bypass.md" sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/mobile-pentesting/android-app-pentesting/android-vpn-bypass.md" sha: "188de82beb54e70956b2952367a0af91d26758b8" isIndex: false modified: true license: "CC-BY-NC-4.0"#

Android VPN Bypass#

Hidden Binder APIs, Confused Deputies and VPN Lockdown Bypasses#

A hidden Java API can remain reachable when its underlying Binder transaction is exposed to apps and the service omits a caller-identity or permission check. A useful triage pattern is: untrusted app → Binder registration of attacker-controlled state → privileged system component later replays that state.[1][3]

Typical red flags:

The following pattern was reported in the Android 16 QUIC graceful-close implementation. Treat transaction numbers and method layouts as build-specific; confirm them against the target framework rather than copying a constant from another release.[1]

  1. The app enumerates visible networks with ConnectivityManager.getAllNetworks() and getLinkProperties().
  2. Instead of Network.bindSocket() (which enforces VPN lockdown), it creates new DatagramSocket(new InetSocketAddress(<physical-ip>, 0)). That path reaches the kernel bind() syscall, which only checks whether the local IP exists on an interface.
  3. A later UDP connect() does not transmit traffic but helps associate the socket with the physical network netId/SO_MARK.
  4. The app passes the connected socket plus attacker-controlled bytes to a Binder method.
  5. When the socket dies, a privileged component recreates the flow and sends the bytes as UID 1000, bypassing per-app VPN policy because the policy is enforced against the original app UID, not the privileged deputy.

Minimal direct-transaction pattern from an app when the SDK method is hidden but the Binder entry point is reachable:[1][2]

IBinder svc = (IBinder) Class.forName("android.os.ServiceManager")
    .getMethod("getService", String.class).invoke(null, "connectivity");
Parcel data = Parcel.obtain();
try {
    data.writeInterfaceToken("android.net.IConnectivityManager");
    data.writeTypedObject(pfd, 0);
    data.writeByteArray(payload);
    svc.transact(TXN_REGISTER, data, null, IBinder.FLAG_ONEWAY);
} finally {
    data.recycle();
}

Practical review workflow:

Defensive clues:

References#