[DEV] S-OFF, PERMROOT, eMMC write [INSTRUCTIONS]

Search This thread

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
props to scotty & tmzt


BE CAREFUL WHAT PARTITION YOU'RE DD'ING INTO OTHERWISE YOU'LL END WITH A BRICK.

Instructions
1: Get VISIONary from the market and do a temp root
2: download http://rapidshare.com/files/429891451/dhd_root.zip and extract.
Place these files in /sdcard/ on your DHD (you only need 1 of the .ko, depending on your kernel version - check with uname -a in adb shell)


Go to adb shell, switch to root (su) and do the following:

insmod /sdcard/wp-(version).ko
for example: insmod /sdcard/wp_g5ed1769.ko
This will disable wp (will be enabled on reboot though...)

dd if=/sdcard/hboot_eng.nb0 of=/dev/block/mmcblk0p18
This will install engineering hboot

BE CAREFUL - DOUBLE CHECK THE PARTITION
dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p21

OR

save recovery.img somewhere on your HDD, open a shell/cmd in that directory and:
fastboot flash recovery recovery.img
Both ways will install an unsecured recovery (not clockwork yet)

The module is for the release version of DHD (2.32.21-g5ed1769)
If you have another one, you can easily mod it:

check your version via:
cat /proc/version

Download a Hex Editor, search for vermagic in the wp_g5ed1769.ko, and replace patch version with:
g5ed1769
Save
Reload to sdcard and follow instructions from the top.

You can now PERMROOT (once you load the module, just push su and Superuser.apk to /sdcard/)
and
copy su to /system/bin/
and Superuser.apk to /system/app/

Don't forget to suid su:
su
chmod 4755 /system/bin/su



NOTE:
once you load the module, you can confirm a successful load via:
dmesg|tail

here's a sample output

<3>[ 881.934631] mmc0: DMA channel flushed (0x80000004)
<3>[ 881.935241] Flush data: 00000000 00000000 00000103 c0088008 c7e38000 00000001
<6>[ 881.935913] mmc0: Controller has been reset
<6>[ 881.936279] mmc0: Worked around bug 1535304
<3>[ 881.941802] mmcblk0: error -110 sending status comand
<3>[ 881.942443] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x0
<3>[ 881.943084] mmcblk0: error -5 transferring data, sector 327712, nr 8, card status 0x0
<6>[ 881.943695] mmc0: reinit card
<4>[ 881.944030] mmc0: Starting deferred resume
<6>[ 882.010437] mmc0: Deferred resume completed
 
Last edited:

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
What about adb pushing su and Superuser.apk WHILE flashing a STOCK ROM via RUU? The eventual signatures check is in the beginning only and thus irrelevant for this procedure.
During this length process, the real SYSTEM: is unlocked, and we should be able to do anything we want during that time.
Basically, we just need to check till /system/bin/su is copied from the RUU, THEN push ours, in order to prevent overwriting by the stock one.

This SHOULD, at least in theory, allow us to have persistent root. Can anybody check that?
 

Bumble-Bee

Senior Recognized Developer & Original Autobot
Feb 21, 2009
916
566
twitter.com
While flashing the via RRU every file that is pushed is sig checked... Besides we cant push spcific files in RRU anyway :-|

And before anyone says recovery ADB is locked down in recovery so cant push anything that way :-(

Tbh we have two hopes... Have a singed test recovery to flash we need a shipping desire hd to test this -- (first desire root type)

And the G2 root ppl the hd will have the same protection as the G2

:)

Sent from my GT-I9000 using XDA App
 

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
I was just pushing ideas around, things I need to check anyway.
It's hard to do any real work without a device to work on (yet - should be shipped by next week).

It WOULD be great if anyone could come forward with a test/engineering device I could work with. Maybe a test/engineering partitions dump?
 

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
R.E is a b*****.
If only we had access to an engineering device, we could dump pmem (since we know at what address HBoot is loaded anyway), compare that to a retail device, and try some binary patching the HBoot via userland and/or a module....
 

K900

Senior Member
Aug 12, 2010
4,846
2,893
Moscow
I have just thought about it: can the lock be related to path, not to address or something? Maybe you could symlink /system somewhere in /data (somewhere that is writable normally) and write through this symlink? Kinda improbable but worth trying...

Sent from my HDfied HTC Desire

Sent from my HDfied HTC Desire
 

adwinp

Senior Member
Jun 22, 2008
2,055
330
urandom
I have just thought about it: can the lock be related to path, not to address or something? Maybe you could symlink /system somewhere in /data (somewhere that is writable normally) and write through this symlink? Kinda improbable but worth trying...

Sent from my HDfied HTC Desire

Sent from my HDfied HTC Desire


Unfortunately it doesn't work that way.
;]
A symlink inherits all properties of the parent.
It's like trying to change tires in a car with a broken down engine. You won't be able to drive it, no matter what the tires.
 

K900

Senior Member
Aug 12, 2010
4,846
2,893
Moscow
Unfortunately it doesn't work that way.
;]
A symlink inherits all properties of the parent.
It's like trying to change tires in a car with a broken down engine. You won't be able to drive it, no matter what the tires.

I think the lock is not in the FS, it's somewhere lower level, so it just might work

Sent from my HDfied HTC Desire
 

WendigoNL

Senior Member
Dec 1, 2008
60
7
Vriezenveen
hey, first post in the android section, still awaiting the arrival of DHD, after alot of reading about getting root, i was thinking, as mentioned above somewhere, the update process does'nt allow pushing of specific files, this got me thinking of a Windows Live games security wich was supposed to block those pesky cheaters of using RAM intercepts of running processes.

isn't it a possibility to intercept the write buffer before it outputs to device and replace neccesary files to gain root access? in other words, patch it with superuser.akp via injection or disable nand security listening?


run a rom installer with a signed rom > output to virtual device(or buffer) > patch the neccesary files > (output altered dataflow in sections we need so physical device still believes its signed as the checks are still there on update.) to physical device


could this work?
 

Golomidov

Senior Member
Jul 15, 2007
75
5
What about change one of signed file from oficial ROM/OTA update?
As far as I understand digital signature is based on SHA-1 which is kind of "broken".
So we have to choose some file in official update zip, change its contents to "useful_part+garbage_to_match_sha1" and update :)
just google "sha-1 broken"
 

K900

Senior Member
Aug 12, 2010
4,846
2,893
Moscow
What about change one of signed file from oficial ROM/OTA update?
As far as I understand digital signature is based on SHA-1 which is kind of "broken".
So we have to choose some file in official update zip, change its contents to "useful_part+garbage_to_match_sha1" and update :)
just google "sha-1 broken"

It's almost impossible to get a sha1 hash to match. But I wonder if we can reverse engineer the RUU and make it skip hash checks or check against the modified file's hash

Sent from my HDfied HTC Desire
 

El_Nino9

Senior Member
Dec 2, 2009
277
78
London
@WendigoNL: the ruu itself doesn't do anything. All the work is done by HBoot.

i thought the ruu does something?
doesn't send adb reboot bootloader and then fastboot oem -78 command? and put it in ruu mode?but before all that, doesn't it push the rom.zip somewhere? :S

sorry just want clarification. i know this method won't work as the bootloader will check the signed keys on the zip file so you can't hijack the rom.zip file, i.e. in the temp folder replace rom.zip with a test ruu or even a custom rom with SU and and custom recovery pushed in the zip file.
i may be completely wrong and look forward to your answer adwinp.
i may try this when i get home but i know htc arnt THAT stupid
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hi,

    I'm lost... please, can somebody help me ?
    I followed the tut until this:



    I got a "5226496 bytes transferred in blablabla...", no error, but now... I really don't understand what i have to do...
    I'm scared of restarting my DHD and get a brick :x


    PM me your google talk/gmail chat handle and I'll walk you through the steps.
    1
    Reboot, uninstall Visionary, install it again, make sure that USB Debugging is enabled and try temproot again.
    1
    1: use one of the official recoveries instead of the one provided (that shouldn't have any effect on root anyway).
    2: I don't use VISIONary, I prefer the manual way. Once you're root (since you already have ENG SPL, you don't need to bother about WP), do this:
    mount -o remount,rw /dev/block/mmcblk0p25 /system
    3: you can adb push your fonts manually to /system/fonts
    You can only SAFELY replace DroidSans.ttf and DroidSans-Bold.ttf. Don't touch the other ones. Double check your file permissions!!