Skip to content

Instantly share code, notes, and snippets.

@spinpx
Last active July 30, 2017 06:34
Show Gist options
  • Save spinpx/e1a795ef78e8823e21b4d00d6a73f849 to your computer and use it in GitHub Desktop.
Save spinpx/e1a795ef78e8823e21b4d00d6a73f849 to your computer and use it in GitHub Desktop.
Ways to bypass authentication in Android SDK #Android #Security

Ways to bypass authentication in Android SDK

Several Android SDKs ask the user to register a key before using them. The key might be unique to each user and used to authenticate the user. This is to track or limit the users of the SDKs or earn benifit from the users.

The authentication step can be in :

  • SDK
  • Server
  • Others

SDK

To authenticate the user in SDK. It will maintain a state in the SDK to indicate the user is valid or not. And the SDK will check if the state before using the functions of SDK, otherwise, it will return an error.

To initialize the state, SDK will using some logics to check the key. Usually, they will verify the key in a server by send a authentication request. The state is valid if the response if successful.

There are mainly three ways to bypass them in SDK.

Direct access

If the function of the SDK is related to network requests. We can capture the network requests, then mirror these requests directly instead of in the SDK.

MITM attack

If the authentication request is not secure, we can use MITM attacks to modify the response to get a successful response with any random key.

Modify SDK

If the authentication logic is in the SDK. There are code like :

public bool getState() {
 return state;
}

We can recompiled and repackaged to modify the code to always return true.

Server

If the authentication step are in sever, it’s hard for us to bypass it unless the key is able to guess. However, this must used in the functions of SDK is network related and you should send the key with each request or the server should maintain a state for each user.

Discussion

The authentication is able to bypass because the computes for authentication is untrusted. Like in the SDK, they can be modified by malicious developer. So, the authentication code must be place in a trusted zones, such as a server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment