[LOKI] Bootloader hack official FAQ thread

Search This thread

djrbliss

Inactive Recognized Developer
Aug 24, 2011
136
2,643
I just released Loki, a set of tools for developers and users to flash custom kernels and recoveries on the AT&T and Verizon branded Samsung Galaxy S4.

The tool is available at:
https://github.com/djrbliss/loki

The technical details on how the exploit works are described at:
http://blog.azimuthsecurity.com/2013/05/exploiting-samsung-galaxy-s4-secure-boot.html

This is a support thread that I will check regularly until I decide to hand over support to the community. Feel free to ask any questions, and I may add the answers to this post. As a guideline, if it's a question that's already been answered in this thread or in the README for Loki, I will ignore it.


Does this make any permanent changes to the device?

No permanent changes are made to your device when using loki_flash. The bootloader itself is untouched. By restoring the original system, boot, and recovery images (via Odin or otherwise), the device will be in a stock state.

Can this be patched?

Absolutely. Any update that includes a new aboot will almost definitely cause your custom kernel or recovery to fail to boot without running it through loki_patch again, and if the update contains a fix for the vulnerability Loki exploits, it may permanently prevent using the tool. It's possible for Samsung to ship an update that prevents downgrading aboot to a vulnerable version, so I recommend avoiding installing any OTA updates without confirmation that it's safe.

What about the bounty?

As usual, I encourage anyone looking to donate (as part of the bounty or otherwise) to give their money to a reputable charity organization instead. If you insist on donating to me, I'm sure you can find my Paypal account somehow. ;)

This all seems complicated. What about a step-by-step guide?

These tools are primarily intended for developers, who will be able to use them and provide ordinary users with easy ways to flash custom ROMs. Be patient, I'm sure your favorite ROM developer will come up with something for you.

I've installed a Loki-patched recovery. Can I just install regular custom ROMs now?

Any ROMs that include a replacement boot.img must be modified to include a Loki-patched boot.lok file instead. Otherwise, your phone will fail to boot until you restore a Samsung-signed boot.img or a custom boot.lok image via your custom recovery, or flash a stock image via Odin.

So this is just like kexec?

This is similar to kexec in that it works around a locked bootloader, but this approach is much more flexible and robust. Kernel and recovery developers can build their projects just as they would for an unlocked device, run the final result through Loki, and then it's ready to be flashed. No hackery and brokenness required.
 
Last edited:

fix-this!

Senior Member
Apr 15, 2012
4,263
736
midwest
is this similar to htc dev which doesn't truly unlock "s-off" the device? i assume your method just circumvents the locked bootloader? the way i read what your tool accomplishes is for us to flash a recovery and kernels but doesn't actually touch the locked bootloader status?

thanks for your work. also let the games begin!
 
  • Like
Reactions: knottee

breakingspell

Senior Member
Dec 1, 2010
405
133
By the time I get back from work, I'm pretty sure there'll be at least two recoveries and three roms prepared :D
 

fix-this!

Senior Member
Apr 15, 2012
4,263
736
midwest
so we can flash a recovery and kernels with this tool but what about radios? can those be flashed with a locked bootloader? i swore they couldn't.
 

Khalsa4G

Senior Member
Mar 24, 2011
300
20
NYC
You are the MAN. A charity will be finding my donation per your recommendation.

Thanks again for all the great work.
 

mattdm

Senior Member
Dec 31, 2011
1,422
447
Oh man, I'm dying here. I don't get off work for another ~6 hours! And I don't have admin access on my work computer, so no adb.

So, we have a patched recovery now, but custom kernels also have to be patched, correct? So it would be a bad idea to adb the recovery and then immediately try to use it to flash one of the roms that are already out there?
 
Last edited:

fix-this!

Senior Member
Apr 15, 2012
4,263
736
midwest
Oh man, I'm dying here. I don't get off work for another ~6 hours!

So, we have a patched recovery now, but custom kernels also have to be patched, correct? So it would be a bad idea to adb the recovery and then immediately try to use it to flash one of the roms that are already out there?

i wouldn't try flashing any roms yet.
 

brojoe11

Senior Member
Jul 9, 2011
456
124
Forest, Mississippi
YES!YES!YES!

Dan, You are The Man!!! Thank you so much. May your thanks meter need a fire extinguisher before the day is done....lol.:D:D:D:good::good::good::highfive::highfive::highfive:
 

AxAtAx

Senior Member
Mar 14, 2011
13,116
20,412
ViSiON,Texas
did a nadroid backup, and it is doing multiple archives, is there a setting I missed?

nevermind, I stand correct, nice, very nice, thanks goes out to everyone involved.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 402
    I just released Loki, a set of tools for developers and users to flash custom kernels and recoveries on the AT&T and Verizon branded Samsung Galaxy S4.

    The tool is available at:
    https://github.com/djrbliss/loki

    The technical details on how the exploit works are described at:
    http://blog.azimuthsecurity.com/2013/05/exploiting-samsung-galaxy-s4-secure-boot.html

    This is a support thread that I will check regularly until I decide to hand over support to the community. Feel free to ask any questions, and I may add the answers to this post. As a guideline, if it's a question that's already been answered in this thread or in the README for Loki, I will ignore it.


    Does this make any permanent changes to the device?

    No permanent changes are made to your device when using loki_flash. The bootloader itself is untouched. By restoring the original system, boot, and recovery images (via Odin or otherwise), the device will be in a stock state.

    Can this be patched?

    Absolutely. Any update that includes a new aboot will almost definitely cause your custom kernel or recovery to fail to boot without running it through loki_patch again, and if the update contains a fix for the vulnerability Loki exploits, it may permanently prevent using the tool. It's possible for Samsung to ship an update that prevents downgrading aboot to a vulnerable version, so I recommend avoiding installing any OTA updates without confirmation that it's safe.

    What about the bounty?

    As usual, I encourage anyone looking to donate (as part of the bounty or otherwise) to give their money to a reputable charity organization instead. If you insist on donating to me, I'm sure you can find my Paypal account somehow. ;)

    This all seems complicated. What about a step-by-step guide?

    These tools are primarily intended for developers, who will be able to use them and provide ordinary users with easy ways to flash custom ROMs. Be patient, I'm sure your favorite ROM developer will come up with something for you.

    I've installed a Loki-patched recovery. Can I just install regular custom ROMs now?

    Any ROMs that include a replacement boot.img must be modified to include a Loki-patched boot.lok file instead. Otherwise, your phone will fail to boot until you restore a Samsung-signed boot.img or a custom boot.lok image via your custom recovery, or flash a stock image via Odin.

    So this is just like kexec?

    This is similar to kexec in that it works around a locked bootloader, but this approach is much more flexible and robust. Kernel and recovery developers can build their projects just as they would for an unlocked device, run the final result through Loki, and then it's ready to be flashed. No hackery and brokenness required.
    15
    Thank you very much!!!!

    Sent from my SAMSUNG-SGH-I337 using Tapatalk 2
    15
    Question... what is the benefit to using this method versus an actual unlock? Im honestly just trying to learn and understand.

    Sent from my SCH-I545 using Tapatalk 2

    The biggest benefit is that this actually exists, and the other doesn't.

    Also, there are some perks to not permanently modifying the hardware, such as not setting off any irreversible "warranty voided" flags. Note: I do not encourage warranty fraud in any way.
    13
    Thats good to know!

    Will Nandroids and such be able to flash? Does the backups use loki also when created?

    You'll definitely be able to flash a Nandroid backup for everything except for the recovery and boot partitions. As for recovery and boot, I suspect that would work fine (assuming the aboot hasn't changed), but I don't know for sure, so I don't encourage you to try it unless you really know what you're doing.
    12
    Hey Dan, I remember a few weeks ago you had posted a photo of AT&T Galaxy S4 on your twitter that had a cracked code listed on the device. Was this the same Loki method or you were able to actually hack into the bootloader?

    I'm not sure what you mean by "actually hack into the bootloader". Loki allows me to execute code in the context of the bootloader, which is pretty much the definition of "hacking" it. For the picture, rather than booting a custom kernel or recovery, I had my code cause the bootloader to print that teaser message. So yes, it was the same method, just a different payload.