Mobile Security6 min read

AppSleuth, part 2: map an app's attack surface

Use AppSleuth's endpoints, links, cloud and sbom commands to list the hosts, deep links, cloud backends and libraries an app relies on, offline by default.

This is part 2 of 4 in our AppSleuth series.

A mobile app is mostly a client for things that live somewhere else: an API, a database, a storage bucket, a payment provider, a crash reporter. It is also an entry point, through deep links that any web page or app can fire at it. Before testing any of that, you need a map.

AppSleuth has four commands that build one from the app file alone: endpoints, links, cloud and sbom. All four work on IPA, APK, APKS/XAPK and AAB files, all four write the same HTML, Markdown and JSON reports as scan, and all four are offline by default. We’ll come back to that last point, because it matters.

The examples use com.example.shop, the test app we built for this series. Only run these commands on apps you own or are authorised to test.

endpoints: every host the app mentions

appsleuth endpoints shop-2.4.0.apk -o reports/endpoints

AppSleuth pulls URLs out of DEX code, native libraries, Mach-O binaries, web assets and config files, removes documentation and schema noise, and labels every host. The terminal shows the findings; the full table goes to endpoints.txt in the report folder.

Output from a test app we built for this post (endpoints.txt):

com.example.shop  endpoints
============================================================
HOST                                          PARTY        CATEGORY         N  FLAGS
203.0.113.10                                  unknown      raw-ip           1  raw IP address; private/loopback address; cleartext scheme seen
a1b2-198-51-100-7.ngrok-free.app              unknown      other            1  tunnel / temporary hosting service
exshop-legacy-4f7a2.web.app                   unknown      other            1  cleartext scheme seen
exshop-staging-4f7a2.web.app                  unknown      other            1  looks like a non-production environment
exshop-prod-4f7a2.firebaseio.com              third-party  firebase         2
api.razorpay.com                              third-party  payments         1
exshop-media-4f7a2.s3.amazonaws.com           third-party  cloud            1
o450217.ingest.sentry.io                      third-party  crash-reporting  1

API-looking paths (heuristic): /api/v2/cart, /api/v2/orders, /oauth/token

Each host is first-party (it matches the app’s identifier), a known third-party SDK or service with a category, or unknown. The flags are what testers care about:

  • Raw IP addresses, which mean no hostname for TLS to check. (We used an address from a range reserved for documentation, which is why it’s also marked private.)
  • Cleartext: an http:// or ws:// URL was seen for this host.
  • Non-production names such as staging, dev, uat or test. These often run older code with weaker controls.
  • Tunnel and temporary hosting services such as ngrok. Once the developer’s tunnel stops, someone else can claim the name and serve content to the app.

Each flag type also becomes a finding, so the terminal shows “Non-production host name(s) referenced”, “Temporary tunnel / hosting-service host(s) referenced” and so on, with the hosts as evidence.

A host in the list doesn’t mean the app calls it at runtime. It means the string is in the package. That’s still useful: dead staging URLs and forgotten tunnels are worth removing either way.

One practical note. AppSleuth deliberately ignores example.com and other reserved documentation domains, because real apps are full of them in comments and library code. That’s why our test app uses made-up project names on cloud hosts instead.

appsleuth links shop-2.4.0.apk -o reports/links --show INFO -v

On Android, links reads every intent filter that a link or another app can reach. On iOS, it reads custom URL schemes from Info.plist and Universal Link domains from the entitlements.

Output from a test app we built for this post (explanations trimmed):

shop-2.4.0.apk: 0 High  0 Medium  1 Low  2 Info
  [LOW] http(s) deep links without Android App Links verification
        evidence: promo.example.com
  [INFO] 3 deep-link intent filter(s) (heuristic)
        evidence: LinkActivity: https://shop.example.com; LinkActivity: exampleshop://open; PromoActivity: https://promo.example.com
  [INFO] Custom URL scheme `exampleshop://` handled by LinkActivity
        evidence: exported=True

Two things stand out. The PromoActivity link handles https://promo.example.com without android:autoVerify="true", so Android can’t verify that the app owns the domain and may offer another app instead. And exampleshop:// is a custom scheme: any app can register the same one. AppSleuth also flags filters with no host restriction, broad wildcards, generic scheme names like myapp://, and on iOS, associated domains left in ?mode=developer.

Whatever handles the link, its parameters are untrusted input. A deep link that feeds a URL into a WebView, or passes it straight into an internal screen, is a common route from “tap this link” to a real finding.

Opt-in check: --check-network downloads the public assetlinks.json (Android) or apple-app-site-association (iOS) file for each domain the app claims and confirms it actually lists this app. A missing file, a redirect, or a file that names a different package or signing certificate means verification will fail.

cloud: which backends, and are they open?

appsleuth cloud shop-2.4.0.apk -o reports/cloud --show INFO -v

cloud finds the Firebase Realtime Database, Cloud Storage (including Firebase Storage), Amazon S3 and Azure Blob storage the app is configured for, from google-services resources, GoogleService-Info.plist, and URLs in code and assets.

Output from a test app we built for this post:

shop-2.4.0.apk: 0 High  0 Medium  0 Low  3 Info
  [INFO] 1 Firebase Realtime Database(s) referenced (heuristic)
        Backends found in the app's code, assets or config.
        evidence: exshop-prod-4f7a2.firebaseio.com
  [INFO] 1 Amazon S3 bucket(s) referenced (heuristic)
        Backends found in the app's code, assets or config.
        evidence: exshop-media-4f7a2
  [INFO] Backend exposure not tested (heuristic)
        Run with --check to ask each backend, read-only and unauthenticated, whether it is open. Only do this for apps you are authorised to test.

Firebase configuration values aren’t secrets. They ship in every client by design, and the real control is the server-side security rules. The question is whether those rules are right.

Opt-in check: cloud --check asks each Realtime Database, Cloud Storage and S3 backend (and Firestore, when a Firebase project ID is present), read-only and unauthenticated, whether it answers a list or read request. It records only the HTTP status and a yes or no, never the returned data. Targets are restricted to a fixed allow-list of cloud hostnames and must resolve to public addresses, so a hostile app can’t point the tool at your internal network. The command prints a reminder before it starts, and it means it: you are sending requests to someone’s cloud resources. Only use it on apps you are authorised to test.

A listable bucket or a database readable without a login is a serious finding on its own. It also tends to be invisible to anyone who only tests the app’s screens.

sbom: what’s inside

appsleuth sbom shop-2.4.0.apk -o reports/sbom

sbom inventories the third-party components the build left evidence of: Maven pom.properties, AndroidX and Google .version and .properties files, library version strings in DEX code, and iOS framework Info.plist files. It writes a CycloneDX SBOM (sbom.cdx.json), the OWASP CycloneDX format that most supply-chain tooling reads.

Add --cves and it looks each component up in the OSV.dev vulnerability database:

appsleuth sbom shop-2.4.0.apk -o reports/sbom --cves

Output from a test app we built for this post (explanations trimmed):

shop-2.4.0.apk: 2 High  0 Medium  0 Low  1 Info
  [HIGH] Known vulnerabilities in com.google.code.gson:gson 2.8.5 (1) (heuristic)
        META-INF/maven/com.google.code.gson/gson/pom.properties
        ... fixed in 2.8.9.
        evidence: CVE-2022-25647 (high)
  [HIGH] Known vulnerabilities in com.squareup.okhttp3:okhttp 3.12.0 (1) (heuristic)
        classes.dex (user-agent string)
        ... fixed in 4.9.2.
        evidence: CVE-2021-0341 (high)
  [INFO] 4 third-party component(s) inventoried (heuristic)
        evidence: 4 with a version; 4 checked against OSV, 0 not matchable
CycloneDX SBOM: reports/sbom/sbom.cdx.json

The advisory data is as OSV listed it at the time of writing. Read these as leads. A library being present doesn’t prove the vulnerable code is reachable: R8 may have removed it, and many advisories need a specific usage. AppSleuth only looks up components whose package coordinates it knows exactly, so it won’t guess at CVEs for something it can’t identify. When the vulnerabilities are found, they go into the CycloneDX file too.

An SBOM is also increasingly something customers ask for, and a CycloneDX file per release is an easy way to have one ready.

Offline by default, and what each option sends

None of the four commands touch the network unless you ask. That’s deliberate: you should be able to analyse a client’s app on an air-gapped laptop, and you should always know what leaves your machine.

Option What it sends, and where
sbom --cves Library names and versions only, to OSV.dev. Results are cached for 24 hours in ~/.cache/appsleuth; --offline uses the cache only.
links --check-network HTTPS requests for the public association files of the domains the app claims.
cloud --check Read-only, unauthenticated requests to the app’s Firebase, Cloud Storage and S3 backends, only to a fixed allow-list of cloud hostnames.

The network helper refuses plain HTTP, never follows redirects, refuses hosts that resolve to private addresses, and caps response size and time.

Putting the map to work

Together these four commands give you a one-page picture of an app’s attack surface: the hosts to put in scope, the entry points to fuzz, the backends whose rules need checking, and the libraries to keep current. For a full test, take that map into the API, because that’s where the data is. Our API security testing guide is the next step.

appsleuth diff also compares the host lists of two builds and flags new cleartext, raw-IP or staging hosts. That’s part 3.

Get it

The AppSleuth series

  • Previous: Part 1: Mobile app security triage
  • Part 2: Map an app’s attack surface (you are here)
  • Next: Part 3: Catch regressions between builds
  • Part 4: App data and runtime

One practical security note a week.

No spam. Unsubscribe any time.

Need a pentest for an audit, a customer, or peace of mind?

Tell us what you need tested. You’ll get a fixed-fee proposal with tester-days and timeline stated, usually within a few days of the scoping call.