As we well know, CAT B35 has a
working firehose loader, so, using
the right tooling (see the guide in the README), we now have no issues with an open-source and cross-platform way of manipulating its partitions - reading, erasing and flashing. So, how to convert this power into a convenient jailbreak for this device? Let's find out.
First things first: boot partition needs to be patched. It's a normal Android boot partition so a tool like
abootimg can be used, and standard cpio/gzip can be used to modify its internal structure. So, three changes were made in the boot.img:
- in the root /default.prop, ro.debuggable property was changed from 0 to 1;
- in the root /default.prop, ro.adb.secure property was changed from 1 to 0;
- the adbd binary itself was replaced with a rooted one (the same used in Gerda Recovery, for instance).
(of course, don't forget to backup your original boot partition before patching)
So, the low-level things are sorted out, now we need to find a way to enable the developer menu itself. The simplest way to do this was to patch the runtime setting developer.menu.enabled in the userdata partition image. The only problem was that, unlike system partition, this setting in userdata resides in some kind of database. So, to avoid unpacking, searching, patching and repacking, we can resort to dirty direct patching of a dumped userdata partition:
1) open the userdata partition dump in a hex editor;
2) look for the developer.menu.enabled string in the dump;
3) find the closest faultValu string fragment next to it;
4) measure exactly 8 bytes from that last u letter (the target byte should be 00) and change the value of that byte from 00 to 01;
5) rewrite the userdata partition.
Yes, we change a single bit in the huge image that weighs over 1GB, and after the device reboot the developer menu appears where it should: in the Settings - Device - Developer. You get both rooted ADB and DevTools access.
Now, to ensure and get permanent privileged webtools access, just install Wallace Lite via either Pale Moon's WebIDE, recent KaiOSRT or
kdeploy, press that damn # key and perform the privileged factory reset. The userdata partition will obviously be wiped, but Developer menu will be preserved, as well as the root ADB access. But you will still probably need to patch the boot partition back in case you want factory OTA updates - luckily, with the EDL access that's not a problem if you have the backups.
By the way, if you patch the userdata without patching boot, you'll get timed reboots every time you enable the debugging mode, because the adb access will be unauthorized.
And yes, you'll become able to run *#testbox# and even *#*#debug#*#* code, but you'll be only able to turn it on with *#*#debug#*#* - in case you want to turn it off, you'll need to do that from the menu.
And now...
Bonus!
Unfortunately, in terms of EFS, CAT B35 seems to be much more secure. You can't just go and modify any partition directly. The EFS seems to be evenly distributed across volatile modemst1/modemst2 and persistent fsg partition, which in this case is not a TAR archive but an encrypted container in Qualcomm's proprietary format (just like modemst1/modemst2 but with a bit different signature). However, guess what happened when I erased modemst1, modemst2, fsg, rebooted, realized that I had no radio connection available and then reflashed just fsg? The connection was restored but the IMEIs were lost. Not zeroed-out but deleted completely. Even AT commands couldn't read them.
And you know what happens when IMEIs are emptied in the Qualcomm architecture? Their write protection is lifted. So I tried to restore the IMEI at least for the first SIM by forging the following HDLC packet and sending it to the diagnostic port (enabled by default as part of CAT's composite device):
27 26 02 08 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
(after this also a CRC and the trailing packet marker follows, I'm just showing the packet payload)
And... it works as expected. I think a POC IMEI changer in Python will follow, but we need to find a way to update the NV item 550 for the context of SIM2.
Hopefully all this info will be useful to B35 users. Have fun!