Dependency Confusion / Substitution
← Supply Chain (OWASP Mobile M2)
dependency_confusion HARD
| Category | Supply Chain (OWASP Mobile M2) |
| OWASP Mobile (2024) | M2 |
| MASVS | MASVS-CODE-3MASVS-CODE-1 |
| MASWE | MASWE-0048 |
| CWE | CWE-427CWE-1357CWE-494 |
| Platform | AndroidiOS |
Description
An internal/private package name is resolved from a public registry, so an attacker who publishes that name to the public index gets their impostor pulled into the build (iOS dependency-management research; classic dependency-confusion class).
How it works
The build resolves an internal package name (acme-internal-auth) from both the private registry and the public index and picks the highest version. The internal package exists privately at 1.2.0, but an attacker has squatted the same name publicly at 9.9.9, so the resolver selects the attacker’s impostor and pulls it into the build (the classic dependency-confusion / substitution class). This is an offline, deterministic model of pubspec / CocoaPods / SPM resolution: the private and public registries are in-memory maps. The secure resolver pins internal names to the private registry/scope and never resolves them from public, returning the trusted 1.2.0.
How to exercise it. DVMA is the harness - open this module from the home index and tap the demo action. The screen ships the malicious input and simulates the attacker (e.g. the companion app, crafted intent, or scanned payload) in-process, and the evidence panel prints the proof. The Tools (optional) and Attack inputs below are only needed to reproduce the exploit end-to-end on a real device.
Exploit steps
- Set up. Build DVMA with a flavor that enables the Supply Chain (OWASP Mobile M2) category (e.g.
--dart-define-from-file=config/flavors/dev.json) and run on an emulator/simulator you control. The demo needs no external tooling; for the optional on-device reproduction the relevant tools are:pubspec review,osv-scanner· Android:gradle/Maven inspection· iOS:CocoaPods/SPM. - Locate the target. From the home index, open Dependency Confusion / Substitution (
dependency_confusion). The How it works section above describes this module’s specific weakness; the screen states the intended-secure behavior and exposes the vulnerable action. - Exploit. Inspect the dependency/SDK surface (lockfiles, bundled SDKs, update channel) and confirm the untrusted or unverified component is accepted - e.g. a substituted package, an unsigned artifact, or a silent post-deploy update.
- Observe the evidence. Trigger the vulnerable action and read the evidence panel - it prints the concrete proof (leaked value, accepted replay, executed payload, or unauthorized result).
- Contrast with the secure path. Run the module’s secure/hardened action (where provided) and confirm the same attack is rejected - this is what a correct implementation should do.
Tools (optional)
Android
iOS