MASPTv2.5 InjectMe
MASPTv2.5 InjectMe
InjectMe LAB
LAB Topics
Static Code Analysis
You are allowed to use all the tools in your toolkit to extract critical application information.
The objective is to find any critical injection vulnerabilities that may exist, so that it is safe
for the company’s clients to use the new application.
LAB OBJECTIVES
The objective of this lab is to highlight the importance of static code analysis while
performing a mobile application penetration test. A large amount of critical information can
be extracted through performing static code analysis on the application’s source code such
as unprotected application components, implicitly exported activities, insufficiently secure
local databases, etc. This information can be used to perform more elaborate attacks against
the application.
LEARNING OBJECTIVES
The learning objective of this lab is to provide hands-on experience in performing static code
analysis against an application’s source code in order to identify possible SQL-injection
vulnerabilities.
RECOMMENDED CONFIGURATION
Setting up your testing environment for this lab
1. Windows 10 Machine:
Running:
2. Preferred device
TASKS
TASK 1. INSTALLATION OF APK AND REVIEW OF THE
APPLICATION’S FUNCTIONALITY
Please install this application to your device (physical or virtual), if you run into any issues,
please use the solution section. Then, go through the application’s functionality.
your_drive:\extracted_zip_path\InjectMe\app\build\outputs\apk
Then, you can install InjectMe on your device through an adb install command.
You can see that you can create and store credentials using the application.
Name Password
admin1 admin123
admin2 admin234
Looking at the application’s AndroidManifest.xml file, you can see that it has a content
provider, that is insecure if the application is run on a device running an API level between
23 and 8.
The content provider is insecure due to the fact that it is implicitly exported and therefore
accessible by third-party applications, that have no specific permissions.
To extract the classes.dex file from the built APK, you can simply rename the APK to a
.zip/.7z/.rar file and extract its contents.
Then, use the strings binary for Windows operating systems and execute the following
command to enumerate all possible content URI inside an application.
The strings binary for Windows can be downloaded from the link below.
https://technet.microsoft.com/en-us/sysinternals/strings.aspx
Walking through the Cursor method, from the top, the first conditional piece of code you
encounter in this method is a switch statement. In this case, as long as the URI is valid, it will
match one of the two options and take the URI input into the query.
As with any static code analysis activities, you will have to be thorough in your analysis. That
means that you should check if there is a parameterized query or a sanitization of the input,
beyond the qualification of the switch statement. Those could mitigate any injection
vulnerability that may exist. Fortunately, there aren’t any, but in general, pay attention and
don’t jump to quick conclusions.
You can interact with the insecure content provider you discovered in Task 2, either by
creating a malicious exploit application or by using ADB. In this tutorial, we will describe the
latter.
To interact with the insecure content provider, execute the following command through
ADB.
On your own: What other SQL codes can you run here. Can you insert, or delete?