|
PS3 Metldr Exploit been leaked
|
|
biglo30
Senior Member
|
13. November 2011 @ 20:36 |
Link to this message
|
Seems this was mathieulh's exploits. Still haven't heard any sites reporting that any of them work as yet.
Quote: Because some ungrateful person leaked my metldr exploit files I will now be explaining how it actually works, see this as my ultimate release of all times for an ungrateful scene (and scenes in the future)
That's about how I am pissed right now, because of course the person that leaked these files has no idea of how they actually work.
How to pwn metldr the "easy" way:
This is most likely how ****** exploited it in the first way, this takes (give or take) about 10 minutes to be performed. (yeah, not so much of a "I hacked the ps3 all on my own work, especially not when it partially relies on Segher's work, one of the reason ****** never shared the way he exploited metldr to anyone)
I will assume here, that you do not have the loader keys that were made readily available by ******. This little tutorial also assumes that you have a working .self generating tool
Now You want to gain code execution to metldr, you know that metldr loads loaders to its own space, but you cannot run a loader because the loader needs to be signed and even though you know about the sign fail that Segher introduced at the CCC, you cannot use it because you don't have decrypted signatures to calculate a private key and to get signatures you need keys which you are currently trying to dump, so far you are stuck in a chicken and egg scenario.
The question is, do you really need keys to get a decrypted signature ?
Well the real answer is no, thanks to a nifty fail that sony left in in metldr (and the bootloader), you can have the ldr to decrypt the metadata for you, isn't that neat ?
Here's how it works:
STEP I)
In a self file, at address 0x0C a value is used to calculate where the metadata is going to be decrypted, the "offset" is at self header + 0x0C
its the "meta header offset" in the SCE structure, it takes the SCE offset + that value, so what you have to do is to have a calculation that is equal to 0x3E01F0 which happens to be where metldr copies over the shared metadata from the mailbox (which is sent over by the ppu), the trick is to have metldr to decrypt the metadata located at.
So basically you have to
1) set the offset += 0x2000
dump shared lsa
and keep increasing 0x2000
until somewhere in the shared lsa changes 0x40 byte
2) when it changes 0x40 bytes, you can add/subtract the proper amount to make it decrypt the proper locations
3) then dump shared lsa and we have decrypted header
knowing that metldr uses SCE header 0xECF0, you could calculate it knowing the address 0x3E01F0 - 0xECF0 = the value you would patch at SCE header + 0x0C
ROM:0000F6C0 D2 68 87 E6 metadata_erk: .int 0xD26887E6 ; DATA XREF: ROM:0000F178o
for example in CECHA , the address you want to decrypt it to is 0x3E1F0
so it should be 0x3E1F0 - 0xF6C0
Once you get the decrypted header, you have the key to decrypt the rest of the metadata. Here you go, you have your decrypted signature.
So far so good, now what's next ?
STEP II)
Contrary to popular beliefs, you do not need to know the public key to calculate the private key, you just need two decrypted signature, you now know how to dump these, so let's assume you just did, now all you have to do is to bruteforce the curve type by constantly reloading a self to metldr, the curve type being only 1 byte, that would be 64 possibilities.
CONGRATULATION, you just signed a loader !
Now what ?
Well Your first reflex would be to sign a loader and use it to dump whatever is in your Isolated Local Store, the first thing you will notice is that you have a bit of metldr's code as a leftover, after a few seconds of disassembly you will figure it's actually some piece of code that clears metldr's code and registers and jumps to some address which is matches your signed loader's entrypoint.
This seems like a more than likely candidate to exploit, as in your goal would be to overwrite that piece of code with your own, that way you would have the whole metldr code right before the point where everything gets cleared out.
Let's try to do just that, from your previous dump, you obviously know that the clear code is located from 0x400 to 0x630, (0x410 being where metldr jumps when it clears) your first attempt would naturally be to have a loader section to load at 0x400, well not so surprisingly, it fails, because you are not without a brain (at least you aren't supposed to be if you're reading and understanding this), you will assume that it is likely that metldr checks if you aren't loading your loader/self section below a certain address, which considering you know the loaders' entrypoint is most likely to be 0x12C00, this assumption is in fact correct as metldr will make sure you cannot load any loader at 0x12BFF and below, seems like a huge let down...
Well, maybe not, because yet again, you are not without a brain, you check out the hardware properties for the Local Store, and you find out that the memory wraps around (memory is a donut as someone once said at some ccc conference).
So what happens when you load your loader at let's say from 0x3F000 to 0x40000+some address? (like 0x40410 for example) ?
Well, it WORKS!
You could put the section at 0x3F000, if you made the length 0x1414 and the last instruction branches "up" to the dump code
ROM:000008AC 33 7F 6C 80 brsl lr, cleanup_and_jump_entry
ROM:000008B0 32 00 11 80 br loc_93C
ROM:00000410 cleanup_and_jump_entry: ; CODE XREF: main+4Cp
ROM:00000410 32 7F FF 80 br sub_40C
this is what the exploit that got leaked (yeah that's not really their work eh but you figured that much by now did you not? ) does.
It overwrites from 0x000 to 0x480 because I originally loaded the section o size 0x880 to 0x3FC00
So now you get code execution on metldr at the best time possible because your code executes right after metldr copies the root keys from 0x00 to 0x30, which means you get to dump these too. (Although they are hardcoded in metldr's code anyway)
Here you go, you have a metldr dump !
Now as a final line, I'd like to say screw leakers, screw the scene, and this is my last contribution to it EVER. It seems I can't even trust fellow developers to keep my work safe and not leaking it. (Not like any of them would have been able to tell you how all this even works in the first place)
So long, everyone.
Remember, don't ever bite the hands that feed you.
P.S. Oh! and btw, if you talented enough to make hardware to dump the shared lsa, you can decrypt any lv0 using this technique.
lunuxx's tutorial on how to use math's exploit:
Quote: Update #2 (11/8/2011):Here?s a news tip from one of our guest named ?Warning?.
Warning says:
This is from scene star lunuxx:
?well it works
go get your root key
http://pastebin.com/8ZCqqsQq?
Now we just need A way to do it our selves without having to install linux on our ps3.
They are different for each ps3.
lunuxx was just showing us that it is possible and safe to try.
It also gives us reference to what a proper dump should look like.
Update #3 (11/9/2011): Developer lunuxx has released a tutorial on how to obtain your PS3′s root keys:
lunuxx says:
ohai ill tell you guys howto use mathldr
(i like to call it that, its kinda catchy)
prerequisites:
1. otheros++ with ss patches (yes the ones that cause trophy errors, just update when you wanna play games again and dont complain)
2. linux on your ps3 (im using ubuntu 10.10)
3. a unpacked copy of your flash (which you can obtain by using glevands dumpflash.pkg gitbrew.org/~glevand/ps3/pkgs/dump_flash.pkg) and an unpacked copy of ofw you will need the following files:
metldr
isoldr
RL_FOR_PROGRAM.img
EID0 (you will need to split eid from your flash http://www.ps3devwiki.com/index.php??s#dump_EID0.sh)
spp_verifier.self
default.spp
and obviously appldr-metldrexploit350.self from the files
3. latest gitbrew linux kernel
4. a desire to quit *****ing and complaining and get off your ***.
************************************************** ************************************************** ******************************
you can do this over ssh or on console I prefer ssh because my girlfriend likes to watch tv alot.
1. ssh into the ps3
2. download the files
a. wget http://gotbrew.org/metldr838exploit.tar.gz
3. untar the files
a. tar -xvf metldr838exploit.tar.gz
4. enter the directory and compile
a. cd metldr838exploit.tar.gz; make
5 run the following commands now:
insmod ./metldrpwn.ko
cat metldr > /proc/metldrpwn/metldr
cat appldr-metldrexploit350.self > /proc/metldrpwn/mathldr
cat RL_FOR_PROGRAM.img > /proc/metldrpwn/rvkprg
cat eid0 > /proc/metldrpwn/eid0
echo 1 > /proc/metldrpwn/run
cat /proc/metldrpwn/debug
there now you have a dump check it out:
hd/proc/metldrpwn/dump | less
now copy the dump somewhere or youll lose it:
cp /proc/metldrpwn/dump /home/username/
there you go root keys are in 0×00 to 0×20 (first 3 lines)
example:
root erk: #
00000000 66 4d ee 51 65 6f 68 28 38 98 83 ea df ea 90 04 |fM.Qeoh(8??.|
00000010 01 f3 79 09 d6 a6 52 d9 ea 6d ef 04 51 69 ec 7b |..y?R..m..Qi.{|
root riv:
00000020 7d 6a 3a e5 37 ba 48 4c fe bd 26 5c f5 b1 28 1f |}j:.7.HL..&..(.|
btw this does not mean you get 3.60 keys etc or newer games but it will help you get some nifty things to do some new stuff?. also please be advised that if you are on 3.60+ you will need to downgrade with a flasher to do this, also if you have a unit that shipped from the factory with the metldr.2 (new metldr) your sol at the moment
oh thanx math
Source:
Quote: http://jailbreakscene.com/main/2011/11/a-new-metldr-exploit-for-ps3/
here are his responses to the questions/doubts of the members over there:
Quote:
Quote: Originally Posted by afiser
"this technique" does not imply this particular metldr exploit. he made a big thing out of it because it was his work, which he put time and effort into and he wanted proper credits for. obviously.
Just so you know, the first exploit from my post, which I like to call the "meta exploit" which allows to decrypt the metadata directly in the shared LS works on the bootloader.
Quote:
Quote: Originally Posted by afiser
isoldr is loaded wayyy after bootldr. per_console_key_0 decrypts bootldr, nothing loads bootldr, its just the first piece of code ran when the cell is turned on.
There is most likely a bootrom or a crypto engine that decrypts and load the bootloader/metldr.
Quote:
Quote: Originally Posted by TheFrogEater
math do you think ur exploit can be use to get the keys for cfw ?
salut mat il est impossible de t'envoyer un mp donc je te le dis ici, je trouve que t'es vraiment fort et je te remercie pour ton travail aussi bien que récent que passé (psp etc).
tu penses que ca pourrait apporter quoi a plus ou moins long terme ?
The first one I published can be used in conjunction to a hardware hack to get the bootloader to decrypt lv0 for you, you can also calculate lv0's private key through this, this means you can decrypt lv0, encrypt lv0 using the existing decrypted metdata keys, and sign lv0, you just need to use a ps3 to go through the process of decrypting each lv0 revision though. Know that if you sign lv0 you can also use yet another exploit to gain code execution on the bootloader and dump the keys and be able to decrypt lv0 straight on pc.
Quote:
Quote: Originally Posted by Beharii
Math if all the loaders are loaded by lv0 since 3.56+ what's the use of metldr anymore, and is the per_console_key that is obtained from metldr the same as the one from bootldr since in the wiki it is only stated as per console key. I hope you don't mind answering these two questions since I couldn't figure them out in the wiki.
They are not loaded by lv0 they are simply embeded inside one of the lv0 segment in self format, lv0 copies them to the lv1 loaders' table on the xdr and then lv1 fetches them from ram and loads them through metldr just like on earlier firmwares.
There is a new distinction though, each ldr has its .2 such as appldr.2 which is a new metadata for the loader, if your console happens to have metldr.2, lv1 will feed it the .2 metadata generated with the metldr.2 keysets and private key with the original ldr data sections, metldr.2 will decrypt the *ldr.2 metadata and will use it to decrypt the matching *ldr data sections (so the data section keys match the ones from the original *ldr metadata)
Note that because the signature fail from Segher doesn't work for metldr.2 you cannot use the donut fail to pwn it because you cannot sign your own loader, making the new metldr.2 extreamly hard to exploit (though not impossible, to cut with the suspense it's just the good old metldr with a new keyset, a hardcoded 3.60 min version, compiled with a newer gcc, not much worth exploiting in the first place).
I don't want to make him good or bad, but he actually explained some stuff and it seems that all we need now is a hardware hack and bootldr would be done for. So in the end his exploit wasn't useless.
For all those who don't know what metldr or bootldr does check the ps3devwiki.
found this site, looks like someone actually succeeded dumping the root key, but I'm still waiting for a confirmation from math(that is if he replies).
HTML Code:
Quote: http://pastebin.com/8ZCqqsQq
UPDATE
Further instructions where he explains his two exploits, which he calls "meta exploit" and "donut exploit"
Quote: The first exploit I explained in Step I which I called the "meta exploit" is used to trick metldr into decrypting the self metadata in the shared Local Store (which can be accessed from the ppu as it's not isolated)
This exploit works on the bootloader (provided that you can read the shared local store at boot time)
The second exploit explained in step 2 (and used in the leaked files) which I called the "donut exploit" relies on wrapping around the memory to trick metldr into loading a self section onto its own code (and gain code execution), this exploit only works on metldr and doesn't work on metldr.2 because it relies on signing a loader. There is yet another ldr exploit that works on metldr (and metldr.2) and allows to gain code execution but it relies on an hardware implementation flaw and cannot easily be found, because it's not a software exploit (even though it can entirely be triggered by software so long as you at least have code running on the ppu with lv2 privileges)
None of this was written by me I just copied everything over here so its easier for the users here to have some news. ALL credits go to the original poster.
Source
This message has been edited since posting. Last time this message was edited on 13. November 2011 @ 20:40
|
|