Baptiste Robert
Baptiste Robert
@fs0c131y
Apr 14 5 months ago 16 tweets Read on X

<Thread> Hey ! I don't think this EngineerMode APK must be in an user build...🤦‍♂️
This app is a system app made by and customised by . It's used by the operator in the factory to test the devices.

Tweet image 1

If you have an OnePlus device, I'm pretty sure you have this app pre-installed. To check open Settings -> Apps -> Menu -> Show system apps and search EngineerMode in the app list to check

With telephony secret code you can access to manual tests like GPS test, root status test as stated in this article pointed by . But can do better...

Tweet image 1
Tweet image 2

You can access to the "main" activity by sending this command: adb shell am start .engineeringmode/.EngineeringMode
You will have access to everything, not just the manual test.

Tweet image 1
Tweet image 2
Tweet image 3

Having access to all these functions is a real issue. Combined with this attack, , a malicious app can do a lot of thing.

I will find time to make a POC.
But it's not the biggest issue with this app.

The DiagEnabled, which is a made activity, is the best class in this EngineerMode APK. Check the methods in this activity: escalatedUp(boolean, string) sounds like a cool thing no 😀?

Tweet image 1
Tweet image 2

In the onCreate method if the intent is not null the escalatedUp method is called with the parameter enable=true and password=getIntent().getStringExtra("code"). Do you see where I'm going?

Tweet image 1

The escalatedUp method is calling Privilege.escalate(password) and if the result is true, it set the system property persist.sys.adbroot and oem.selinux.reload_policy to 1

Tweet image 1

So yes, if you send the command: adb shell am start -n .engineeringmode/.qualcomm.DiagEnabled --es "code" "password" with the correct code you can become root!

Here the Privilege class. Check the name of native library used to check the code: door... Ladies and Gentlemen please say hi to the backdoor made in

Tweet image 1

This lib is located in /system/lib/libdoor.so or /system/lib64/libdoor.so. You can find the sample here:

This is the interesting strings of the lib. After a first read we can see that libcrypto is used and the key and the password are backup in /data/backup/fpwd and /data/backup/fkey

Tweet image 1
Tweet image 2

This is the code responsible of the password verification. 1st it check the length, calculate the hash and compare it to the correct one.

Tweet image 1
Tweet image 2

Unfortunately, I didn't find the password, so if some you are skilled in reversing native lib, your help is very welcome!

cc I forgot to add you :)

Missing some Tweet in this thread? You can try to Update

More Threads by @fs0c131y

1 tweets • 28 days ago
Read Thread
3 tweets • 29 days ago
Read Thread
4 tweets • 1 month ago
Read Thread
1 tweets • 1 month ago
Read Thread
2 tweets • 1 month ago
Read Thread

Unroll Another Thread

Convert any Twitter threads to an easy-to-read article instantly

Have you tried our Twitter bot?

You can now unroll any thread without leaving Twitter/X. Here's how to use our Twitter bot to do it.

  • Give us a follow on Twitter. follow us
  • Drop a comment, mentioning us @unrollnow on the thread you want to Unroll.
  • Wait For Some Time, We will reply to your comment with Unroll Link.
UnrollNow Twitter Bot
Modal Image
0:00 / 0:00