When a team ships a mobile app, it has two places to spend security effort. One is the app on the user’s phone: protect it from being inspected, tampered with or run in a risky environment. The other is the server behind it: assume the app is hostile and validate everything. Most teams do some of each. The argument I want to make is about the proportion, and I will take a side early: the server deserves the first and larger share.

The phone belongs to the user

The starting fact is simple and uncomfortable. Once your app is installed, it runs on a device that your user, or an attacker who is also a user, controls. They can unpack the app package and read what is inside. They can run it on a rooted or jailbroken phone, or in an emulator. They can watch its network traffic by routing it through an interception tool and installing their own trusted certificate. They can modify the app and repackage it. All of this is routine work for anyone who tests mobile apps, and the OWASP Mobile Application Security Verification Standard (MASVS) and its testing guide describe how defenders assess such apps.

So anything you put in the app is, sooner or later, readable. An API key, a hidden “admin” endpoint, a pricing rule, a client-side check that says “only premium users see this screen”. If you secure by hiding, you are betting on the cleverness of everyone who will ever try.

What client-side hardening does well

It is not worthless. It raises the cost of casual attacks, and some pieces protect users from other threats.

  • Secure local storage. Use the platform’s protected key storage for tokens and secrets, not plain preference files or the app’s open folders. This protects users if the phone is lost, or if another app on a compromised device tries to read data.
  • Certificate pinning. The app is built to accept only your server’s certificate or public key, so a rogue certificate from a malicious network or an installed interception certificate does not work. It defends users against man-in-the-middle attacks on hostile Wi-Fi. It does not stop a determined tester with a rooted device, who can bypass pinning by modifying the app at runtime. It also has an operational cost: if you rotate certificates without planning, you can lock all users out until they update. Pin to keys with backups, or reconsider if your team cannot manage the process.
  • Root and jailbreak detection, and integrity checks. These raise suspicion about the environment. Treat the result as a risk signal sent to the server, not as a gate the app enforces on itself, because the check is just more client code that can be modified.
  • Obfuscation. It makes reverse engineering slower, which can matter for protecting commercial logic. It does not make secrets safe.
  • Screen and clipboard care. Hiding sensitive screens in the app-switcher preview, and limiting what goes to logs and clipboards, closes small leaks that real users cause.

Why the server has to carry the weight

Every request your server receives could come from your genuine app or from a script written by someone who has studied it. The server cannot tell the difference reliably, so it must enforce the rules itself. That means several concrete things.

Check authorisation on every request. If the app calls an endpoint with an order number, the server confirms that this user owns that order, regardless of what screens the app would normally show. Broken access control at the API level is among the most common serious findings in mobile testing, precisely because developers assume the app only asks for sensible things. Validate input as if no app existed. Apply price, quantity and eligibility logic on the server: if a coupon discount is computed on the phone and the amount is sent as a number, an attacker can send a different number. Rate-limit and monitor, since tampered clients can automate abuse at a scale no human tapping on a screen can. Keep secrets, such as third-party API keys with spending power, on the server and let the app call your service instead.

For session handling, use short-lived access tokens with refresh and revocation, and bind high-risk actions to a fresh check such as biometric or OTP confirmation validated server-side.

A middle path: attestation

There is a sensible bridge between the two camps. Both major mobile platforms offer attestation services, where the operating system or a hardware-backed component vouches to your server that the request comes from an unmodified copy of your app on a genuine device. The server verifies that statement with the platform’s service. This does not make the client trustworthy, and attestation can be unavailable on some devices, so the result should feed a risk decision rather than act as an absolute pass or fail. In India, where many users run budget phones with varied software, a hard block on failed attestation might lock out honest customers, so teams tune the policy to the product.

Where I land

Spend roughly in this order. First, server-side authorisation, validation and rate limits, because these decide what a hostile client can actually do. Second, storage of tokens and secrets on the device, because lost or compromised phones are the most common real-world cases. Third, transport protections including pinning where your team can operate it safely. Last, obfuscation and tamper detection, to slow down cloning and fraud where the business case justifies it.

A banking or payments app will push further into the later items, because attackers there have money to gain and regulators may expect specific controls. A staff leave-application app can reasonably stop at the first two. The mistake is reversing the order: a lovely obfuscated, pinned, root-detecting app whose API happily returns any customer’s record to anyone who asks has defended the lock on a door that has no wall beside it.

Leave a Reply

Trending