Back again with some android pentesting this time we are going to take a look at two challenges at the same time from PIVAA (https://github.com/HTBridge/pivaa)
Creation of world-readable or writable files:
The mobile application creates files with world-readable or writable permissions. Such files can be accessed and modified by other applications, including malicious ones, thus imperiling the application's data integrity.
Hardcoded data
The mobile application contains debugging or potentially sensitive hardcoded data. An attacker with an access to the mobile application file can easily extract this data from the application and use it in any further attacks if it contains any internal or confidential information.
I'm gonna talk about hardcoded data first and then continue to the creation of world R/W files. By the end of this post we can see that these two vulnerability is somehow connected.
In the explanation, it is said that the application used debugging capabilities in android but it's log sensitive information regarding the user.
According to the android developer website. Developer can use function "Log" to generate a log for debugging, it comes with many methods that you can use such as:
- Log.e(String, String) (error)
- Log.w(String, String) (warning)
- Log.i(String, String) (information)
- Log.d(String, String) (debug)
- Log.v(String, String) (verbose)
use grep -RF "Log." to iterate all over the source code to find the function, notice that we use -F in our grep command this is used to treat the string param as what it is because there is "." in our string search and -R to iterate all over file in the current directory.
Ok we got some really interesting stuff that we can analyze take a look at the Log.i("info", "saveLoginInfo:....") the application show the input password from the user to the log, we check it using logcat then we can see it in cleartext.
Of course some of you might be thinking to leverage this vulnerability that we found by creating another application that sniff the logcat input
yess you can do it like that but there is some limitation in that approach. You can follow the source code above
when you run the application we are able to get log data but notice that the log itself is come only from our application it cannot listen to other application logs this is happening because of the android restriction sandbox
due to the security reason android patch API 4.1 and above so it cannot sniff other application logcat but you still can do it with the lower version.
So because of the limitation on the device is this vulnerability still relevant ?
Depends
lets take a look again at the log file:
Last time we only focus on the credential "saveLogInfo" but as we analyze further more the application also show the location of the saved credential we can prove this by running logcat again like below
cool ! so from this information we can go to the location and retrieve the file.
we can even leverage this vulnerability by creating another application that read this config file since it's stored in sdcard it's permission will be World Readable
That's all folks ! I hope you enjoy this post
Comments
Post a Comment