Advertising (This ad goes away for registered users. You can Login or Register)

Marcan On PS3 Security In Light Of the lv0 Key Leak

Underground PS3 information and discussions
Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Posts: 81
Joined: Mon Oct 08, 2012 8:31 am

Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by ViRGE »

Marcan of Wii and PS3 hacking fame has made several interesting posts over at Slashdot. Rather than let them go unnoticed by most of the posters here, I've decided to paste them over here so that everyone can see what he said. In short, this is everything you wanted to know about the high-level workings of PS3 security but were afraid to ask.

A general overview of PS3 security, including how metldr, lv0, and bootldr fit into the picture
The first-stage bootloader is in ROM and has a per-console key which is effectively in tamper-resistant silicon. The second-stage bootloader (bootldr) is encrypted with the per-console key, but is not upgradable and is the same for all consoles (other than the encryption wrapper around it). This second-stage bootloader verifies lv0. Sony signed lv0 using the same broken process that they used for everything else, which leaks their private key. This means that the lv0 private key was doomed from the start, ever since we demonstrated the screwup at the Chaos Communication Congress two years ago.

However, because lv0 is also encrypted, including its signature block, we need that decryption key (which is part of bootldr) before we can decrypt the signature and apply the algorithm to derive the private key. We did this for several later-stage loaders by using an exploit to dump them, and Geohot did it for metldr (the "second root" in the PS3's bizarre boot process) using a different exploit (we replicated this, although our exploit might be different). At the time, this was enough to break the security of all released firmware to date, since everything that mattered was rooted in metldr (which is bootldr's brother and is also decrypted by the per-console key). However, Sony took a last ditch effort after that hack and wrapped everything after metldr into lv0, effectively using the only security they had left (bootldr and lv0) to attempt to re-secure their platform.

Bootldr suffers from the same exploit as metldr, so it was also doomed. However, because bootldr is designed to run from a cold boot, it cannot be loaded into a "sandboxed" SPU like metldr can from the comfort of OS-mode code execution (which we had via the USB lv2 exploit), so the exploit is harder to pull off because you don't have control over the rest of the software. For the exploit that we knew about, it would've required hardware assistance to repeatedly reboot the PS3 and some kind of flash emulator to set up the exploit with varying parameters each boot, and it probably would've taken several hours or days of automated attempts to hit the right combination (basically the exploit would work by executing random garbage as code, and hoping that it jumps to somewhere within a segment that we control - the probabilities are high enough that it would work out within a reasonable timeframe). We never bothered to do this after the whole lawsuit episode.

Presumably, 18 months later, some other group has finally figured this out and either used our exploit and the hardware assistance, or some other equivalent trick/exploit, to dump bootldr. Once the lv0 decryption key is known, the signing private key can be computed (thanks to Sony's epic failure).

The effect of this is essentially the same that the metldr key release had: all existing and future firmwares can be decrypted, except Sony no longer has the lv0 trick up their sleeve. What this means is that there is no way for Sony to wrap future firmware to hide it from anyone, because old PS3s must be able to use all future firmware (assuming Sony doesn't just decide to brick them all...), and those old PS3s now have no remaining seeds of security that aren't known. This means that all future firmwares and all future games are decryptable, and this time around they really can't do anything about it. By extension, this means that given the usual cat-and-mouse game of analyzing and patching firmware, every current user of vulnerable or hacked firmware should be able to maintain that state through all future updates, as all future firmwares can be decrypted and patched and resigned for old PS3s. From the homebrew side, it means that it should be possible to have hombrew/linux and current games at the same time. From the piracy side, it means that all future games can be pirated. Note that this doesn't mean that these things will be easy (Sony can obfuscate things to annoy people as much as their want), but from the fundamental security standpoint, Sony doesn't have any security leg to stand on now.

It does not mean that current firmwares are exploitable. Firmware upgrades are still signed, so you need an exploit in your current firmware to downgrade. Also, newer PS3s presumably have fixed this (probably by using newer bootldr/metldrs as trust roots, and proper signing all along).
On why the keys are being called lv0 keys and why that is wrong
Oh, one more thing. I'm assuming that these keys actually should be called the bootldr keys (as in the keys that bootldr uses to verify lv0), and that the name "lv0" is just a misnomer (because lv0 is, itself, signed using these keys).

If this keyset is just what Sony introduced in lv0 after the original hack, and they are used to sign everything *under* lv0 and that is loaded *by* lv0, then this whole thing is not newsworthy and none of what I said applies. It just means that all firmwares *to date* can be decrypted. Sony will replace this keyset and update lv0 and everything will be back at step 1 again. lv0 is updatable, unlike bootldr, and is most definitely not a fixed root of trust (unlike metldr, which was, until the architecture hack/change wrapped everything in lv0). If this is the case, color me unimpressed.
More on why the name of the keys is wrong
Nope, thats the point of the LV0 keys. They are literally the keys to the PS3's hardware loader. You can do anything with them. The only way to stop it would be to revoke them, and since they are tied to the hardware, that would in turn mean newer updates would not work on older machines. Basically, unless Sony plans to physically mail PS3 owners new hardware or break all backwards compatibility, they can't fix it. Any newer update can be cracked, period. It'd be impossible to use Sony's updates if they couldn't.
The name is presumably wrong - they would be the bootldr keys, as the keyset is considered to "belong" to the entity that uses those keys to check and decrypt the next thing down the chain - just like the metldr keys are the keys metldr uses to decrypt and verify other *ldrs, the bootldr keys are the keys bootldr uses to decrypt and verify lv0.

Anyway, you're confusing secrecy with trust. These keys let you decrypt any future firmware; as you say, if they were to "fix" that, that would mean new updates would not work on older machines. However, decrypting firmware doesn't imply that you can run homebrew or anything else. It just means you can see the firmware, not actually exploit it if you're running it.

The only trust that is broken by this keyset (assuming they are the bootldr keys) is the trust in lv0, the first upgradable component in the boot process (and both it and bootldr are definitely software, not hardware, but bootldr is not upgradable/replaceable so this cannot be fixed). This means that you can use them to sign lv0. Period. Nothing more, nothing less. The only things that these keys let you modify is lv0. In order to modify anything else, you have to modify everything between it and lv0 first. This means that these keys are only useful if you have write access to lv0, which means a hardware flasher, or an already exploited console, or a system exploit that lets you do so.
Marcan confirms that the key is actually the hardware-fixed key in bootldr used to verify lv0
Nevermind, I just checked. They are indeed the bootldr keys (I was able to decrypt an lv0 with them). Consider this confirmation that the story is not fake.
Can this be used to sign binaries to run homebrew on OFW PS3s (ala the PSP key leak)
Are those private keys sufficient to sign homebrew software such that they will run in unmodified firmware?
No. The keys are used for two purposes: chain of trust and chain of secrecy. The compromise of the keys fully compromises the secrecy of the PS3 platform permanently, as you can just follow the links down the chain (off-line, on a PC) and decrypt any past, current, or future firmware version. Current consoles must be able to use any future firmware update, and we now have access to 100% of the common key material of current PS3s, so it follows that any future firmware decryptable by current PS3s is also decryptable by anyone on a PC.

However, the chain of trust can be re-established at any point along the line that can be updated. The chain of trust is safely rooted in hardware that is near impossible to modify (i.e. the CPU's ROM and eFuse key). The next link down the chain has been compromised (bootldr), and this link cannot be updated as it is specific to each console, so the chain of trust now has a permanent weak second link. However, the third link, lv0, can be updated as it is located in flash memory and signed using public key crypto. This allows Sony to secure the entire chain from there onwards. Unless you find a vulnerability in these updated links, you will not be able to attack them directly (applications, e.g. homebrew software, are verified much further down the chain). The only guaranteed way to break the chain is to attack the weak link directly, which means using a flash writer to overwrite lv0. Once you do so, the entire chain collapses (well, you still need to do some work to modify every subsequent link to turn off security, but that is easy). If you have old firmware, you have at least some other weak links that, when compromised, allow you direct access to break the bootldr link (replacing lv0), but if you run up to date firmware you're out of luck unless you can find a weakness or you use hardware.

Old PS3s are now in the same boat as an old Wii, and in fact we can draw a direct comparison of the boot process. On an old Wii, boot0 (the on-die ROM) securely loads boot1 from flash, which is securely checked against an eFuse hash, and boot1 loads boot2 but insecurely checks its signature. On an old PS3, the Cell boot ROM securely loads bootldr from flash, which is securely decrypted and checked using an eFuse key, and then bootldr loads lv0 but checks its signature against a hardcoded public key whose private counterpart is now known. In both cases, the system can be persistently compromised if you can write to flash, or if you already have code execution in system context (which lets you write to flash). However, in both cases, you need to use some kind of high-level exploit to break into the firmware initially, particularly if you have up-to-date firmware. It just happens that this is trivial on the Wii because there is no game patch system and Nintendo seems to have stopped caring, while this is significantly harder on the PS3 because the system software has more security layers and there is a game patch system.
Posts: 81
Joined: Mon Oct 08, 2012 8:31 am

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by ViRGE »

Since Marcan's answers can be a bit difficult to digest, I've broken them up into the form of questions and answers. If the above was a bit too dense for you, hopefully this will be easier for you to understand.

Q: What exactly has been recovered?
A: The keys used by bootldr to decrypt/verify lv0, and by reversing the process the private keys used by Sony to sign lv0. If we consult our handy 3.60+ chain of trust diagram, we can see that bootldr is at the very root of the chain of trust, with lv0 being the first module it loads.

Q: So what can we do with the lv0 signing key?
A: In short, we can use it to decrypt lv0, modify it to patch out any lv0 security checks, and resign it with a legitimate key that bootldr will accept. With the chain of trust broken and lv0 no longer enforcing the security of the modules that it controls, we can then start modifying lv1ldr, lv2ldr, appldr, isoldr, etc to patch out their security checks and add CFW functionality.

Q: Can Sony "fix" this like they did for the 3.55 exploit?
A: To the best of anyone's knowledge, no. With 3.55 the keys metldr used to verify its dependent modules were recovered. So Sony simply stopped using the now-insecure metldr and started using bootldr (which was still secure) to load up everything instead. Sony doesn't have any more secure modules like bootldr left; without getting too technical, we now have the keys to every "common" hardware module that is able to decrypt Sony-signed modules. The only thing left are the modules that use per-console keys, which are useless for booting common firmware (which must be decryptable by every PS3)

Q: So bootldr is fixed in hardware?
A: Correct. Like metldr, bootldr cannot be software updated by Sony. It's hard-coded in hardware. As a reminder, bootldr/metldr themselves can't be exploited, but because of the keys we have recovered we can make them load anything we want, nullifying whatever security they provide.

Q: What about future firmwares?
A: Good news! We can decrypt those too. Sony can use various coding tricks to make the process more difficult (this is called obfuscation), but they can't stop us by using keys. We will always be able to decrypt lv0, and as long as we can figure out how to navigate lv0 we can figure out how to decrypt and modify its dependent modules. For those of you that follow Sony hardware this is much like how the earlier PSPs were hacked. So we can always decrypt the firmware and will be able to create newer CFWs as long as we can get past any obfuscation by Sony.

Q: So the PS3 is utterly and completely broken?
A: Right again! Unlike the 3.55 hack we really do have it all this time. Sony will never be able to re-secure existing consoles.

Q: What about consoles running firmware newer than 3.55?
A: Because all "old" consoles use the same keys to verify modules like lv0, at a minimum we can decrypt, patch, and resign the firmware. The problem is that we need a way to convince the PS3 to flash our modified firmware. With 3.55 and below that was easy enough to do because of the keys recovered, but 3.56 and later change that so that flashing is more complex than just using the recovered keys. This isn't an insurmountable problem - hardware flashers will always work - but for easy software flashing we need to find new exploits in the PS3 software stack to convince OFW consoles to flash CFW.

Q: What about newer consoles?
A: Ahh. So there's the real problem. Remember how we said bootldr and metldr are fixed in hardware? Sony can create new hardware, and update those modules in the process. By using new hardware in conjunction with new firmware for that hardware, Sony could completely change the keys used to secure the system. Without getting too technical, all of this progress comes from the fact that Sony was sloppy and did a poor job of implementing their security on earlier consoles, which is what lead to the first keys being leaked. Sony could always issue new hardware with new keys and a fixed security system at which point we'd be completely locked out of that new hardware. It's entirely possible they'll do this (if they haven't done so already), so much like the PSP we're going to end up with a limited number of consoles that have hardware-based flaws that can be exploited. Of course we then found new ways of exploiting the PSP anyhow, and ultimately were able to exploit every PSP made in one way or another.
Last edited by ViRGE on Mon Sep 14, 2015 11:02 am, edited 1 time in total.
Posts: 2874
Joined: Sat Apr 21, 2012 1:23 pm
Location: The North Pole

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by qwikrazor87 »

Awesome news. Thanks for sharing. I wonder what Sony's next move is gonna be. I doubt they'll render older PS3s updateless if they do a hardware update. I'm thinking that they'll just release separate updates like they did with the PSP 1/2/3k's and the PSP Go.
Looking forward to a 4.xx hack without the hardware hassle.
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
Posts: 1753
Joined: Wed Apr 04, 2012 5:23 pm

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by Jd8531 »

I was in the middle of typing something like this for the blog, it clarifies what i already said and saves some time. Thanks for the layout/link ;)
Posts: 44
Joined: Thu Oct 18, 2012 10:24 am

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by scousetomo »

Very informative for a average joe like me great post thanks
Posts: 6
Joined: Fri Mar 23, 2012 12:51 am

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by renascent »

Thanks for this. There's been a lot of misinformation being spread around, and it's good to hear the facts from a trustworthy source.
Posts: 214
Joined: Sat Jun 11, 2011 5:10 am

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by xoombie503 »

ok so im on the latest this any good news for me.would someone be able to create a soft downgrader?
Posts: 81
Joined: Mon Oct 08, 2012 8:31 am

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by ViRGE »

xoombie503 wrote:ok so im on the latest this any good news for me.would someone be able to create a soft downgrader?
Maybe. We won't know for sure until someone actually does it. It may require finding a runtime exploit in the PS3 OS, which would not be easy to come by.
Posts: 9
Joined: Thu Sep 13, 2012 6:40 pm

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by AkiTsugi »

I'm here getting some clarification only. Since they are actually the bootldr keys not lv0 keys it means that the newer Slims 3k running lv0.2 should still be decrypt-able? The original post did say, even newer Slims might have a chance to run CFW. Unluckily I've had the bad luck to replace my PS3 about 2 times, none running on CFW. Just one wouldn't turn on, second the CD's wouldn't jam out. Unfortunately I now have a PS3 Slim 3k. Wonder if there's hope for me in the future to get some CFW. I'm really looking forward to some homebrew.
Posts: 1
Joined: Mon Dec 24, 2012 8:26 am

Re: Marcan On PS3 Security In Light Of the lv0 Key Leak

Post by Alessio »

i am little bit confuse that this news is good for me or not . i am a software designer . so what you think about this .
Last edited by fate6 on Mon Dec 24, 2012 11:30 am, edited 1 time in total.
Reason: Do not quote the whole thing >__>

Return to “Programming & security”