yashsingh1/xdaforums huggingface dataset:
[Verizon Samsung Galaxy S 4] Cobaltikus:
Yes and no.

It's a chain process. Each process in the boot chain verifies the signature of the next step. The part we are focused on is sbl verifies aboot which verifies kernel. There's also something before sbl that verifies sbl. We can patch aboot so it skips the check for kernel, but then aboot's signature will be wrong and sbl won't load it. We have to patch aboot in such a way that it passes the signature check from sbl, and let's all kernels pass regardless. We could potentially do the same to sbl instead and not worry about the valid signature on aboot, but we have to make at least one step pass.
[Verizon Samsung Galaxy S 4] tulth:
awesome thanks! I read up on this more and I think I understand it better.

SoI think this means that the sbl is something we cannot alter. And it is checking the aboot against a signing with a private key. is this right? if so where does the public key reside and can we change it? is it also in unmodifiable sbl?
[Verizon Samsung Galaxy S 4] Walter.White:
[MENTION=4939386]Surge1223[/MENTION] [MENTION=766721]ryanbg[/MENTION] [MENTION=974229]Cobaltikus[/MENTION]

Not sure if you know about this secret menu.... there are some nice goodies in there that you might find helpful.

Dial *#9900#
[Verizon Samsung Galaxy S 4] Cobaltikus:
We can alter sbl with the same issues that arise with altering aboot, but aboot is what loads the kernel, so that's why aboot is our target. Each binary file/image: sbl, aboot, boot, has a signature, and a cert chain containing the public key used to verify .... its own image?.... no that wouldn't make a lot of sense... It's gotta be the to verify the next image in the chain... Is that what I've been doing wrong? Gah, thank you for discussion to get my mind turning in the right direction!

Check out this thread for a little background of my progress. http://xdaforums.com/showthread.php?t=2626189

Ugh I feel like an idiot now. I can't take the cert chain from the aboot to verify the signiture in the aboot. I need the cert chain from the sbl to verify the signature of the aboot image. The way I was doing it before doesn't make any sense. I got it now. At least for this step. There's still a ways to go. Maybe...

Well that didn't work... I'm back to my original thought that the public key in aboot is used to verify the signature in aboot. I wonder what would happen if I changed the whole key? Do you think it uses the key from the existing aboot image to verify the new image? Lots of stuff to test now.
[Verizon Samsung Galaxy S 4] Surge1223:
You're better off generating pseudo for aboot, and looking for a vulnerability there, maybe something in shared memory. Or ehostdl protocol. You are writing a plugin? I have wrote several (one currently I'm debating on pushing to git) I created one with visual Studio but after the PITA that was I just started using ida python instead.
[Verizon Samsung Galaxy S 4] Legitsu:
attacking the encryption is a waste of time even with a petaflop level system you aren't brutforcing SHA1 /W RSA Not in anything less then 10 years,I doubt there is much you are gonna be-able to spoof you need to compromise the chain of trust at a usable point
[Verizon Samsung Galaxy S 4] tulth:
I had another thought... does the ota update the pbl? if not could we maybe use the previous aboot memcpy vulnerability but this time craft a sbl2 rather than an aboot. what do you think?
[Verizon Samsung Galaxy S 4] Cobaltikus:
I'm not writing a plugin. I'm writing a standalone app, an ARM debugger, so I can step through the binary, follow branches, keep track of memory changes and registers, etc. Probably all things you could do with IDA python, but my current expertise is in .Net so I'm leveraging my strengths to help me learn and grow my knowledge of ARM assembly.

---------- Post added at 09:14 PM ---------- Previous post was at 09:02 PM ----------

You're probably right, but if someone wants to brute force attack the encryption, by all means please do so. I would do it. I have a spare pc or two I could let run forever. it only needs to run until it finds a match. it may take ten years, but it also may take a day. It's guess work. Nothing wrong with that. I wouldn't rely on it but it could be guessing while I'm studying.

Does anyone know where the signature and cert chain are in the AT&T Samsung Galaxy Note 3 ( NC2 or later ) boot.img?
[Verizon Samsung Galaxy S 4] tulth:
I think there is no cert needed in boot.img, only a signature. And this signature is decrypted to a hash with the cert/rsa key within aboot, and authenticated during aboot execution.

I am not sure where the signature lives. I have info on the mbn format, but I have not looked at IMG yet.

---------- Post added at 08:57 PM ---------- Previous post was at 08:45 PM ----------

I took a look and I am pretty sure this is the signature here, at 0x87A010 (at the end)

0087a000: 5345 414e 4452 4f49 4445 4e46 4f52 4345 SEANDROIDENFORCE
0087a010: 0aa3 36c0 f90f a958 1021 934d 2ac1 38f3 ..6....X.!.M*.8.
0087a020: d8db 097c 16bc 2e30 7b45 f3b7 0ea5 56c3 ...|...0{E....V.
[Verizon Samsung Galaxy S 4] dmt010:
Argh
[Verizon Samsung Galaxy S 4] Surge1223:
Yep you can also see how the boot chain is executed via dialing *#9900# after enabling hidden menu (as Walter white pointed out earlier) and enable sec log and set debugging to high. Then after a reboot or two grab seclog (you can find its address via 'cat /proc/cmdline' should say something like sec_log=0x100000@0x10000008) by using viewmem, for example viewmem 0x10000008 0x100000 >/sdcard/seclog.txt for the example above. You should be able to see how and at what addresses the boot sequence executed

For s4 it looks like this, should be quite different for n3 though.

{982832} sbl2_ddr_init
{982985} sbl2_hw_init_secondary, Delta
{985821} no backup trustzone memory!
{1080280} Image Loaded by SBL2, Start on 0x2a000000
{1080585} Tz Execution, Start
{1110627} Tz Execution, Delta
{1111176} RPM loading is successful.
{1187152} Image Loaded by SBL2, Start on 0x20000
{1273314} Image Loaded by SBL2, Start on 0x8ff00000
{1273345} SBL2, End
{1275358} Signal SBL1 to Jump to RPM FW
{1498129} sbl3_main_ctl
{1275937} SBL3, Start
{1276120} ram_init, Start
{1276334} ram_init, Delta
{1276700} sbl3_hw_init, Start
{1276822} sbl3_hw_init, Delta
{1276974} boot_flash_init, Start
{1302472} boot_flash_init, Delta
{1302625} boot_smem_init, Start
{1303113} boot_smem_init, Delta
{1303235} sbl3_hw_init_secondary, Start
{1404464} sbl3_hw_init_secondary, Delta
{2077538} Image Loaded by SBL3, Start on 0x88e00000
{2077752} sbl3_efs_handle_cookies, Start
{2078636} sbl3_efs_handle_cookies, End
{2078758} sbl3_wait_rpm_boot, Start
{2078911} sbl3_wait_rpm_boot, Delta
{2079063} sbl3_rollback_version_update, Start
{2079887} sbl3_rollback_version_update, End
{2087847} SBL3, End
[0] welcome to lk
[Verizon Samsung Galaxy S 4] Tech 4 9:
All the effort here is greatly appreciated.
[Verizon Samsung Galaxy S 4] tulth:
Surge, awesome,

that confirms alot of the data i see in the I545VRUFNK1_I545VZWFNK1_I545VRUFNK1_HOME.rar set

Looks like SbL2 (code base: 0x2e000000) does it in this order:

TZ (code base: 0x2a000000, 'cert_chain_size': 12288,'code_size': 204228,)

rpm (code base: 0x20000, 'cert_chain_size': 12288,'code_size': 140856,)

sbl3 (code base: 0x8ff00000, 'cert_chain_size': 12288,'code_size': 257824,)

aboot (code base: 0x88e00000, 'cert_chain_size': 12288,'code_size': 1370884,)

all of them have a 256 byte signature as well.

What do you think of the idea of trying the investigating aboot memcpy vuln earlier in the chain?

Can they really do an OTA update of PBL/SBL1? Have they?

I would like a copy of the sbl1/pbl decompile if any have it.
[Verizon Samsung Galaxy S 4] Cobaltikus:
From my Note 3

LK Area: 0xF800000 - 0xFA00000
Kernel Addr: 0x8000
Ramdisk Addr: 0x2000000
Second Addr: 0xF00000
Tags Adddr: 0x1E00000
use_signed_kernel=0, is_unlocked=0, is_tampered=0.
Loading boot image (9256960): start
Loading boot image (9256960): done

I was not expecting to see use signed kernel = 0....

It doesn't check a signature...

According to LK aboot.c this looks like it skips the signature check altogether. ..

I'm running stock NC2 rooted with towelroot...

Does this mean I can boot a custom kernel?

---------- Post added at 03:12 AM ---------- Previous post was at 02:59 AM ----------

I have different bytes at that location. Which boot.img are you looking at? I'm looking at NC2 boot.img for AT&T Note 3.

Thanks to [MENTION=5575828]Walter.White[/MENTION] for the logging and [MENTION=4939386]Surge1223[/MENTION] for the viewmem info. Very very helpful!
[Verizon Samsung Galaxy S 4] zmedhaug:
I'm going to sound completely dumb here I'm sure but what about going back to basics? Completely delete trust zone. Get rid of the check. Delete the check in both aboot and sbl1. Nothing would check anything.
[Verizon Samsung Galaxy S 4] tulth:
I am looking at the verizon galaxy s4 SCH-I545 vrufnk1

On my phone I am pretty sure that the aboot checks the qfuse rom and sees that the phone is in secure mode that requires a signed kernel.

---------- Post added at 06:43 AM ---------- Previous post was at 06:38 AM ----------

i wondered the same but i think it won't be work because the the whole boot process starts from a read only memory that checks the signing on the primary boot loader for a qualcomm private key signing
[Verizon Samsung Galaxy S 4] ahmed.zubair:
Thats All going over my head :confused: . Want to learn but a bit lazy.. :p
[Verizon Samsung Galaxy S 4] will1417721:
I was talking to one of my gamer modder friends and he was said something about going from the inside of everything and using an virus to point out where the places are where we could get through. I will get more information from him so I can update my post. Has anybody tried a virus way?
[Verizon Samsung Galaxy S 4] jcase:
Your modder friend is confused and/or doesnt know what he is talking about
[Verizon Samsung Galaxy S 4] Legitsu:
can you clean this thread up mr mod

I get that people are eager to help but unless you have at decent understanding of what needs to be done, please refrain from posting it slows the whole process down when you post utter non-sense. when we need to sort though 200 pages of mostly crap then it just is discouraging

I have a couple of S4's here ill see about dumping the certs when I get a chance I doubt there is gonna be anything usable. cert spoofing is looking like its possible but we still need to find a usable poi + A way to sign code in such a way that it passes the integrity check,which is neigh of impossible

-that being said some of those addresses do look interesting .. particularly some of the offsets ... may be vulnerable to either memcpy or some kind of bitrot/active row attack
[Verizon Samsung Galaxy S 4] zmedhaug:
Is it going to be impossible to write to the read only section, I mean common sense tells me that's where the verification starts. If verification didn't start we could drop any boot process.

I know it's read only, what would it take to bypass read only?
[Verizon Samsung Galaxy S 4] npjohnson:
What I don't think you are understanding is that we can't flash any partitions that aren't signed.... period. As for "deleting" the trustzone... I don't think you realize what all trustzone actually does, the phone would not boot if the trustzone was not present, plus, the trustzone isn't like a file you can delete, its an implementation secure memory, which means it cannot be "deleted". The secure memory is used to run functions that are intended to not be messed with, hence secure memory.

The verification starts at a hardware (microscopic) level, meaning that if your qfuse is set, no unsigned partitions can be flashed, and even if you found a way to flash them, they wouldn't boot.

And to throw something out there, no, it is not as simple as just coping the signatures into place, first off, good lick finding them, and second, you can append it without Samsung Private Key, and no one but Sammy has that.
[Verizon Samsung Galaxy S 4] Legitsu:
The Best We Can hopefore is getting custom kernels either via exec/ksplice or some other expliot

either that or somebody leaks the samsung private key (Not likely)
[Verizon Samsung Galaxy S 4] Legitsu:
see here

http://xdaforums.com/showpost.php?p=31622172&postcount=9

the shadow contains some error correction
[Verizon Samsung Galaxy S 4] Cobaltikus:
The Verizon S4 NC5 aboot.mbn signature when decrypted is this: [8A 82 E9 37 80 74 A4 53 4B 08 4C 99 DC DD 23 4C DF AD 1C BE 7D DC F2 6A 78 65 7A 3B 5E FD E7 D9]

Which looks like a SHA256 hash, but of what?

The SHA256 hash of the code section of aboot.mbn is [38 8A F2 B6 6C FD B0 CA 31 32 FF A5 01 E0 07 71 97 54 66 53 BE 5C 3B 6B 4D 64 7E A1 1A 30 39 61].

I could list a bunch more SHA256 hashes from other binary sections and full binary files, with and without headers, all that don't match, but I think you get the point.

So what is the signature a hash of?

It's the same situation with the Note 3. The signatures decrypt to a SHA256 hash, but I can't seem to find where the hash came from.

I can figure this out on my own eventually with more in depth reversing, but if anyone already knows for sure, please chime in as it would help a great deal.
[Verizon Samsung Galaxy S 4] RuggedHunter:
Check with [MENTION=766721]ryanbg[/MENTION] ?

http://xdaforums.com/showthread.php?p=50244780

AT&T S4 i337 > SafeRoot > SafeStrap 3.71 > HyperDrive RLS12

Tasker-ized
[Verizon Samsung Galaxy S 4] tulth:
I'm not sure what they do, but to be cryptographically secure the hash should include the mbn header, the code image, and the certs. If they are lazy maybe its the whole mbn with zeros in the signature section.

Also you have me wondering... I thought they were using sha1... but sha1 is only a 20 byte hash.

---------- Post added at 10:35 AM ---------- Previous post was at 10:31 AM ----------

Thanks I will have to check that out! Also as a follow-up I think the 0x706000 shadow is correct.

Also i suspect that each bit in the fuse region starts at zero and may be permanently blown to a 1 state. that is why our qfuse locknum went from 1 to 3 rather than 2. This would mean the next step is 7 not 4.
[Verizon Samsung Galaxy S 4] SamuriHL:
The cid partition. They generate a hash of it using their private key and append it to aboot.
[Verizon Samsung Galaxy S 4] ryanbg:
Fuses are at 0xFC4B8***
[Verizon Samsung Galaxy S 4] Cobaltikus:
So first, generate the SHA256 hash of the cid partition. Then append that to the code portion of aboot. Then generate another SHA256 hash of that, and that should match the decrypted signature in aboot?
[Verizon Samsung Galaxy S 4] SamuriHL:
In theory. That's how they unlock Dev Edition devices. And why they can't be upgraded as each aboot is customized to the device.
[Verizon Samsung Galaxy S 4] tulth:
whoa wait... you can load custom kernels on the dev phone right, ie no signature check on boot.img?

so technically if we flashed the full dev boot chain and a particular dev CID to a retail it would load custom kernels i think! i wonder if there are any practical uses to this?
[Verizon Samsung Galaxy S 4] G.moe:
Theoretically, if that's how the dev boot chain behaves, then it will behave the same on any device that you can manage to get it 100% working with. That's the problem though; you're going to have a hard time getting it in place, and an even harder time getting it to function. As was stated above, the hashes are crafted per hardware, and as such, you wouldn't even be able to get your boot chain functioning on another developer device of the same model. The OP sums this up actually:

Basically, we're used to seeing a situation where "sector Y" is verifying the "incoming Z", but in the case of dev devices, Y is verifying the "sector X" which comes BEFORE itself.
[Verizon Samsung Galaxy S 4] SamuriHL:
Yes. You can't take an aboot from another device and use it to unlock anything. The signature embedded in aboot won't match the cid on the device and will fail the signature check. People have done this to their dev editions before and successfully turned them into retail devices. It's a "simple matter" of extracting the cid partition, signing it with Samsung's private key, and appending it to aboot. Hahaha. Glwt.
[Verizon Samsung Galaxy S 4] Cobaltikus:
I am having trouble finding the cid partition on my Note 3. And I don't have an S4. Is there an S4 cid partition dump I can access online somewhere? I'd like to study one.
[Verizon Samsung Galaxy S 4] SamuriHL:
It's not something that should be shared. It's unique to the device so sharing it is a very bad idea.
[Verizon Samsung Galaxy S 4] Cobaltikus:
Ok now I'm confused, as some information given seems to contradict.

Given that the CID partition is unique per device, I fail to see how it could possibly be used to generate the signature embeded inside aboot.mbn when aboot.mbn, as a whole, including this embeded signature, is quite definitely not unique per device. Which brings me back to my previous question:

A SHA256 hash of "something currently unknown to me" is encrypted using a private key that we do not have. That encrypted hash is the signature embeded inside aboot.mbn and is the same for everyone, unique only to the Baseband Version. This signature/encrypted hash can very easily be decrypted using the public key which is also embeded inside aboot.mbn. (So why encrypt it in the first place? idk. moving on). The verification process decrypts the signature using the provided public key revealing the SHA256 hash of "something currently unknown to me". This verification process does know what the hash is of, and it has access to everything it needs to generate the expected hash. It does this and then compares the result with the one embeded inside aboot.mbn, which is not unique per device, so it couldn't be generated from something is unique per device.

If CID is unique per device and should not be shared, how can I access my own? I saw where some Motorola phones listed a cid partition when using gdisk or parted, by my phone does not show any partition by that name. Could it go by another name?

Pretend for a moment that you suddenly came across the Samsung Private Key used to sign aboot.mbn. So you alter aboot to do what you want, like break the verification chain, and now you are ready to sign it. How would you sign it? Well you would first need to generate the hash that no one seems to know how to generate, then you would encrypt that hash using the Private Key you found, and append that to aboot, along with the cert chain. So you would still be stuck and the private key would do no good.
[Verizon Samsung Galaxy S 4] tulth:
Ok, I have a question: I have seen people say we cannot flash our aboot and before (sbl2, etc).

I think this means....

1) Its unchangeable because they are all verified in a trust chain from the rom. So if one were altered, the phone would never boot. And it would be somewhat bricked because Loke/Odin resides in aboot, and if it never reaches this stage due to trust fails, it would be difficult to recover.

2) Less certain about this: does the aboot loke/odin verify signatures on anything you try to flash using the odin tool?

3) I think the boot loader partitions (except for PBL) can be changed using "dd if=<file> of=<partition>", but as stated in #1, doing this will brick your phone unless you have a utility that can flash at a lower level than odin.

Is the above correct or is there some additional measure that prevents us from using dd on partitions?

I am curious because: if we can find a vulnerability in earlier boot stage partitions (say, SBL1), can we ultimately have some brave soul try flashing it, or are there other roadblocks to this not in the 3 listed above? I.e. should I even bother decompiling and analyzing boot loader code?
[LG Optimus Me P350] soupmagnet:
Please be respectful and observant of all XDA rules, as well as towards each other.

Please use the links below if you have any questions about content you wish to post, or need help from the Moderator Staff.

Best Regards: Your Friendly Moderation Team

XDA Developers Forum Rules

Moderation Team

Rules for posting Development Threads

XDA-Developers and the GPL

Regarding Paid Themes On XDA

***WARNING*** Do Not Spam, Sell or Trade on XDA

Telegram Chat Channels - WayForward

Spoiler content hidden.
[Galaxy Ace II General] str3tch72:
Hello, I have a little tutorial for You ;)

[MENTION=4947931]Rox[/MENTION] give this solution for us, so give him "thanks" ;)

If Your phone have broken internal memory (like me after flashing CM10.2 nightly 26/10):

1. Use odin to flash stock firmware

2. Flash d-kernel for stock via terminal (see procedure in d-kernel thread)

3. Flash Your favourite rom using cwm recovery build in with d-kernel

4. Enjoy your phone again :)

For me recovery is working now, maybe with Your phones it'll be working

Regards, str3tch72 ;)
[Galaxy Ace II General] billy.anderson:
Hi,

I don't have broken internal memory after flashing CM10.2 nightly 26/10, but build 26/10 and latest nighlty won't booting (stuck at Galaxy ace 2 logo), so i am rolling back to cm10.1.

But thanks for this usefull tips, saved to my memos ;)
[Galaxy Ace II General] cilixan:
very useful bro.. :D
[Galaxy Ace II General] str3tch72:
Maybe I save someone's phone :)
[Galaxy Ace II General] Kilstor:
Can you flash root with odin on jb? Because you need root for terminal :( and my recovery doestn detect my sd so i cant flash root on recovery
[Galaxy Ace II General] str3tch72:
Maybe on adb? Try it.
[Galaxy Ace II General] Kilstor:
I never used adb before can you maybe help me ?
[Galaxy Ace II General] str3tch72:
I sugesting only, I don't know how to use adb :(
[Galaxy Ace II General] Kilstor:
Ah well thanks anyways
[Galaxy Ace II General] jordirpz:
Ok.

Use this metod for root your ace2(recomended read all tread. Only 3 pages)

Unzip d-kernel and install via universal kernel.

Reboot in recovery

VIVA!!! you now can read sd card another time.

Enviado desde mi GT-I8160 mediante Tapatalk

---------- Post added at 09:30 PM ---------- Previous post was at 09:29 PM ----------

http://xdaforums.com/showthread.php?p=4

Enviado desde mi GT-I8160 mediante Tapatalk
[Galaxy Ace II General] Kilstor:
Your link is not working sir.
[Galaxy Ace II General] jordirpz:
Write un google search

[APP][ROOT]android 4.1.2.Rooting universal Method

Enviado desde mi Nexus 7 2013
[Galaxy Ace II General] jordirpz:
Here vídeo

https://www.youtube.com/watch?v=QCBLOhWavT0&feature=youtube_gdata_player

Enviado desde mi Nexus 7 2013
[Galaxy Ace II General] Kilstor:
Thanks i'm gonna try it now

EDIT: IT WORKED thanks man :D
[Galaxy Ace II General] str3tch72:
Guys, version from 31/10 working without problem or it stuck on Samsung bootsplash?
[Galaxy Ace II General] Rox:
i am 99,99% sure it will boot xD
[Galaxy Ace II General] str3tch72:
I will trust You xD
[Galaxy Ace II General] bahate:
Tried to root my ace2 with this method, but it not works. The program wont recognize my phone, show me some error on Korean language :confused:
[Galaxy Ace II General] Kilstor:
Hmm VRoot doesn't work for me anymore is there an other way to root my phone?

My recovery is still broken. :(
[Motorola Atrix 2] soupmagnet:
Opening this post should automatically redirect you to another thread on the forum. If you are reading this note, it probably means that you are using a mobile app. Apparently, mobile apps have a problem with redirection and show this post instead. Use the link below to see the welcome message from the forum moderators...

http://xdaforums.com/showpost.php?p=46847787&postcount=1
[JASJAR, XDA Exec, MDA Pro General] FOSA:
I'm using a QTEK 9000. Can somebody confirm on their JJ/O2 EXEC/ Dopod 900

1) If a webpage has more than 10 frames you cannot open it

Here's the test

Go to www.numion.com. Start the test by selecting Singapore sites. Run it and a message box will pop-up saying the site exceeded 10 frames

2) If the set is being connected to your notebook through USB (with Activesync disconnected) and its being charged you cannot surf the internet usng either Wi-Fi or G/U (whatever that appears on the top bar). Have not test using AC charger though.

Thanks