Skip to main content
Be Bitwise

IPC & Component Vulnerabilities

Mobile Application Vulnerability Classes · Mobile Application Security track

13 min read

In this module

The Component Model

Mobile OSes don't ship monolithic executables. They ship apps assembled from components. Android wires up activities (UI screens), services (background workers), broadcast receivers (event handlers), and content providers (structured data). iOS is less ceremonial about it but has app extensions, XPC services, and shared data containers. Every component type drags in its own attack surface.

The IPC channels stitching those components together are where a heavy chunk of mobile bugs live. Once a component is exposed to other apps — on purpose or by accident — any sloppy input validation or weak caller check turns into a cross-app exploit.

Android Exported Components

Activities

An exported activity is launchable by any app on the device. If it does anything sensitive — showing private data, kicking off a transaction, twiddling settings — and forgets to check who's calling, any other app can fire it.

The threat is not theoretical. Researchers regularly turn up exported activities in banking apps, messaging clients, and enterprise software that you can launch directly with an intent, sailing right past the navigation flow and login screens the developer thought were protecting them.

xml
<!-- Dangerous: exported activity with no permission restriction -->
<activity
android:name=".admin.ResetPasswordActivity"
android:exported="true">
<intent-filter>
<action android:name="com.app.RESET_PASSWORD" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

A malicious app fires off the right intent, the password reset screen pops up, and the legit login flow never had a chance to run.

Services

Exported services accept connections from anyone. Bound services hand out an interface — AIDL or Messenger — that callers invoke. Skip the caller check and any app on the device can bind in and start calling methods.

Background services are the worst offenders. Nothing on screen tells the user a stranger has bound to them. A malicious app can quietly attach, pull data out, and trigger operations without ever drawing a pixel.

Broadcast Receivers

Broadcast receivers hang around waiting for system or app broadcast intents. An exported receiver will happily handle a broadcast from anywhere. If the receiver acts on the data inside without checking it, a forged broadcast becomes a remote trigger.

The flip side is just as ugly. Send a broadcast with sensitive data and no permission gating, and any app with a matching receiver intercepts it. Ordered broadcasts are worse still — a high-priority listener can edit or abort the broadcast before lower-priority ones ever see it.

java
// Vulnerable: sending sensitive data in an implicit broadcast
Intent broadcast = new Intent("com.app.USER_AUTHENTICATED");
broadcast.putExtra("user_token", authToken);
sendBroadcast(broadcast); // Any app can receive this

The fix is an explicit broadcast that names its target (setPackage() or a component name), or sendBroadcast() with a permission parameter, ideally a signature-level permission so only apps signed with your key can receive it. You'll see LocalBroadcastManager recommended in older answers; it's deprecated, and it only ever covered traffic inside your own process anyway.

Broadcast Receiver Spoofing and Sniffing

Android broadcasts are exposed to two attacks that mirror each other. Spoofing: a malicious app fires a forged broadcast at an exported receiver, triggering unintended actions. Sniffing: a malicious app registers a receiver for the same action and skims any sensitive data riding through. Both rely on the implicit, system-wide nature of broadcasts. Use explicit broadcasts, permission-gated broadcasts, or in-process event buses to shut both down.

Content Provider Vulnerabilities

Content providers let Android apps share structured data with each other through a URI-based interface that hews closely to a database or filesystem. Powerful, ergonomic, and the source of two distinct bug classes.

Path Traversal

A content provider serving files via openFile() usually maps the URI's path onto a filesystem path. Stick the URI path segment onto a base directory without sanitising and you've got ../ traversal:

java
// Vulnerable openFile implementation
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) {
String path = uri.getLastPathSegment();
// getLastPathSegment() URL-decodes, so %2F becomes a real slash.
// Attacker sends: content://com.app.provider/files/..%2F..%2Fshared_prefs%2Fsecrets.xml
File file = new File(getContext().getFilesDir(), path);
return ParcelFileDescriptor.open(file,
ParcelFileDescriptor.MODE_READ_ONLY);
}

Slip ../ sequences into the URI and you climb out of the intended directory, reading any file the app has access to — SharedPreferences, databases, internal configs, the lot.

The fix is to canonicalise the path and confirm it still lives inside the intended directory:

java
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) {
File base = getContext().getFilesDir();
File requested = new File(base, uri.getLastPathSegment());
// Canonicalise to resolve ../ sequences
String canonicalBase = base.getCanonicalPath();
String canonicalRequested = requested.getCanonicalPath();
// Verify the resolved path is within the base directory
// The trailing separator matters: without it, files_backup/ passes too
if (!canonicalRequested.startsWith(canonicalBase + File.separator)) {
throw new SecurityException("Path traversal detected");
}
return ParcelFileDescriptor.open(requested,
ParcelFileDescriptor.MODE_READ_ONLY);
}

Here's the canonicalise-then-compare idea in C, with the three requests an attacker would actually try. One of them shows why the separator in the Java check above isn't decoration.

Try itBefore running, predict which request the plain startsWith check lets through, then add a request of your own.
C (GCC 9.2.0)

SQL Injection

Content providers exposing database access through query(), insert(), update(), and delete() invite SQL injection the moment they start splicing URI parameters or selection arguments into raw SQL.

java
// Vulnerable: selection argument concatenated into SQL
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// If selection is attacker-controlled:
// selection = "1=1) UNION SELECT password FROM users--"
return db.query("items", projection, selection, selectionArgs,
null, null, sortOrder);
}

Defence is the same as on the web. Parameterised queries. Allowlist your selections and projections. Never glue untrusted input into a SQL string.

Service Binding Vulnerabilities

A bound service exposed via AIDL hands every caller a list of methods to invoke. The bug shows up the moment the service forgets to check who's at the other end:

java
// AIDL interface
interface ISecureService {
String getUserData(int userId);
void transferFunds(String from, String to, double amount);
}
// Vulnerable service implementation
public class SecureService extends Service {
private final ISecureService.Stub binder = new ISecureService.Stub() {
@Override
public String getUserData(int userId) {
// No caller verification -- any app can call this
return database.getUserData(userId);
}
@Override
public void transferFunds(String from, String to, double amount) {
// No caller verification -- any app can initiate transfers
bankingAPI.transfer(from, to, amount);
}
};
}

The service ought to call Binder.getCallingUid() and compare against the expected package's UID, or lock binding behind signature-level permissions so only apps signed with the same certificate can connect.

iOS XPC Services and Mach Ports

On iOS and macOS, XPC (Cross-Process Communication) is how an app talks to its extensions, helper tools, and system daemons. Underneath XPC is Mach ports, the bedrock IPC primitive in the XNU kernel.

A note on scope: third-party iOS apps rarely publish XPC services of their own. On iOS this attack surface mostly belongs to Apple's system daemons, which is where jailbreak and sandbox-escape research aims. On macOS, third-party privileged helpers and daemons are common, and their connection checks are a frequent source of local privilege escalation bugs.

Mach Port Security

Mach ports are kernel-managed endpoints. Each port carries rights — send, receive, send-once — controlling who can send to or receive from it. The kernel brokers every message, so forging the sender identity is off the table.

The bugs hide in how daemons handle the messages they receive. A Mach service that swallows arbitrary messages without checking entitlements or sandbox profile is fair game. Send the right crafted message and you change the receiver's behaviour.

Mach port bugs have powered a long list of iOS jailbreaks and privilege escalations. Get hold of an exposed task_for_pid (or one of its cousins) and you grab another process's task port — at which point its memory and threads are yours.

Key Concept
Mach Ports

Mach ports are the fundamental IPC mechanism in iOS and macOS. They are kernel-managed communication endpoints with explicit rights (send, receive, send-once). The kernel tracks port rights per process, preventing forgery of sender identity. However, if a privileged service does not validate the entitlements or sandbox profile of the caller, an attacker can send crafted Mach messages to trigger unintended behaviour. Mach port vulnerabilities have been central to numerous iOS jailbreaks.

XPC Service Validation

XPC services should validate every incoming connection in the shouldAcceptNewConnection delegate method. On macOS 13 and later the supported way is to hand the system a code signing requirement and let it check the caller for you:

swift
func listener(_ listener: NSXPCListener,
shouldAcceptNewConnection connection: NSXPCConnection) -> Bool {
// macOS 13+: the system checks the peer's code signature itself.
// Only our own team's signed app with this bundle ID gets through.
connection.setCodeSigningRequirement(
"anchor apple generic and certificate leaf[subject.OU] = \"ABCDE12345\" " +
"and identifier \"com.example.app\"")
connection.exportedInterface = NSXPCInterface(with: HelperProtocol.self)
connection.exportedObject = Helper()
connection.resume()
return true
}

You'll find older helpers reading connection.auditToken and passing it to the SecCode APIs. That property isn't part of the public NSXPCConnection interface, and checking by PID instead of audit token is racy, which is exactly the hole several macOS helper exploits used. NSXPCListener.setConnectionCodeSigningRequirement(_:) does the same job for every connection at once.

A service that accepts all comers without validation is open to any process that gets hold of its Mach port.

iOS App Extensions and Data Sharing

iOS app extensions — today widgets, share extensions, keyboard extensions, the lot — run in their own process. They share data with the containing app through an app group: a shared filesystem container.

The catch is that this shared container uses the same plain-old file permission model as the app's regular sandbox. Sandbox-protected, but unencrypted by default. If a keyboard extension shares an app group with a main app that drops auth tokens in there, the keyboard extension — and any third-party library bundled inside it — has a clean read on those tokens.

Use app groups sparingly. Share as little as possible through them. Sensitive data belongs in a Keychain item with a shared access group, not in a filesystem container.

Pasteboard Sniffing Across Apps

The pasteboard is an unmonitored, cross-app data channel that gets abused all the time. Pre-iOS 14, any app could read it without the user noticing. Pre-Android 10, same story.

Two flavours of attack:

Passive sniffing. A malicious app watches the pasteboard for interesting content. Crypto wallet addresses, OTP codes, passwords, credit card numbers — all have been observed flowing through the clipboard from legit apps, and intercepted by less-legit ones.

Active injection. A malicious app writes its own data into the pasteboard and waits for a victim app to paste. Classic move: swap a copied cryptocurrency wallet address with the attacker's, so the next transfer lands in the wrong wallet.

Clipboard as an Attack Vector

The system clipboard is a global, unprotected channel every app shares. Pre-Android 10 and pre-iOS 14, any app could read it whenever it liked. Modern restrictions help — foreground-only access on Android, paste notifications on iOS — but the clipboard is still a real data leak. Don't drop sensitive data into it. Where possible, wire up direct data transfer instead.

OWASP Mobile Top 10 Mapping

The bug classes from this module slot neatly onto the OWASP Mobile Top 10, the industry-standard taxonomy of mobile app security risks:

Vulnerability ClassOWASP Mobile Top 10 Category
Intent injection and deep link exploitationM4: Insufficient Input/Output Validation
Custom URL scheme hijackingM3: Insecure Authentication/Authorisation
WebView JavaScript bridge attacksM4: Insufficient Input/Output Validation
Insecure file access in WebViewsM9: Insecure Data Storage
Plaintext SharedPreferences / NSUserDefaultsM9: Insecure Data Storage
Backup extractionM9: Insecure Data Storage
Logging sensitive dataM9: Insecure Data Storage
Exported component exploitationM3: Insecure Authentication/Authorisation
Content provider path traversal / SQL injectionM4: Insufficient Input/Output Validation
Clipboard data leaksM9: Insecure Data Storage
Broadcast receiver spoofingM3: Insecure Authentication/Authorisation

Hold this mapping in your head during assessments. Walk through each OWASP category and methodically check the bug classes that live there. Hands-down the cheapest way to keep your testing organised.

Defensive Summary

Locking down mobile IPC takes the same handful of disciplines applied across every component type:

  • Shrink the exported surface. Only export components that genuinely need to receive intents from elsewhere. Set android:exported="false" on everything else.
  • Validate callers. Lean on Binder.getCallingUid(), signature-level permissions, or XPC audit tokens to confirm only authorised processes are talking to your components.
  • Sanitise everything that comes in. Intent extras, URI parameters, content provider queries, XPC message payloads — same validation rigour you'd apply to data straight off the network.
  • Protect broadcasts. Explicit broadcasts, permission-gated broadcasts, in-process event buses. Sensitive data never rides an implicit broadcast.
  • Lock content providers down. Validate URI paths against traversal, use parameterised queries, and set android:grantUriPermissions deliberately rather than reflexively.
  • Be tight with app groups on iOS. Share the bare minimum, prefer Keychain over filesystem sharing, and validate data integrity when reading from shared containers.
  • Audit third-party libraries. Ad SDKs, analytics frameworks, and cross-platform wrappers love to introduce exported components, JavaScript bridges, and dodgy storage patterns your own code never would.

Put an attacker somewhere and switch checks on to see which one closes each call. A normal-level permission and a PID check both look like protection; find out what they actually stop. Then move the attacker into the keyboard extension, onto a Mac, or into an iOS app process.

Who can call what

Pick where the attacker sits, then switch on checks to see which one closes each call.

Defences

transferFunds() runs for the attacker: reachable in 2 steps

  1. (arrow 2)
  2. (arrow 3)

Tap a box or a numbered arrow to read about it.

Cheapest route Open Blocked (✕) Not reachable yet Reached

Nothing selected yet.

What each defence does
  • android:exported="false". Other apps can't start, bind to or query the component.
  • Signature-level permission. Only apps signed with the same key can hold it.
  • Normal-level permission. The system grants a normal permission at install to any app that asks for it in its manifest, so the attacker's app simply asks.
  • Binder.getCallingUid() check.
  • Explicit or permission-gated broadcast. setPackage() or a component name, or sendBroadcast() with a signature-level permission.
  • Canonical path check. getCanonicalPath(), then check it starts with the base directory plus a separator.
  • Parameterised queries. Allowlisted selections and projections, untrusted input never spliced into SQL.

Component names come from the lesson's examples. Only checks that apply to the attacker's current position are listed.

The underlying rule: every component boundary is a trust boundary. Data crossing one — whether via intent, Mach message, content provider URI, or clipboard — gets validated like it came from an attacker. On a mobile device, often enough, it has.