Jaimin J Gohel πŸ‘¨β€πŸ’» Profile picture
Aug 27, 2021 β€’ 19 tweets β€’ 6 min read β€’ Read on X
Let's discuss a scenario, bypassing Root detection with @fridadotre

πŸ§΅πŸ‘‡
β€’ We have an 'UnCrackable-Level1.apk' from OWASP MSTG, which has a Root Detection implemented.

β€’ Let's try to bypass this check using FRIDA.

πŸ‘‰ github.com/OWASP/owasp-ms…
β€’ Let's run the app first.

β€’ Bummer!! We are not supposed to run this app on a rooted device.
β€’ Let's open the APK with jadx-gui to find out how the app is detecting rooted devices.

β€’ Let's Navigate to "sg.vantagepoint > uncrackable1 > MainActivity"
β€’ Have a look at onCreate() method it says if c.a() or c.b() or c.c() returns true then send "Root detected!" string to method a().
β€’ Method a() is responsible for creating AlertBox with title str('Root detected!').

β€’ Content of the AlertBox will be "This is unacceptable. The app is now going to exit."
β€’ To identify the root detection logic we need to drill down to class 'c'.

β€’ Let's Navigate to 'sg.vantagepoint > a > c'

β€’ class c has 3 methods a(), b() and c()
β€’ Let's understand the behavior of all 3 methods.

β€’ Method a()

β€’ This method is checking for the presence of 'su' binary executable in the android device.
Method b()

β€’ This method is searching for 'test-keys' inside Build.TAGS.

β€’ Presence of 'test-keys' inside Build.TAGS indicates that firmware on your device is not signed by release keys.

β€’ Essentially this means you have installed custom firmware by rooting the device.
Method c()

β€’ Method c() is searching for 'su' binary executable at common paths.

β€’ Presence of 'su' at any of these locations indicates the device is Rooted.
Now there are two ways I can think of to bypass the check.

1. Changing the implementation of all three methods of class c to return false.

β€’ sg.vantagepoint.a.c

2. Changing the implementation of method a() of MainActivity to replace the AlertBox logic.

β€’ MainActivity
Method 1

β€’ Wait, before that if you want to set up FRIDA on the android device.

Follow this link πŸ‘‰ frida.re/docs/android/
Method 1

β€’ Let's write a Frida script that overwrites the implementation of a,b, and c methods to return false each time.

method-1.js
Run 'method-1.js' script to see the action!

πŸ’» frida -U -f owasp.mstg.uncrackable1 -l 'method-1.js' --no-pause

View the messages in the Frida console.
Bingo! Root detection is bypassed with method 1.

There is no AlertBox saying 'Root detected!'
Method 2

β€’ Following Frida script will replace the AlertBox logic present in the method a() of MainActivity.

β€’ So we can interact with the application without any hurdle.
Let's see the action!

πŸ’» frida -U -f owasp.mstg.uncrackable1 -l 'method-2.js' --no-pause

View the message in the Frida console.
Root detection is bypassed with method 2.
I hope you enjoyed reading the thread.

Happy hacking! πŸ˜€πŸ’»

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Jaimin J Gohel πŸ‘¨β€πŸ’»

Jaimin J Gohel πŸ‘¨β€πŸ’» Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @jaimin_gohel

Nov 9, 2022
Android Vulnerables:
Damn Vulnerable Bank is designed to be an intentionally vulnerable android application. This application provides an interface to assess the security knowledge you gained over time.

github.com/rewanthtammana…
InsecureBankv2 covers testcases like Flawed Broadcast Receivers, Intent Sniffing and Injection, Weak Authorization mechanism, Local Encryption issues etc.

github.com/dineshshetty/A…
Read 6 tweets
Jun 13, 2022
πŸ‘€Looking for sensitive data in Android local storage:
We are using DIVA Android for the demo

github.com/payatu/diva-an…
INSECURE DATA STORAGE – PART 1 Image
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(