Editing Vulnerabilities

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
== Usermode Exploits (Game Savedata) ==
== To sort exploits ==
 
=== Decryption of any GEN3 PUP ===


=== PS1 games savedata exploits ===
* Discovered by flatz.


See [https://www.psdevwiki.com/ps1/Vulnerabilities PS1 savedata exploits on PS1 Dev Wiki].
* A bug in the handlers of PUP decryption allows any PS4 on FW 1.62 GEN3 or below to decrypt any GEN3 PUP (retail, testkit, devkit, beta) with a version above 1.00 (post-prototype).


Official PS Classic games (warning: some may be remastered, to check) on PS4/PS5 available on PS Store:
* SM code doesn't reset state after SMI checks failure, so to decrypt arbitrary PUP, you need to ignore mailbox error after PupDecryptHeader cmd (1).
* Ape Escape - First-time NA re-release on PS4/PS5
* Cool Boarders (2000)
* Hot Shots Golf - First-time NA re-release on PS4/PS5
* I.Q. Intelligence Qube - First-time NA re-release on PS4/PS5
* Jumping Flash! - Free PS4/PS5 version for PS3 PSone Classics owners
* MediEvil (1998)
* Mr. Driller - PlayStation Plus Premium subscription only (?)
* Oddworld: Abe’s Oddysee - Free PS4/PS5 version for PS3 PSone Classics owners
* G-Police (1997)
* R4: Ridge Racer Type 4 (1998)
* Resident Evil: Director’s Cut - PlayStation Plus Premium subscription only
* Syphon Filter - Free PS4/PS5 version for PS3 PSone Classics owners
* Tekken 2 - PlayStation Plus Premium subscription only
* The Legend of Dragoon (1999)
* Toy Story 2: Buzz Lightyear To The Rescue! - Free PS4/PS5 version for PS3 PSone Classics owners
* Twisted Metal (1995) UP9000-CUSA43359_00-SCUS943040000000 or JP9000-CUSA43360_00-SIPS600070000000
* Twisted Metal 2 / Twisted Metal EX UP9000-CUSA43361_00-SCUS943060000000 or JP9000-CUSA43362_00-SIPS600210000000
* Wild Arms - Free PS4/PS5 version for PS3 PSone Classics owners
* Worms World Party - First-time NA re-release on PS4/PS5
* Worms Armageddon - First-time NA re-release on PS4/PS5


* https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/
* Fixed around 1.70
* https://www.reddit.com/r/PS3/comments/1cscsb2/all_ps1pspps3_games_that_have_crossbuy_or_free/
* https://www.reddit.com/r/PlayStationPlus/comments/vfg39t/is_there_a_clear_list_of_which_ps1_classic_ps4ps5/


"I have bought some of them on the PS3/Vita and the ones I could claim on the PS4/PS5 were Tekken 2 (which previously was not redeemable), all Syphon Filter games, all Wild Arms games, Legend of Dragoon, Ridge Racer Type 4 and Jumping Flash. Resident Evil Director's Cut is NOT redeemable. The rule of thumb is: if you can buy it on PS4/PS5 - and not only claim it through plus premium/deluxe sub, like Resident Evil 1 - they are redeemable from a previous purchase on PS3/PSP/Vita."
=== Decryption of any usermode SELF from FW 1.00 to 3.70 ===


Official PS Classic games (warning: some may be remastered, to check) on PS4/PS5 sold on Bluray Discs:
* Sony reused keys from FW 1.00 to 3.70 on usermode modules. As a result, any usermode module from those FWs can be decrypted on a PS4 running FW between 1.00 and 3.70.
* Tomba! by LRG (for PS5: UP6893-PPSA21381_00-0240103642659799-U001)
* TBA 2025 by LRG: Tomba 2 The Evil Swine Return
* TBA 2025 by LRG: Gex Trilogy: Gex, Gex Enter the Gecko, Gex 3 Deep Cover Gecko
* TBA 2025 by LRG: Clock Tower: Rewind https://store.playstation.com/en-us/concept/10010305 Notice: PS1 Clock Tower is not the original game. The first game in the series was Clock Tower (1995) - first released on the SNES, later ported to PS1, PC and WonderSwan, but only ever released in Japan. The PS1 game is the second game, and was called Clock Tower 2 in Japan but just Clock Tower everywhere else, even though it is a sequel and not a port of the original. So Clock Tower 2 on the PS1 is the third game, and Clock Tower 3 on the PS2 is the fourth game.
* TBA 2025 by LRG: Fear Effect
* TBA 2025 by LRG: Fighting Force and Fighting Force 2


"Five PS1 games were recently announced for PS5 and PS4 with trophy support: Gex, Gex Enter the Gecko, Gex 3 Deep Cover Gecko, Clock Tower, and Tomba. All five games were announced to be using Limited Run Games' Carbon Engine, which so far has been primarily used to support older console emulation like the SNES and Sega Genesis, but has now officially revealed support for Sony's original PlayStation as well. These PS1 ports for PS5 and PS4 will use Limited Run Games' "Carbon Engine," which allows these classic titles to implement modern features like trophy support."
* Fixed in 4.00 with the introduction of new keyset.


=== PS2 games savedata exploits ===
=== .strtab/.symtab kernel table of symbols kept on very low FWs ===


See [https://www.psdevwiki.com/ps2/Vulnerabilities#PS2_Savedata_exploits PS2 savedata exploits on PS2 Dev Wiki].
* Sony used to have two tables of symbols on very low versions: .strtab/.symtab and .dynstr/.dynsym (.strtab/.symtab had all symbols, .dynstr/.dynsym had ~75% of them).


Official PS2onPS4 games sold on the PS Store (as of September, 2024):
* Seen in 1.01 kernel. Patched in 1.03.
* ADK DAMASHII™ UP0576-CUSA03783_00-SLPS259060000001 https://image.api.playstation.com/cdn/UP0576/CUSA03783_00/BpMMUC8q1MRAsL9iWDh6vbW844hq3JXK.png
 
* Arc the Lad: Twilight of the Spirits
=== .dynstr/.dynsym kernel table of symbols kept on low FWs ===
* Art of Fighting Anthology
 
* Ape Escape 2
* After Sony removed  .strtab/.symtab, they still kept the .dynstr/.dynsym one.
* Bully (Canis Canem Edit)
 
* Dark Chronicle (Dark Cloud 2) UP9000-CUSA02037_00-SCUS972130000001 https://image.api.playstation.com/cdn/UP9000/CUSA02037_00/hIKSKqBMerypNW49TCECATZSBBUcSBph.png
* Patched in 2.50
* Dark Cloud
 
* Destroy All Humans!
=== IDPS leak in sceSblAuthMgrDriveData on low retail FWs ===
* Destroy All Humans! 2
 
* Eternal Ring UP1022-CUSA04654_00-SLUS200150000001 https://image.api.playstation.com/cdn/UP1022/CUSA04654_00/DRIS0z7mtNMYZPchoqLnKlhJqyNvM8mZ.png
* Discovered by flatz.
* FantaVision
 
* Fatal Fury Battle Archives Vol. 2
* Dump IDPS from 2 EID blocks from kernel: sceSblAuthMgrDriveData(0, in_buf, 0x160, out_buf, 0xA4, 1). Pass 0x160 bytes at 0x90C00 from sflash0s1.crypt into `in_buf` and dump `out_buf`.
* Forbidden Siren EP9000-CUSA02274_00-SCES519200000001 patch 1.01 requires PS4 3.10
 
* Fu'un Super Combo UP0576-CUSA03784_00-SLPS257810000001 https://image.api.playstation.com/cdn/UP0576/CUSA03784_00/QWsetumZLYupFHsOIkoGbKYpySGBdtlp.png
* It is possible because someone from sony forgot to encrypt output and that is how it was patched later.
* Ghosthunter (English, Japanese) UP9000-CUSA47996_00-SLUS209930000000
 
* GTA III
* Patched in 3.00 retail. Works on any TestKit/DevKit FW.
* GTA Vice City
 
* GTA San Andreas
=== Partial SAMU KeyRings bruteforce by missing HMAC length check in secure kernel ===
* Harvest Moon: Save the Homeland
 
* Harvest Moon: A Wonderful Life Special Edition
* Discovered by flatz.
* Hot Shots® Tennis (Everybody's Tennis) UP9000-CUSA02193_00-SCUS976100000001 https://image.api.playstation.com/cdn/UP9000/CUSA02193_00/FrJXexHruy7pjB6bCgDidXRbakNfNJJc.png
 
* Indigo Prophecy
* PS4 Crypto Coprocessor (CCP) interface in secure kernel has a bug that allows to dump (or better saying, bruteforce) key rings from SAMU.
* Jak and Daxter™ HP9000-CUSA08427_00-SCPS560030000001 patch 1.01 requires PS4 4.73
That is how AES/HMAC keys from PFS, portability keys, VTRM keys, etc can be retrieved. A crypto flaw was in ability to issue HMAC operation with key length < 16, for example, by setting it to 1 you can bruteforce key bytes one by one by comparing HMAC result with HMAC result with known partial key.  
* Jak and Daxter: The Precursor Legacy™ UP9000-CUSA02522_00-SCUS971240000001 patch 1.01 requires PS4 4.73
 
* Jak and Daxter™: The Precursor Legacy EP9000-CUSA07934_00-SCES503610000001 patch 1.03 requires PS4 4.73
* This trick may work on other crypto hardware as well if it does not restrict key lengths. Amazingly, Intel Secure Key Storage (SKS) of CSME subsystem also has a bug allowing to brute-force any key slot, but the issue exists at hardware level - insecure design of  the keys distribution to crypto engines (AES, SHA, RC4). Intel didn't recognize the bug arguing that to access SKS the CSME privileged arbitrary code execution is required, but SKS is exactly designed to protect the ROM generated keys from CSME firmware...
* Jak II™ UP9000-CUSA07840_00-SCUS972650000001 patch 1.01 requires PS4 5.01
 
* Jak II™ EP9000-CUSA07990_00-SCES516080000001 patch 1.02 requires PS4 5.01
Related:
* Jak II™ HP9000-CUSA08422_00-SCKA200100000001 patch 1.01 requires PS4 5.01
 
* Jak 3™ UP9000-CUSA07841_00-SCUS973300000001 patch 1.01 requires PS4 5.01
* https://twitter.com/qlutoo/status/1027691272369262594
* Jak 3™ EP9000-CUSA07991_00-SCES524600000001 patch 1.01 requires PS4 5.01
 
* Jak 3™ HP9000-CUSA08423_00-SCKA200400000001 patch 1.01 requires PS4 5.01
* https://yifan.lu/2017/02/19/psvimgtools-decrypt-vita-backups/
* Jak X: Combat Racing UP9000-CUSA07842_00-SCUS974290000001 patch 1.02 requires PS4 5.01
 
* Jak™ X EP9000-CUSA07992_00-SCUS974290000001 patch 1.02 requires PS4 5.01
* https://www.lolhax.org/2019/01/02/extracting-keys-f00d-crumbs-raccoon-exploit/
* Kinetica UP9000-CUSA01725_00-SCUS971320000001 https://image.api.playstation.com/cdn/UP9000/CUSA01725_00/EKH34FKOEt3dTXLCiccuawdS8iGIqGLF.png
 
* Manhunt
* [https://gist.github.com/flatz/22215327864d7512e52268f9c9c51cd8 Exploit PoC for PS4 FW 7.55]
* Max Payne
 
* Metal Slug Anthology
* Patched since a FW between 7.55 (unpatched) and 9.00 (patched).
* Mister Mosquito UP9000-CUSA48755_00-SLUS203750000000 (for PS5: UP9000-PPSA22948_00-SLUS203750000000) patch 1.02 requires PS4 11.52 or PS5 9.60
 
* Okage: Shadow King UP9000-CUSA02199_00-SCUS971290000001, requires PS4 FW version 3.15, although it was compiled with PS4 SDK version 3.008.000, latest patch requires PS4 FW 4.05
=== Crashdumps encryption using symmetrical key and same key across FW ===
* PaRappa the Rapper 2
 
* Primal
* [https://fail0verflow.com/blog/2017/ps4-crashdump-dump/#crashdump-decryptor see FoF article]
* Psychonauts
 
* Puzzle Quest: Challenge of the Warlords
* The keys never changed between 1.01 and 3.15 FWs. Then between 3.50 and 4.07 FWs they changed the keys many times but still used symmetrical key.
* Red Dead Revolver
 
* Red Faction
* Patched on FW 4.50 by using asymmetrical key. Tested between 1.01 and 4.07 FWs.
* Red Faction II
 
* Resident Evil Code: Veronica X
== Hardware Exploits ==
* Rise of the Kasai
 
* Rogue Galaxy
=== PCIe man-in-the-middle attack ===
* Samurai Shodown VI
 
* Siren UP9000-CUSA02198_00-SCUS973550000001 (for PS5: UP9000-PPSA22947_00-SCUS973550000000) PS4 patch 1.02 requires PS4 3.00 and PS5 patch 1.00 requires PS5 9.40
* First done on 1.01 by failoverflow on PS4 launch !
* SkyGunner UP9000-CUSA49210_00-SLUS203840000000 (for PS5: UP9000-PPSA23535_00-SLUS203840000000) patch 1.03 requires PS4 11.52 or PS5 9.60
* Detailed at 33c3: [https://fail0verflow.com/media/33c3-slides/#/5 33c3 slides by Marcan]
* Sly Raccoon (2002), Sly Cooper and the Thievius Racoonus UP9000-CUSA47431_00-SCUS971980000000 requires PS4 FW ?11.00? (update requires PS4 11.508.000)
* Permits kernel and usermode dumping
* Star Ocean Till The End Of Time
 
* Star Wars Bounty Hunter
=== Syscon glitching ===
* Star Wars Racer Revenge
 
* STAR WARS: Jedi Starfighter UP1082-CUSA03473_00-SLUS202930000001 https://image.api.playstation.com/cdn/UP1082/CUSA03473_00/PGRyqtcRKUoAsP4bJAhcoziTwL8940k1.png
It is possible to glitch the [[Syscon]] debug interface to allow access and dump keys. It was originally done by an anonymous member of fail0verflow.
EP1006-CUSA03494_00-SLES503710000001
 
https://image.api.playstation.com/cdn/EP1006/CUSA03494_00/9MsXVY5UULzSHB5BTreuKhwep3KZwvQP.png
=== Aeolia and Belize (Southbridge) SCA/DPA ===
* STAR WARS The Clone Wars UP1082-CUSA48010_00-SLUS205100000000
 
* Summoner UP4389-CUSA48889_00-SLUS200740000000 (for PS5: UP4389-PPSA23124_00-SLUS200740000000) PS4 patch 1.01 requires PS4 11.50, PS5 patch 1.02 requires PS5 9.40
Side Channel Analysis (SCA) with Differential Power Analysis (DPA) on Aeolia and Belize (PS4 Southbridge revisions) has been shown to be able to recover key material. Since Sony never used private/public key pairs, it is possible to exploit this and gain complete control over the [[Southbridge]]. You can attack the main FreeBSD kernel from here.
* The King of Fighters Collection: The Orochi Saga
 
* The King of Fighters '98 Ultimate Match
Nearly same methods are working on recent PS4 Pro motherboard NVB-003 that has Belize [[Southbridge]] ([[CXD90046GG]]).
* The King of Fighters 2000
* The Mark of Kri
* The Warriors
* Timesplitters EP4062-CUSA49387_00-SLUS200900000000 (for PS5: EP4062-PPSA23799_00-SLUS200900000000) PS4 patch 1.01 requires PS4 11.52, PS5 patch 1.00 requires PS5 9.40
* TimeSplitters 2 EP4062-CUSA49392_00-SLUS203140000000 (for PS5: EP4062-PPSA23801_00-SLUS203140000000) PS4 patch 1.01 requires PS4 11.52, PS5 patch 1.00 requires PS5 9.40
* TimeSplitters: Future Perfect EP4062-CUSA49435_00-SLUS211480000000 (for PS5: EP4062-PPSA23847_00-SLUS211480000000) PS4 patch 1.01 requires PS4 11.52, PS5 patch 1.00 requires PS5 9.40
* Tomb Raider: Legend UP8489-CUSA48389_00-SLUS212030000000 https://store.playstation.com/store/api/chihiro/00_09_000/titlecontainer/SE/en/999/CUSA48389_00/image
* Twisted Metal: Black
* War of the Monsters
* Wild Arms 3


* See [https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/].
Contrarly to Aeolia, Belize has ROM readout protection and clears stack which makes it more secure.


Official PS2onPS4 games sold on Bluray Discs:
Old notes:
* ADK DAMASHII™ UP0576-CUSA03783_00-SLPS259060000001 https://image.api.playstation.com/cdn/UP0576/CUSA03783_00/BpMMUC8q1MRAsL9iWDh6vbW844hq3JXK.png
* Art of Fighting Anthology (by Limited Run #375) UP0576-CUSA03754_00-SLUS214870000001 https://image.api.playstation.com/cdn/UP0576/CUSA03754_00/Hf5lUn48Ds3UDNp8NNjdzv7f1BZWGaai.png
* Destroy All Humans! (2005) (PS2 Classic by Limited Run #370, not to be confused with the remake EP4389-CUSA14910_00-DAH1REMAKEEU0000) UP4389-CUSA05232_00-SLUS209450000001 https://image.api.playstation.com/cdn/UP4389/CUSA05232_00/XrgVkqoR5rvZk4tAGi2j7OFfHpAZWKUu.png
* Fatal Fury Battle Archives Vol. 2 (by Limited Run #371) UP0576-CUSA03750_00-SLUS217230000001 https://image.api.playstation.com/cdn/UP0576/CUSA03750_00/gFCLAhlGZwvFkra1p2sozwIZ5SH1OyZO.png
* Fu'un Super Combo UP0576-CUSA03784_00-SLPS257810000001 https://image.api.playstation.com/cdn/UP0576/CUSA03784_00/QWsetumZLYupFHsOIkoGbKYpySGBdtlp.png
* Indigo Prophecy™ (aka Fahrenheit 2005, by Limited Run #331) UP1642-CUSA04798_00-SLUS211960000001 https://image.api.playstation.com/cdn/UP1642/CUSA04798_00/WJFDq83f1tcZ0E2PkEa1rXOba8laaZUV.png
* Jak and Daxter: The Precursor Legacy™ UP9000-CUSA02522_00-SCUS971240000001 https://image.api.playstation.com/cdn/UP9000/CUSA02522_00/o9zJoXqpd4lzarjIbvvZLFjYGLsLvqCp.png
* Jak X Combat Racing™® UP9000-CUSA07842
* Jak II UP9000-CUSA07840
* Jak 3 UP9000-CUSA07841
* METAL SLUG ANTHOLOGY™ (US version by Limited Run #364) UP0576-CUSA03749_00-SLUS215500000001 https://image.api.playstation.com/cdn/UP0576/CUSA03749_00/ImHDRENlttkdiXlm3K8ejNVgLURd3uTw.png
* METAL SLUG ANTHOLOGY™ (EU version by SNK) EP0576-CUSA04156_00-SLES546770000001 https://image.api.playstation.com/cdn/EP0576/CUSA04156_00/NN7npbsEvxIRGI8lBVhm9I5BwFzdGlOK.png
* Psychonauts UP2154-CUSA03881
* Red Faction (by Limited Run #281) UP4389-CUSA06402_00-SLUS200730000001 https://image.api.playstation.com/cdn/UP4389/CUSA06402_00/T07Bf136claKzP3SHF30QLa2xMAFjSpP.png
* Samurai Shodown VI (by Limited Run #329) UP0576-CUSA03787_00-SLUS216290000001 or EP0576-CUSA04158_00-SLES552920000001 https://image.api.playstation.com/cdn/UP0576/CUSA03787_00/CuLRRdOYvdge0IW9LL9Vewj44RCc6OAU.png https://image.api.playstation.com/cdn/EP0576/CUSA04158_00/7SrtqugKMJixAcbprEE0ExGUOHlhL0F7.png
* STAR WARS™ BOUNTY HUNTER™ (US version) UP1082-CUSA03472_00-SLUS204200000001
* STAR WARS™ BOUNTY HUNTER™ (EU version) EP1006-CUSA03493_00-SLES508310000001
* Star Wars Racer Revenge UP1082-CUSA03474, requires PS4 FW version ?3.15, although it was compiled with SDK version 3.008.000?
* The King of Fighters '98 Ultimate Match (by Limited Run #344) UP0576-CUSA03751_00-SLUS218160000001 https://image.api.playstation.com/cdn/UP0576/CUSA03751_00/bp4LfKIjcVTMfKP3O4LrDJHWzY6vZDar.png
* The King of Fighters 2000 (by Limited Run #386) UP0576-CUSA03748_00-SLUS208340000001 https://image.api.playstation.com/cdn/UP0576/CUSA03748_00/tvXJmFqa9zkXAAKCij20B3spadkqGuka.png
* The King of Fighters™ Collection: the Orochi Saga (by Limited Run #393) UP0576-CUSA03753_00-SLUS215540000001 https://image.api.playstation.com/cdn/UP0576/CUSA03753_00/E3gFtUUjCu2WDBSIGeXMV40sfF4uHzZi.png


These PS2onPS4 games can be bought online directly via Limited Run Games for brand new or for example on Ebay for second hand or like new.
This is a hack to gain unsigned code execution on the [[Southbridge]] for all motherboard/console revisions. You might be able to glitch the EMC bootrom in order to bypass further signature checks and break the chain of trust. This hack might involve slowing down the [[Syscon]] clock. Timing the glitch based on SPI read accesses then either doing a power glitch or clock glitch to skip signature check. If the glitch fails, then we simply reset. This can be done with a very cheap CPLD/FPGA. Most Xbox 360 glitching modchips used a Xilinx Coolrunner because it is cheap and easy to use (board can cost as low as $5).


=== PSP games savedata exploits ===
Related:
* [https://fail0verflow.com/blog/2018/ps4-aeolia/ fail0verflow's writeup]
* [https://twitter.com/fail0verflow/status/1047690778527653889 fail0verflow's tweet]
* [https://www.youtube.com/watch?v=sMroXa-zYxk Playstation 4 Rest Mode DEMO REcon Brussels 2018 by Volodymyr Pikhur]
* [https://recon.cx/2018/brussels/resources/slides/RECON-BRX-2018-Mess-with-the-best-die-like-the-rest_(mode).pdf Slides of REcon Brussels 2018 by Volodymyr Pikhur]
* [https://www.psxhax.com/threads/ps4-southbridge-reverse-engineered-code-examination-by-jogolden.6736/ jogolden's writeup]


See [https://www.psdevwiki.com/psp/Vulnerabilities PSP savedata exploits on PSP Dev Wiki].
== Usermode Exploits (Game Savedata) ==


* https://wololo.net/2012/09/01/when-the-psp-and-the-vita-show-their-battle-scars/
=== PS1 games savedata exploits ===
* https://wololo.net/talk/viewtopic.php?f=52&t=11183&start=10#p143779
* https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/


Official PS2onPS4 games sold on the PS Store (as of September, 2024):
See [https://www.psdevwiki.com/ps1/Vulnerabilities PS1 savedata exploits on PS1 Dev Wiki].
* Tekken 6 UP0700-CUSA33754_00-TEKKEN6000000000
* Killzone: Liberation (2006) EP9000-CUSA37875_00-UCES002790000000
* Ratchet & Clank: Size Matters (2007) UP9000-CUSA41395_00-UCUS986330000000
* Syphon Filter: Logan's Shadow (2007) EP9000-CUSA32631_00-UCES007100000000
* Pursuit Force (2005) UP9000-CUSA37191_00-UCUS986400000000 or EP9000-CUSA37192_00-UCES000190000000 or HP9000-CUSA37193_00-UCKS450160000000
* Pursuit Force: Extreme Justice UP9000-CUSA34853_00-UCUS987030000000
* Super Stardust Portable (2007) EP9000-CUSA33036_00-NPEG000080000000
* Resistance: Retribution (2009) UP9000-CUSA32636_00-UCUS986680000000 or EP9000-CUSA32637_00-UCES011840000000
* Jeanne d’Arc (2006) UP9000-CUSA41018_00-UCUS987000000000
* Jak and Daxter: The Lost Frontier UP9000-CUSA41282_00-NPUG803300000000 (for PS5: UP9000-PPSA14325_00-NPUG803300000000-U001) patch 1.02 requires PS4 11.50 or PS5 9.00
* LEGO Star Wars II: The Original Trilogy UP1082-CUSA41250_00-ULUS101550000000 (for PS5: UP1082-PPSA14300_00-ULUS101550000000, UP1082-PPSA14300_00-0804842924824650-U002) or EP1006-CUSA41251_00-ULES004790000000, patch 1.01 requires PS4 11.50 or PS5 9.20
* Daxter UP9000-CUSA36097_00-NPUG803290000000 (for PS5: UP9000-PPSA09695_00-NPUG803290000000-U001) patch 1.01 requires PS4 11.50 or PS5 9.20


=== PS4/PS5 PS2emu sandbox escape (mast1c0re) ===
Official PS Classic games (warning: some may be remastered, to check) on PS4/PS5 available on PS Store:
 
* Ape Escape - First-time NA re-release on PS4/PS5
Advantages of the PS4/PS5 PS2emu sandbox escape exploit over most WebKit exploits:
* Hot Shots Golf - First-time NA re-release on PS4/PS5
* Bigger kernel attack surface (more usermode privileges) versus WebKit very restricted and becoming more and more with firmware revisions. For example, the PS2emu process uses libkernel_sys, which supports nmount and so mounting of system partitions, whilst neither libkernel_web nor regular libkernel do.
* I.Q. Intelligence Qube - First-time NA re-release on PS4/PS5
* 100% reliable versus WebKit exploits becoming less and less stable with firmware revisions
* Jumping Flash! - Free PS4/PS5 version for PS3 PSone Classics owners
* Firmware agnostic (ROP-less code execution) versus almost one WebKit revision every three firmware update
* Mr. Driller - PlayStation Plus Premium subscription only (?)
* Oddworld: Abe’s Oddysee - Free PS4/PS5 version for PS3 PSone Classics owners
* Resident Evil: Director’s Cut - PlayStation Plus Premium subscription only
* Syphon Filter - Free PS4/PS5 version for PS3 PSone Classics owners
* Tekken 2 - PlayStation Plus Premium subscription only
* Toy Story 2: Buzz Lightyear To The Rescue! - Free PS4/PS5 version for PS3 PSone Classics owners
* Wild Arms - Free PS4/PS5 version for PS3 PSone Classics owners
* Worms World Party - First-time NA re-release on PS4/PS5
* Worms Armageddon - First-time NA re-release on PS4/PS5


==== Credits ====
* https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/
* CTurt for discovering these vulnerabilities in September 2021.
* https://www.reddit.com/r/PS3/comments/1cscsb2/all_ps1pspps3_games_that_have_crossbuy_or_free/
* CTurt for public disclosure [https://twitter.com/CTurtE/status/1570189920844804097 on twitter] (2022-09-14).
* https://www.reddit.com/r/PlayStationPlus/comments/vfg39t/is_there_a_clear_list_of_which_ps1_classic_ps4ps5/
* flatz, balika011, theflow0, chicken(s), PlayStation for helping CTurt.
* McCaulay for sharing publicly his implementation in February 2023.


==== Analysis ====
"I have bought some of them on the PS3/Vita and the ones I could claim on the PS4/PS5 were Tekken 2 (which previously was not redeemable), all Syphon Filter games, all Wild Arms games, Legend of Dragoon, Ridge Racer Type 4 and Jumping Flash. Resident Evil Director's Cut is NOT redeemable. The rule of thumb is: if you can buy it on PS4/PS5 - and not only claim it through plus premium/deluxe sub, like Resident Evil 1 - they are redeemable from a previous purchase on PS3/PSP/Vita."
* [https://cturt.github.io/mast1c0re.html Writeup part 1 by CTurt (2022-09-14)]
* [https://mccaulay.co.uk/mast1c0re-part-3-escaping-the-emulator Writeup part 3 by McCaulay (2023-02-17)]
* [https://cturt.github.io/mast1c0re-2.html Writeup part 2 by CTurt (2023-04-02)]


==== Bug Description ====
=== PS2 games savedata exploits ===
After getting code execution in a PS2onPS4 game using a savedata exploit, it is possible to exploit the PS2 emulator to get x86-64 usermode ROP execution. It is then possible, without a kernel exploit, to load another PS2 game in the emulator with a compatibility rate based on the PS2 emulator configuration.


==== Exploit Implementation ====
See [https://www.psdevwiki.com/ps2/Vulnerabilities#PS2_Savedata_exploits PS2 savedata exploits on PS2 Dev Wiki].
* [https://github.com/McCaulay/mast1c0re mast1c0re implementation by McCaulay (2023-02-18)]


==== Patched ====
Official PS2onPS4 games sold on the PS Store (as of September, 2024):
'''No''' as of PS4 FW 11.50 and PS5 FW 8.00. Using the PS2onPS4 game Okage Shadow King, the exploit should work starting from PS4 FW 3.15 and PS5 FW 1.00.
* ADK DAMASHII™ UP0576-CUSA03783_00-SLPS259060000001 https://image.api.playstation.com/cdn/UP0576/CUSA03783_00/BpMMUC8q1MRAsL9iWDh6vbW844hq3JXK.png
 
* Arc the Lad: Twilight of the Spirits
=== PS4/PS5 game savedata LUA exploit ===
* Art of Fighting Anthology
 
* Ape Escape 2
==== Credits ====
* Bully (Canis Canem Edit)
* Used by Flatz on 2023-07-27 in [https://wololo.net/2023/07/28/ps5-flat_z-dumps-ps5-secure-processor-confirms-he-has-a-ps5-hypervisor-exploit-via-a-ps4-game-save-exploit/ his Hypervisor exploit].
* Dark Chronicle (Dark Cloud 2) UP9000-CUSA02037_00-SCUS972130000001 https://image.api.playstation.com/cdn/UP9000/CUSA02037_00/hIKSKqBMerypNW49TCECATZSBBUcSBph.png
* Used by Flatz on 2024-09-14 in [https://gist.github.com/flatz/5e12f75cdb210516d31df03069f7ed0a his implementation of the umtx UaF kernel exploit].
* Dark Cloud
 
* Destroy All Humans!
==== Bug description ====
* Destroy All Humans! 2
Some PS4 (or maybe PS5) games, in disc version (probably also available in PS Store version but potentially patched), can be exploited as they use some LUA interpreter, by crafting an evil save data.
* Eternal Ring UP1022-CUSA04654_00-SLUS200150000001 https://image.api.playstation.com/cdn/UP1022/CUSA04654_00/DRIS0z7mtNMYZPchoqLnKlhJqyNvM8mZ.png
 
* FantaVision
==== Vulnerable games ====
* Fatal Fury Battle Archives Vol. 2
 
* Forbidden Siren
Not confirmed:
* Fu'un Super Combo UP0576-CUSA03784_00-SLPS257810000001 https://image.api.playstation.com/cdn/UP0576/CUSA03784_00/QWsetumZLYupFHsOIkoGbKYpySGBdtlp.png
Pay Day 2, Mafia III, God of War (which one?).
* Ghosthunter (English, Japanese) UP9000-CUSA47996_00-SLUS209930000000
 
* GTA III
Confirmed:
* GTA Vice City
TODO
* GTA San Andreas
 
* Harvest Moon: Save the Homeland
==== Analysis ====
* Harvest Moon: A Wonderful Life Special Edition
 
* Hot Shots® Tennis (Everybody's Tennis) UP9000-CUSA02193_00-SCUS976100000001 https://image.api.playstation.com/cdn/UP9000/CUSA02193_00/FrJXexHruy7pjB6bCgDidXRbakNfNJJc.png
==== Patched
* Indigo Prophecy
'''No''' as of PS4 FW ?12.00? and PS5 FW 7.61.
* Jak and Daxter: The Precursor Legacy
 
* Jak II: Renegade
== Usermode Exploits (BD-J) ==
* Jak 3
 
* Jak X: Combat Racing
Advantages of most BD-J exploits over most WebKit exploits:
* Kinetica UP9000-CUSA01725_00-SCUS971320000001 https://image.api.playstation.com/cdn/UP9000/CUSA01725_00/EKH34FKOEt3dTXLCiccuawdS8iGIqGLF.png
* Bigger kernel attack surface (more usermode privileges) versus WebKit very restricted and becoming more and more with firmware revisions. For example, the BD-J process uses libkernel_sys, which supports nmount and so mount of system partitions, whilst neither libkernel_web nor regular libkernel do.
* Manhunt
* 100% reliable versus WebKit exploits becoming less and less stable with firmware revisions
* Max Payne
* Firmware agnostic (ROP-less code execution) versus almost one WebKit revision every three firmware update
* Metal Slug Anthology
* JIT enabled allowing to write a kernel exploit in C versus writing in assembly and JavaScript since around FW 2.00
* Okage: Shadow King UP9000-CUSA02199_00-SCUS971290000001, requires PS4 FW version 3.15, although it was compiled with PS4 SDK version 3.008.000, latest patch requires PS4 FW 4.05
 
* PaRappa the Rapper 2
=== FW <= 10.71 - BD-JB2 - Path traversal sandbox escape by TheFloW ===
* Primal
 
* Psychonauts
==== Credits ====
* Puzzle Quest: Challenge of the Warlords
* TheFloW for the exploits finding (before 2023-09-11), ethical disclose to SCE (2023-09-22) and public disclosure (2023-10-25)
* Red Dead Revolver
* Previous BD-JB contributors
* Red Faction
 
* Red Faction II
==== Analysis ====
* Resident Evil Code: Veronica X
* [https://twitter.com/theflow0/status/1701154155744645349 Removed tweet of BD-JB2 logs on a 7.61 PS5 by TheFloW (2023-09-11)]
* Rise of the Kasai
 
* Rogue Galaxy
==== Bug Description ====
* Samurai Shodown VI
Basing on BD-JB1 exploit files, in /bdmv/bdjo.xml changing bdjo/applicationManagementTable/baseDirectory to a path of the form `file:///app0/cdc/lib/../../../disc/BDMV/JAR/00000.jar` allows loading a JAR Java executable file.
* Sly Raccoon (2002), Sly Cooper and the Thievius Racoonus UP9000-CUSA47431_00-SCUS971980000000 requires PS4 FW ?11.00? (update requires PS4 11.508.000)
 
* Star Ocean Till The End Of Time
==== Exploit Implementation ====
* Star Wars Bounty Hunter
* [https://twitter.com/theflow0/status/1717088032031982066 PoC by TheFloW (2023-10-25)]
* Star Wars Racer Revenge
* STAR WARS: Jedi Starfighter UP1082-CUSA03473_00-SLUS202930000001 https://image.api.playstation.com/cdn/UP1082/CUSA03473_00/PGRyqtcRKUoAsP4bJAhcoziTwL8940k1.png
EP1006-CUSA03494_00-SLES503710000001
https://image.api.playstation.com/cdn/EP1006/CUSA03494_00/9MsXVY5UULzSHB5BTreuKhwep3KZwvQP.png
* STAR WARS The Clone Wars UP1082-CUSA48010_00-SLUS205100000000
* The King of Fighters Collection: The Orochi Saga
* The King of Fighters '98 Ultimate Match
* The King of Fighters 2000
* The Mark of Kri
* The Warriors
* Tomb Raider: Legend UP8489-CUSA48389_00-SLUS212030000000 https://store.playstation.com/store/api/chihiro/00_09_000/titlecontainer/SE/en/999/CUSA48389_00/image
* Twisted Metal: Black
* War of the Monsters
* Wild Arms 3


==== Patched ====
* See [https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/].
'''No''' as of PS4 FW 10.71 (maybe patched on PS4 FW 11.00). '''Yes''' on PS5 FW 8.00.


=== FW <= 9.00 - BD-JB - Five vulnerabilities chained by TheFloW ===
Official PS2onPS4 games sold on Bluray Discs:
 
* ADK DAMASHII™ UP0576-CUSA03783_00-SLPS259060000001 https://image.api.playstation.com/cdn/UP0576/CUSA03783_00/BpMMUC8q1MRAsL9iWDh6vbW844hq3JXK.png
==== Credits ====
* Art of Fighting Anthology (by Limited Run #375) UP0576-CUSA03754_00-SLUS214870000001 https://image.api.playstation.com/cdn/UP0576/CUSA03754_00/Hf5lUn48Ds3UDNp8NNjdzv7f1BZWGaai.png
* CTurt for [https://github.com/CTurt/FreeDVDBoot FreeDVDBoot exploit on PS2] and the idea to hack BD-J on PS3 and PS4 [https://twitter.com/CTurtE/status/1276946283941498881 on twitter] (2020-06-27)
* Destroy All Humans! (2005) (PS2 Classic by Limited Run #370, not to be confused with the remake EP4389-CUSA14910_00-DAH1REMAKEEU0000) UP4389-CUSA05232_00-SLUS209450000001 https://image.api.playstation.com/cdn/UP4389/CUSA05232_00/XrgVkqoR5rvZk4tAGi2j7OFfHpAZWKUu.png
* TheFloW for finding these vulnerabilities (around 2021-10-24) and disclosing them publicly on hackerone and hardwear.io (2022-06-10)
* Fatal Fury Battle Archives Vol. 2 (by Limited Run #371) UP0576-CUSA03750_00-SLUS217230000001 https://image.api.playstation.com/cdn/UP0576/CUSA03750_00/gFCLAhlGZwvFkra1p2sozwIZ5SH1OyZO.png
* Sleirsgoevy for writing the first public implementation (2022-06-16)
* Fu'un Super Combo UP0576-CUSA03784_00-SLPS257810000001 https://image.api.playstation.com/cdn/UP0576/CUSA03784_00/QWsetumZLYupFHsOIkoGbKYpySGBdtlp.png
* psxdev, sleirsgoevy and John Törnblom for the public implementations
* Indigo Prophecy™ (aka Fahrenheit 2005, by Limited Run #331) UP1642-CUSA04798_00-SLUS211960000001 https://image.api.playstation.com/cdn/UP1642/CUSA04798_00/WJFDq83f1tcZ0E2PkEa1rXOba8laaZUV.png
* Jak and Daxter: The Precursor Legacy™ UP9000-CUSA02522_00-SCUS971240000001 https://image.api.playstation.com/cdn/UP9000/CUSA02522_00/o9zJoXqpd4lzarjIbvvZLFjYGLsLvqCp.png
* Jak X Combat Racing™® UP9000-CUSA07842
* Jak II UP9000-CUSA07840
* Jak 3 UP9000-CUSA07841
* METAL SLUG ANTHOLOGY™ (US version by Limited Run #364) UP0576-CUSA03749_00-SLUS215500000001 https://image.api.playstation.com/cdn/UP0576/CUSA03749_00/ImHDRENlttkdiXlm3K8ejNVgLURd3uTw.png
* METAL SLUG ANTHOLOGY™ (EU version by SNK) EP0576-CUSA04156_00-SLES546770000001 https://image.api.playstation.com/cdn/EP0576/CUSA04156_00/NN7npbsEvxIRGI8lBVhm9I5BwFzdGlOK.png
* Psychonauts UP2154-CUSA03881
* Red Faction (by Limited Run #281) UP4389-CUSA06402_00-SLUS200730000001 https://image.api.playstation.com/cdn/UP4389/CUSA06402_00/T07Bf136claKzP3SHF30QLa2xMAFjSpP.png
* Samurai Shodown VI (by Limited Run #329) UP0576-CUSA03787_00-SLUS216290000001 or EP0576-CUSA04158_00-SLES552920000001 https://image.api.playstation.com/cdn/UP0576/CUSA03787_00/CuLRRdOYvdge0IW9LL9Vewj44RCc6OAU.png https://image.api.playstation.com/cdn/EP0576/CUSA04158_00/7SrtqugKMJixAcbprEE0ExGUOHlhL0F7.png
* STAR WARS™ BOUNTY HUNTER™ (US version) UP1082-CUSA03472_00-SLUS204200000001
* STAR WARS™ BOUNTY HUNTER™ (EU version) EP1006-CUSA03493_00-SLES508310000001
* Star Wars Racer Revenge UP1082-CUSA03474, requires PS4 FW version ?3.15, although it was compiled with SDK version 3.008.000?
* The King of Fighters '98 Ultimate Match (by Limited Run #344) UP0576-CUSA03751_00-SLUS218160000001 https://image.api.playstation.com/cdn/UP0576/CUSA03751_00/bp4LfKIjcVTMfKP3O4LrDJHWzY6vZDar.png
* The King of Fighters 2000 (by Limited Run #386) UP0576-CUSA03748_00-SLUS208340000001 https://image.api.playstation.com/cdn/UP0576/CUSA03748_00/tvXJmFqa9zkXAAKCij20B3spadkqGuka.png
* The King of Fighters™ Collection: the Orochi Saga (by Limited Run #393) UP0576-CUSA03753_00-SLUS215540000001 https://image.api.playstation.com/cdn/UP0576/CUSA03753_00/E3gFtUUjCu2WDBSIGeXMV40sfF4uHzZi.png
 
These PS2onPS4 games can be bought online directly via Limited Run Games for brand new or for example on Ebay for second hand or like new.


==== Analysis ====
=== PSP games savedata exploits ===
* [https://twitter.com/theflow0/status/1457362920501829636 TheFloW's PS5 kernel exploit announcement (2021-11-07)]
* [https://hackerone.com/reports/1379975 Official vulnerability report by TheFloW (2022-06-10)]
* [https://github.com/TheOfficialFloW/Presentations/blob/master/2022-hardwear-io-bd-jb.pdf Slides presented at hardwear.io by TheFloW (2022-06-10)]


==== Bug Description ====
See [https://www.psdevwiki.com/psp/Vulnerabilities PSP savedata exploits on PSP Dev Wiki].
TO ADD DESCRIPTION OF EACH ONE OF THE 5 BUGS:


* #1 com.sony.gemstack.org.dvb.user.UserPreferenceManagerImpl userprefs hijack leading to classes instantiation under privileged context (affecting ?PS3?, PS4, PS5)
* https://wololo.net/2012/09/01/when-the-psp-and-the-vita-show-their-battle-scars/
* #2 com.oracle.security.Service leading to privileged constructor call (affecting ?PS3?, PS4, not PS5)
* https://wololo.net/talk/viewtopic.php?f=52&t=11183&start=10#p143779
* #3 com.sony.gemstack.org.dvb.io.ixc.IxcProxy leading to privileged method call (affecting ?PS3?, PS4, PS5)
* https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/
* #4 JIT compiler hack leading to usermode arbitrary RW and arbitrary usermode code execution (affecting ?PS3?, PS4, not PS5)
* #5 UDF buffer overflow kernel exploit (affecting ?PS3?, PS4, PS5)


This exploit chain alone does not allow one to run pirated games on PS4 or PS5 as there is not enough RAM allowed in the BD-J process and there are other constraints.
Official PS2onPS4 games sold on the PS Store (as of September, 2024):
* Tekken 6 UP0700-CUSA33754_00-TEKKEN6000000000
* Killzone: Liberation (2006) EP9000-CUSA37875_00-UCES002790000000
* Ratchet & Clank: Size Matters (2007) UP9000-CUSA41395_00-UCUS986330000000
* Syphon Filter: Logan's Shadow (2007) EP9000-CUSA32631_00-UCES007100000000
* Pursuit Force (2005) UP9000-CUSA37191_00-UCUS986400000000 or EP9000-CUSA37192_00-UCES000190000000 or HP9000-CUSA37193_00-UCKS450160000000
* Pursuit Force: Extreme Justice UP9000-CUSA34853_00-UCUS987030000000
* Super Stardust Portable (2007) EP9000-CUSA33036_00-NPEG000080000000
* Resistance: Retribution (2009) UP9000-CUSA32636_00-UCUS986680000000 or EP9000-CUSA32637_00-UCES011840000000
* Jeanne d’Arc (2006) UP9000-CUSA41018_00-UCUS987000000000


==== Exploit Implementation ====
=== PS4/PS5 PS2emu sandbox escape (mast1c0re) ===
* [https://github.com/TheOfficialFloW/bd-jb Implementation of BD-J usermode code execution on PS4 using bugs #1, #2, #3 and #4 by TheFloW (2021-10-24)]
* [https://github.com/TheOfficialFloW/bd-jb/blob/master/src/com/bdjb/exploit/sandbox/ExploitUserPrefsImpl.java Vuln #1 com.sony.gemstack.org.dvb.user.UserPreferenceManagerImpl implementation by TheFloW]
* [https://github.com/TheOfficialFloW/bd-jb/blob/master/src/com/bdjb/exploit/sandbox/ExploitServiceProxyImpl.java Vuln #2 com.oracle.security.Service and #3 com.sony.gemstack.org.dvb.io.ixc.IxcProxy chained together by TheFloW]
* [https://github.com/TheOfficialFloW/bd-jb/blob/master/src/com/bdjb/jit/JitCompilerReceiverImpl.java Vuln #4 JIT compiler hack implementation by TheFloW]
* [https://github.com/sleirsgoevy/bd-jb Implementation of BD-J usermode code execution on PS4 using bugs #2, #3 and #4 by sleirsgoevy (2022-06-16)]
* Note that no implementation of the UDF kernel exploit has ever been done even by TheFloW, only a kernel panic PoC.


==== Patched ====
Advantages of the PS4/PS5 PS2emu sandbox escape exploit over most WebKit exploits:
'''No''' as of PS4 FW 9.00 and PS5 FW 4.03. At least partially patched on PS4 FW 9.50 and PS5 FW 5.00.
* Bigger kernel attack surface (more usermode privileges) versus WebKit very restricted and becoming more and more with firmware revisions. For example, the PS2emu process uses libkernel_sys, which supports nmount and so mounting of system partitions, whilst neither libkernel_web nor regular libkernel do.
* 100% reliable versus WebKit exploits becoming less and less stable with firmware revisions
* Firmware agnostic (ROP-less code execution) versus almost one WebKit revision every three firmware update


On PS4 FW 9.03 and PS5 FW ?4.50?, the bug #5 (UDF) has been patched.
==== Credits ====
* CTurt for discovering these vulnerabilities in September 2021.
* CTurt for public disclosure [https://twitter.com/CTurtE/status/1570189920844804097 on twitter] (2022-09-14).
* flatz, balika011, theflow0, chicken(s), PlayStation for helping CTurt.
* McCaulay for sharing publicly his implementation in February 2023.


== Usermode Exploits (WebKit) ==
==== Analysis ====
* [https://cturt.github.io/mast1c0re.html Writeup part 1 by CTurt (2022-09-14)]
* [https://mccaulay.co.uk/mast1c0re-part-3-escaping-the-emulator Writeup part 3 by McCaulay (2023-02-17)]
* [https://cturt.github.io/mast1c0re-2.html Writeup part 2 by CTurt (2023-04-02)]


=== WebKit sources ===
==== Bug Description ====
After getting code execution in a PS2onPS4 game using a savedata exploit, it is possible to exploit the PS2 emulator to get x86-64 usermode ROP execution. It is then possible, without a kernel exploit, to load another PS2 game in the emulator with a compatibility rate based on the PS2 emulator configuration.


[https://doc.dl.playstation.net/doc/ps4-oss/webkit.html WebKit sources]
==== Exploit Implementation ====
* [https://github.com/McCaulay/mast1c0re mast1c0re implementation by McCaulay (2023-02-18)]


[https://web.archive.org/web/20241007081407/https://doc.dl.playstation.net/doc/ps4-oss/webkit.html WebKit sources] archived currently up to version 11.00. Useful for people that cannot access PlayStation URLs and also for when Sony will inevitably stop hosting the sources.
==== Patched ====
'''No''' as of PS4 FW 11.50 and PS5 FW 8.00. Using the PS2onPS4 game Okage Shadow King, the exploit should work starting from PS4 FW 3.15 and PS5 FW 1.00.


=== FW ?6.00-11.52? - get_by_id_with_this associated with ProxyObject can leak JSScope objects ===
=== PS4/PS5 game savedata LUA exploit ===


==== Credits ====
* Used by Flatz on 2023-07-27 in [https://wololo.net/2023/07/28/ps5-flat_z-dumps-ps5-secure-processor-confirms-he-has-a-ps5-hypervisor-exploit-via-a-ps4-game-save-exploit/ his Hypervisor exploit].
* Alexey Shvayka for discovery (2021-05-05) and incremental fixes (from 2021-05-20 to 2024-07-31)
* Filip Pizlo for reviewing and not pushing it (2021-06-10)
* Ahmad Saleem for reminding WebKit that it is still not fixed (2022-09-03)
* Yusuke Suzuki and Justin Michaud for fix commits review.


==== Analysis ====
* Used by Flatz on 2024-09-14 in [https://gist.github.com/flatz/5e12f75cdb210516d31df03069f7ed0a his implementation of the umtx UaF kernel exploit].
* [https://github.com/WebKit/WebKit/pull/35527 Fix commit #3 by Alexey Shvayka (2024-10-21)]
* [https://github.com/WebKit/WebKit/pull/31572 Fix commit #2 by Alexey Shvayka (2024-07-31)]
* [https://github.com/WebKit/WebKit/commit/ceb7e89febcd92b46d65396ce68e0d58ae6bcd6e Fix commit #1 for ProxyObject by Alexey Shvayka (2024-03-14)]
* [https://github.com/WebKit/WebKit/blob/6bb75cf119f4cf3c077ec234af476fb575b28509/Source/WebCore/bindings/js/JSDOMOperation.h#L38 Workaround leftover by Alexey Shvayka (2021-05-20)]
* [https://github.com/WebKit/WebKit/commit/6bb75cf119f4cf3c077ec234af476fb575b28509 Incremental fix commit by Alexey Shvayka (2021-05-20)]
* [https://bugs.webkit.org/show_bug.cgi?id=225397 Bug report on WebKit Bugzilla by Alexey Shvayka (2021-05-05)]


==== Bug Description ====
* Some PS4 (or maybe PS5) games, in disc version (probably also available in PS Store version but potentially patched), can be exploited as they use some LUA interpreter, by crafting an evil save data.
* TODO: document the general vulnerability coming from |this|.


According to the spec [1], `var base = { foo }; with (base) foo();` should be called with `this`
* Possible vulnerable games: Pay Day 2, Mafia III, God of War (which one?).
value of `base`, which is why FunctionCallResolveNode moves resolved scope to thisRegister().
That is arguably a bad design, and there is an effort [2] to abolish using JSScope as `this` value.


When `this` value is accessed by JS code, it's being sanitized via ToThis (JSScope replaced with
* Not patched as of PS4 FW ?12.00? and PS5 FW 7.61.
`undefined`), yet not in case of `super.property` access calling into ProxyObject `get` trap,
which passes raw `this` value as receiver parameter, leaking JSScope to be exploited.


==== Exploit Implementation ====
== Usermode Exploits (BD-J) ==
* [https://github.com/shvaikalesh/WebKit/blob/ee167b8fe4fd234a33b2381640cba982fa6c7516/JSTests/stress/evaluate-with-scope-extension.js Stress code by Alexey Shvayka (2024-10-21)]
* [https://github.com/WebKit/WebKit/blob/ceb7e89febcd92b46d65396ce68e0d58ae6bcd6e/JSTests/stress/regress-120777816.js Regression test by Alexey Shvayka (2024-03-14)]


==== Patched ====
Advantages of most BD-J exploits over most WebKit exploits:
'''Maybe'''
* Bigger kernel attack surface (more usermode privileges) versus WebKit very restricted and becoming more and more with firmware revisions. For example, the BD-J process uses libkernel_sys, which supports nmount and so mount of system partitions, whilst neither libkernel_web nor regular libkernel do.
* 100% reliable versus WebKit exploits becoming less and less stable with firmware revisions
* Firmware agnostic (ROP-less code execution) versus almost one WebKit revision every three firmware update
* JIT enabled allowing to write a kernel exploit in C versus writing in assembly and JavaScript since around FW 2.00


==== Tested ====
=== FW <= 10.71 - BD-JB2 - Path traversal sandbox escape by TheFloW ===
Not tested yet on PS4 or PS5.
----
 
=== FW ?10.00-11.52? - Immediate overflow/underflow in JSC SBFX (CVE-2024-27833) leading to arbitrary code execution ===


==== Credits ====
==== Credits ====
* Manfred Paul (@_manfp), working with Trend Micro Zero Day Initiative, for discovering the vulnerability on Apple Safari at pwn2own 2024 (2024-03-21) [https://twitter.com/thezdi/status/1770611705510293546 Zero Day Initiative's tweet]
* TheFloW for the exploits finding (before 2023-09-11), ethical disclose to SCE (2023-09-22) and public disclosure (2023-10-25)
* Justin Michaud for fix commit, Yusuke Suzuki for fix commit review (2024-05-15)
* Previous BD-JB contributors
* Apple disclose that Safari update integrates the fix (2024-06-10)
* xvonfers and Bearseater (@JamesMa52390215) for discovering it affects PS4 and PS5 (2024-06-11) [https://twitter.com/xvonfers/status/1800426437486485635 xvonfer's tweet]


==== Analysis ====
==== Analysis ====
* [https://github.com/WebKit/WebKit/commit/1ea4ef8127276fd00ca43ffcb22bed162072abde WebKit fix commit by Justin Michaud (2024-05-15)]
* [https://twitter.com/theflow0/status/1701154155744645349 Removed tweet of BD-JB2 logs on a 7.61 PS5 by TheFloW (2023-09-11)]
* [https://bugs.webkit.org/show_bug.cgi?id=271491 WebKit Bugzilla #271491 with restricted access]


==== Bug Description ====
==== Bug Description ====
There is an integer underflow in WebKit renderer. It was addressed with improved input validation.
Basing on BD-JB1 exploit files, in /bdmv/bdjo.xml changing bdjo/applicationManagementTable/baseDirectory to a path of the form `file:///app0/cdc/lib/../../../disc/BDMV/JAR/00000.jar` allows loading a JAR Java executable file.
 
The JavaScriptCore Isel SBFX patterns in JavaScriptCore/b3/B3LowerToAir.cpp allowed immediate overflow as 'lsb' and 'width' are not properly checked.
 
SBFX stands for Signed Bitfield Extract. See [https://www.scs.stanford.edu/~zyedidia/arm64/sbfx_sbfm.html] and [https://developer.arm.com/documentation/101273/0001/The-Cortex-M55-Instruction-Set--Reference-Material/Bit-field-instructions/SBFX-and-UBFX]. SBFX is an alias for SBFM (Signed Bitfield Move). See [https://www.scs.stanford.edu/~zyedidia/arm64/sbfm.html]. SBFM is a bitfield extraction opcode.
 
Isel is a short name for Instruction SELect. This pass transforms generic machine instructions into equivalent target-specific instructions. It traverses the MachineFunction bottom-up, selecting uses before definitions, enabling trivial dead code elimination.


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://github.com/WebKit/WebKit/blob/main/JSTests/stress/sbfx-offset-overflow.js Vulnerability test by Justin Michaud]
* [https://twitter.com/theflow0/status/1717088032031982066 PoC by TheFloW (2023-10-25)]


==== Patched ====
==== Patched ====
'''Yes''' on PS4 FW 12.00 and PS5 FW ?10.00?.
'''No''' as of PS4 FW 10.71 (maybe patched on PS4 FW 11.00). '''Yes''' on PS5 FW 8.00.


==== Tested ====
=== FW <= 9.00 - BD-JB - Five vulnerabilities chained by TheFloW ===
Tested working on PS4 FWs 11.50 and PS5 FWs ?6.00-9.60?. Not working on PS4 <= 9.00 and PS5 >= 10.01.
----
 
=== FW ?10.00?-11.52 - Unknown heap and string overflow (no CVE) leading to crash ===


==== Credits ====
==== Credits ====
* Debty for PoC public disclose (2024-08-29)
* CTurt for [https://github.com/CTurt/FreeDVDBoot FreeDVDBoot exploit on PS2] and the idea to hack BD-J on PS3 and PS4 [https://twitter.com/CTurtE/status/1276946283941498881 on twitter] (2020-06-27)
* TheFloW for finding these vulnerabilities (around 2021-10-24) and disclosing them publicly on hackerone and hardwear.io (2022-06-10)
* Sleirsgoevy for writing the first public implementation (2022-06-16)
* psxdev, sleirsgoevy and John Törnblom for the public implementations


==== Analysis ====
==== Analysis ====
* [https://github.com/Debvt/Wm/tree/Root0 PoC and analysis by Debty (2024-08-29)]
* [https://twitter.com/theflow0/status/1457362920501829636 TheFloW's PS5 kernel exploit announcement (2021-11-07)]
* [https://hackerone.com/reports/1379975 Official vulnerability report by TheFloW (2022-06-10)]
* [https://github.com/TheOfficialFloW/Presentations/blob/master/2022-hardwear-io-bd-jb.pdf Slides presented at hardwear.io by TheFloW (2022-06-10)]


==== Bug Description ====
==== Bug Description ====
* TODO
TO ADD DESCRIPTION OF EACH ONE OF THE 5 BUGS:


Implementation description by Debty:<br />
* #1 com.sony.gemstack.org.dvb.user.UserPreferenceManagerImpl userprefs hijack leading to classes instantiation under privileged context (affecting ?PS3?, PS4, PS5)
String exploit is not actually an exploit but just a memory exhauster. It is not actually viable so instead there is a feature called "latest iteration".
* #2 com.oracle.security.Service leading to privileged constructor call (affecting ?PS3?, PS4, not PS5)
* #3 com.sony.gemstack.org.dvb.io.ixc.IxcProxy leading to privileged method call (affecting ?PS3?, PS4, PS5)
* #4 JIT compiler hack leading to usermode arbitrary RW and arbitrary usermode code execution (affecting ?PS3?, PS4, not PS5)
* #5 UDF buffer overflow kernel exploit (affecting ?PS3?, PS4, PS5)
 
This exploit chain alone does not allow one to run pirated games on PS4 or PS5 as there is not enough RAM allowed in the BD-J process and there are other constraints.


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://github.com/Debvt/Wm/tree/Root0 PoC by Debty (2024-08-29)]
* [https://github.com/TheOfficialFloW/bd-jb Implementation of BD-J usermode code execution on PS4 using bugs #1, #2, #3 and #4 by TheFloW (2021-10-24)]
* [https://github.com/TheOfficialFloW/bd-jb/blob/master/src/com/bdjb/exploit/sandbox/ExploitUserPrefsImpl.java Vuln #1 com.sony.gemstack.org.dvb.user.UserPreferenceManagerImpl implementation by TheFloW]
* [https://github.com/TheOfficialFloW/bd-jb/blob/master/src/com/bdjb/exploit/sandbox/ExploitServiceProxyImpl.java Vuln #2 com.oracle.security.Service and #3 com.sony.gemstack.org.dvb.io.ixc.IxcProxy chained together by TheFloW]
* [https://github.com/TheOfficialFloW/bd-jb/blob/master/src/com/bdjb/jit/JitCompilerReceiverImpl.java Vuln #4 JIT compiler hack implementation by TheFloW]
* [https://github.com/sleirsgoevy/bd-jb Implementation of BD-J usermode code execution on PS4 using bugs #2, #3 and #4 by sleirsgoevy (2022-06-16)]
* Note that no implementation of the UDF kernel exploit has ever been done even by TheFloW, only a kernel panic PoC.


==== Patched ====
==== Patched ====
'''Yes''' on PS4 FW 12.00 and PS5 FW 10.00.
'''No''' as of PS4 FW 9.00 and PS5 FW 4.03. At least partially patched on PS4 FW 9.50 and PS5 FW 5.00.


==== Tested ====
On PS4 FW 9.03 and PS5 FW ?4.50?, the bug #5 (UDF) has been patched.
Tested working on PS4 FWs 10.00-11.52 and PS5 FWs 6.00-9.60.
----


=== FW ?6.00-11.52? - Integer underflow in JSC genericTypedArrayViewProtoFuncCopyWithin (CVE-2023-38600) ===
== Usermode Exploits (WebKit) ==


==== Credits ====
=== WebKit sources ===
* anonymous researcher for discovering the vulnerability and reporting it to Zero Day Initiative (2023-05)
* Yusuke Suzuki and Mark Lam for fixing the bug in WebKit (2023-07-31)
* Hossein Lotfi for publishing a writeup (2023-10-18)


==== Analysis ====
[https://web.archive.org/web/20231108165430/https://doc.dl.playstation.net/doc/ps4-oss/webkit.html WebKit sources] Currently archived up to version 10.01. Useful for developers that can't access PlayStation URLs and also for when Sony inevitably stops hosting the sources in the future.
* [https://www.zerodayinitiative.com/blog/2023/10/17/cve-2023-38600-story-of-an-innocent-apple-safari-copywithin-gone-way-outside Writeup by Hossein Lotfi (2023-10-18)]
* [https://github.com/WebKit/WebKit/commit/6e7e654417b61630d67f02b65798439cf3d6b0b5 WebKit fix commit by Yusuke Suzuki (2023-07-31)]


==== Bug Description ====
=== FW ?10.00?-11.52 - Unknown heap and string overflow (no CVE) leading to crash ===
It is required to recompute length properly when resize happens during TypedArray copyWithin.


copyWithin's side effectful operation can resize resizable ArrayBuffer. WebKit has a code catching this and recompute the appropriate copy count again, but it can overflow if `to` or `from` are larger than the newly updated `length`. The patch handles this case correctly: returning since there is no copying content in this case.
==== Credits ====
* Debty for PoC public disclose (2024-08-29)


The issue was patched by aborting the copy if either of the two variables to or from is larger than the updated length.
==== Analysis ====
* [https://github.com/Debvt/Wm/tree/Root0 PoC and analysis by Debty (2024-08-29)]


The values used during the exploit were sane as they went through a sanitizer function. However, in the final stage, the values were updated without checking if there are inside the buffer length bounds.
==== Bug Description ====
* TODO


According to PS4 WebKit source code for System Software version 11.00, not only it is not patched but it uses code from 2021! Looking at [https://github.com/WebKit/WebKit/blob/cccb58deac3c56a831678458ce95ea5b7c837614/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h#L177 a version close to one in the PS4 source code for System Software version 11.00], it should be exploitable.
Implementation description by Debty:<br />
String exploit is not actually an exploit but just a memory exhauster. It is not actually viable so instead there is a feature called "latest iteration".


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://gist.github.com/zdi-team/ad320bdc6ad095cc210c7031e0f0ecda/raw/746ce622fe73344ccb9cd51bc03ad97950f4ea3b/CVE-2023-38600-0.js Minimal PoC by Hossein Lotfi (2023-10-18)]
* [https://github.com/Debvt/Wm/tree/Root0 PoC by Debty (2024-08-29)]
* [https://github.com/WebKit/WebKit/blob/main/JSTests/stress/resizable-array-buffer-copy-within-length-update.js Vulnerability test code by Yusuke Suzuki (2023-07-31)]


==== Patched ====
==== Patched ====
'''Maybe''' in FW 11.50.
'''Yes''' on PS4 FW 12.00 and PS5 FW 10.00.


==== Tested ====
Tested working on PS4 FWs 10.00-11.52 and PS5 FWs 6.00-9.60.
Not tested yet on PS4 nor PS5. To test on PS4 11.00.
----


=== FW ?10.00-11.02? - JSC::DFG::clobberize() needs to be more precise with the *ByOffset nodes (CVE-2023-41993) leading to arbitrary RW ===
=== FW 10.00-11.02 - JSC DFG Abstract Intepreter clobberWorld Type Confusion (no CVE) leading to arbitrary RW ===


==== Credits ====
==== Credits ====
* Bill Marczak of The Citizen Lab at The University of Toronto's Munk School and Maddie Stone of Google's Threat Analysis Group for discoverting the vulnerability and reporting it (2023-09-21)
* ENKI for public disclose and analysis (2024-06-03)
* Keith Miller for the WebKit fix commit (2023-10-09)
* po6ix for his writeup (2023-10-15)


==== Analysis ====
==== Analysis ====
* [https://github.com/WebKit/WebKit/commit/08d5d17c766ffc7ca6a7c833c5720eb71b427784 WebKit fix commit by Keith Miller (2023-10-09)]
* [https://medium.com/@enki-techblog/ios-16-5-1-safari-rce-analysis-cve-2023-37450-89bb8583bebc Analysis by ENKI (2024-06-03)]
* [https://github.com/po6ix/POC-for-CVE-2023-41993 Writeup by po6ix (2023-10-15)]
* [https://github.com/WebKit/WebKit/commit/1b0741f400ee2d31931ae30f2ddebe66e8fb0945 Patch commit #1 (2023-07-31)]
* [https://github.com/WebKit/WebKit/commit/39476b8c83f0ac6c9a06582e4d8e5aef0bb0a88f Patch commit #2 (2023-05-01)]
* [https://www.zerodayinitiative.com/blog/2018/4/12/inverting-your-assumptions-a-guide-to-jit-comparisons Inverting Your Assumptions: A Guide to JIT Comparisons by Jasiel Spelman (2018-04-12)]


==== Bug Description ====
==== Bug Description ====
clobberize needs to be more precise with the *ByOffset nodes. CSE phase uses clobberize to figure out if it's safe to merge two operations that def the same HeapLocation. Since HeapLocation does not currently have a way to track the offset used by the various *ByOffset nodes it can get confused and think that two ByOffset instructions produce the same value even if they do not use the same offset. This patch solves this by adding a new field to HeapLocation, which takes the metadata associated with the corresponding *ByOffset node. If two *ByOffset operations don't share the same metadata then they cannot be CSEed.
* TODO
 
This vulnerability is ranked 7.5 (HIGH) on CVSS:3.1.
 
This vulnerability should provide r/w primitive to the webcontent process, but currently the PoC is written only up to addrof/fakeobj.


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://github.com/po6ix/POC-for-CVE-2023-41993 PoC written only up to addrof/fakeobj by po6ix (2023-10-15)]
* [https://medium.com/@enki-techblog/ios-16-5-1-safari-rce-analysis-cve-2023-37450-89bb8583bebc PoC by ENKI (2024-06-03)]


==== Patched ====
==== Patched ====
'''Maybe''' on PS4 FW 12.00 and PS5 ?10.00?
'''Yes''' on PS4 FW 11.50 and PS5 FW 9.00.


==== Tested ====
Tested working on PS4 FWs 10.00-11.02 and PS5 FWs 6.00-8.60. PS4 FWs <= ?9.60? and PS5 FWs <= ?5.50? are invulnerable.
Not tested yet. According to open source code, PS4 FW 11.00 should be vulnerable.
----


=== FW 10.00-11.02 - JSC DFG Abstract Intepreter clobberWorld Type Confusion (no CVE) leading to crash ===
=== FW 6.00-9.60 - FrameLoader::loadInSameDocument() UaF (CVE-2022-22620) leading to arbitrary RW ===
 
==== Credits ====
* Alexey Shvayka for vulnerability discovery and fixes in WebKit (2023-05-01)
* ENKI for public disclose and writeup (2024-06-03)
* abc (anonymous) for tests and analysis (2024-10-01)
 
==== Analysis ====
* [https://medium.com/@enki-techblog/ios-16-5-1-safari-rce-analysis-cve-2023-37450-89bb8583bebc Analysis by ENKI (2024-06-03)]
* [https://github.com/WebKit/WebKit/commit/1b0741f400ee2d31931ae30f2ddebe66e8fb0945 Patch commit #1 for vulnerability detection (2023-07-31)]
* [https://github.com/WebKit/WebKit/commit/39476b8c83f0ac6c9a06582e4d8e5aef0bb0a88f Patch commit #2 (2023-05-01)]
* [https://www.zerodayinitiative.com/blog/2018/4/12/inverting-your-assumptions-a-guide-to-jit-comparisons Inverting Your Assumptions: A Guide to JIT Comparisons by Jasiel Spelman (2018-04-12)]
 
==== Bug Description ====
Note that the PS4 web browser JIT support has been removed since around PS4 System Software version 5.00 or lower so using the article directly is not applicable.
 
The clobber bug PoC turns out not to be a memory corruption. Just like the article said, you can access a `GetterSetter` directly. The crash came from triggering `GetterSetter`'s methods that will call `RELEASE_ASSERT()`.
 
We actually have [[#FW_?6.00-11.52?_-_get_by_id_with_this_associated_with_ProxyObject_can_leak_JSScope_objects|a bug that can leak `GetterSetter`s]].
 
In summary with tinkering with this bug, abc (anonymous) do not think that an attacker can do anything useful with accessing a `GetterSetter`. The clobberWorld bug however does allow setting properties in places where you usually cannot like `Function's prototype` as shown in the article. But without JIT, one probably cannot cause any memory corruption. The impact for both bugs (clobberWorld and ProxyObject) is probably just JavaScript execution, which we already have, which is a no go in some context (JS injection) but it does not help in gaining usermode ROP execution on PS4 or PS5.
 
==== Exploit Implementation ====
* [https://medium.com/@enki-techblog/ios-16-5-1-safari-rce-analysis-cve-2023-37450-89bb8583bebc PoC by ENKI (2024-06-03)]
 
==== Patched ====
'''Yes''' on PS4 FW 11.50 and PS5 FW 9.00.
 
==== Tested ====
Tested working on PS4 FWs 10.00-11.02 and PS5 FWs 6.00-8.60. PS4 FWs <= ?9.60? and PS5 FWs <= ?5.50? are invulnerable.
----
 
=== FW 6.00-9.60 - FrameLoader::loadInSameDocument() UaF (CVE-2022-22620) leading to arbitrary RW ===


==== Credits ====
==== Credits ====
* Sergei Glazunov, Google Project Zero, for reporting the bug in 2013-01 and answering Maddie Stone's questions in 2022 (2013)
* Sergei Glazunov, Google Project Zero, for reporting the bug in 2013-01 and answering Maddie Stone's questions in 2022 (2013)
* Maddie Stone, Google Project Zero, for sharing a write-up describing this vulnerability (2022-06-14)
* Maddie Stone, Google Project Zero, for sharing a write-up describing this vulnerability (2022-06-14)
* abc (anonymous) for making an OOM PoC for webkit-gtk, PS4 and PS5 (2023-10-03) then making an arbitrary RW PoC (PSFree) for webkit-gtk, PS4 6.00-9.60 and PS5 1.00-5.50 (2023-10-24)
* Abc (anonymous person) for making an OOM PoC for webkit-gtk, PS4 and PS5 (2023-10-03) then making an arbitrary RW PoC (PSFree) for webkit-gtk, PS4 6.00-9.60 and PS5 1.00-5.50 (2023-10-24)
* CelesteBlue for testing and porting abc' PSFree to PS4 6.00-9.60 and PS5 1.00-5.50 (2023-11-04)
* CelesteBlue for testing and porting abc' PSFree to PS4 6.00-9.60 and PS5 1.00-5.50 (2023-11-04)


Line 545: Line 457:
The patch changes the stateObject argument to loadInSameDocument from a raw pointer, SerializedScriptValue*, to a reference-counted pointer, RefPtr<SerializedScriptValue>, so that loadInSameDocument now increments the reference count on the object.
The patch changes the stateObject argument to loadInSameDocument from a raw pointer, SerializedScriptValue*, to a reference-counted pointer, RefPtr<SerializedScriptValue>, so that loadInSameDocument now increments the reference count on the object.


==== Tested ====
Tested working on PS4 FWs 6.00-9.60 and PS5 FWs 1.00-5.50. PS4 FWs <= 5.56 are invulnerable as the HTML input field stays focused (blue outline) after second timeout whilst it should not if the console were exploitable.
Tested working on PS4 FWs 6.00-9.60 and PS5 FWs 1.00-5.50. PS4 FWs <= 5.56 are invulnerable as the HTML input field stays focused (blue outline) after second timeout whilst it should not if the console were exploitable.
----


=== FW 9.00-9.04 - WebCore::CSSFontFaceSet vulnerabilities leading to arbitrary RW ===
=== FW 9.00-9.04 - WebCore::CSSFontFaceSet vulnerabilities leading to arbitrary RW ===
Line 570: Line 480:
* [https://github.com/WebKit/WebKit/commit/fbf37d27e313d8d0a150a74cc8fab956eb7f3c59 WebKit fix commit by Myles C. Maxfield merged by Russell Epstein (2021-09-09)]
* [https://github.com/WebKit/WebKit/commit/fbf37d27e313d8d0a150a74cc8fab956eb7f3c59 WebKit fix commit by Myles C. Maxfield merged by Russell Epstein (2021-09-09)]
* [https://github.com/WebKit/WebKit/blob/74bd0da94fa1d31a115bc4ee0e3927d8b2ea571e/Source/WebCore/css/CSSFontFaceSet.cpp#L223 Part of vulnerable code]
* [https://github.com/WebKit/WebKit/blob/74bd0da94fa1d31a115bc4ee0e3927d8b2ea571e/Source/WebCore/css/CSSFontFaceSet.cpp#L223 Part of vulnerable code]
* [https://web.archive.org/web/20211020134808/https://googleprojectzero.github.io/0days-in-the-wild//0day-RCAs/2021/CVE-2021-30858.html (archive) Write-up and PoC by Maddie Stone (2021-10-13)]. Maddie Stone's vulnerability is not CVE-2021-30858 but instead might be CVE-2021-30889. See [https://github.com/googleprojectzero/0days-in-the-wild/commit/65fcdf0473ada4e80dc967662ea8f3f3ce4ea81e#diff-1a428c43cedcf140e5bd6f92e4527f169c3c717780e1586f2fab589e4f467b52 write-up edit commit]. Warning: Maddie Stone's vulnerability was wrongly classified as a use-after-free by Maddie Stone according to sleirsgoevy.
* [https://web.archive.org/web/20211020134808/https://googleprojectzero.github.io/0days-in-the-wild//0day-RCAs/2021/CVE-2021-30858.html (archive) Write-up and PoC by Maddie Stone (2021-10-13)]. Maddie Stone's vulnerability is not CVE-2021-30858 but was guessed to be by Maddie Stone. See [https://github.com/googleprojectzero/0days-in-the-wild/commit/65fcdf0473ada4e80dc967662ea8f3f3ce4ea81e#diff-1a428c43cedcf140e5bd6f92e4527f169c3c717780e1586f2fab589e4f467b52 write-up edit commit]. Warning: Maddie Stone's vulnerability was wrongly classified as a use-after-free by Maddie Stone according to sleirsgoevy.
* [https://wololo.net/2021/10/14/use-after-free-webkit-vulnerability-impacts-ps4-possibly-up-to-firmware-9-00-included/ Vulnerability description by Wololo (2021-10-14)]
* [https://wololo.net/2021/10/14/use-after-free-webkit-vulnerability-impacts-ps4-possibly-up-to-firmware-9-00-included/ Vulnerability description by Wololo (2021-10-14)]


Line 576: Line 486:
Description in WebKit fix commit by Myles C. Maxfield:
Description in WebKit fix commit by Myles C. Maxfield:


After r256659, asking for a failed CSSFontFace's families() returns nullopt. It is possible to add a failed font to a CSSFontFaceSet (of course). When we do that, we recognize the font is failed and do not update our internal data structures, because there's no need to - we cannot do anything useful with a failed font. If you _then_ try to remove the font from the CSSFontFace, we do not call families(), but instead just pull out the raw m_families member, and look in our internal data structures for it, but we do not find it, because it was never added.
After r256659, asking for a failed CSSFontFace's families() returns nullopt. It's possible to add a failed font to a CSSFontFaceSet (of course). When we do that, we recognize the font is failed and do not update our internal data structures, because there's no need to - we cannot do anything useful with a failed font. If you _then_ try to remove the font from the CSSFontFace, we do not call families(), but instead just pull out the raw m_families member, and look in our internal data structures for it, but we do not find it, because it was never added.


Description in Maddie Stone's write-up:
Description in Maddie Stone's write-up:
Line 588: Line 498:
==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://web.archive.org/web/20211024215236/http://vdsina.sleirsgoevy.dynv6.net:8081/ (archive) First exploit PoC for Safari by sleirsgoevy (2021-10-24)]
* [https://web.archive.org/web/20211024215236/http://vdsina.sleirsgoevy.dynv6.net:8081/ (archive) First exploit PoC for Safari by sleirsgoevy (2021-10-24)]
* [https://gist.github.com/sleirsgoevy/6beca32893909095f4bba1ce29167992 First exploit PoC for PS4 FW 9.00-9.04 and PS5 FW 3.00-4.51 by sleirsgoevy (2021-10-27)]
* [https://gist.github.com/sleirsgoevy/6beca32893909095f4bba1ce29167992 First exploit PoC for PS4 FW 9.00-9.04 and PS5 FW 3.00-4.50 by sleirsgoevy (2021-10-27)]
* [https://github.com/ChendoChap/pOOBs4/blob/main/webkit.js Implementation for PS4 FW 9.00 with exFAT kernel exploit in pOOBs4 by ChendoChap (2022-01-17)]
* [https://github.com/ChendoChap/pOOBs4/blob/main/webkit.js Implementation for PS4 FW 9.00 with exFAT kernel exploit in pOOBs4 by ChendoChap (2022-01-17)]


==== Patched ====
==== Patched ====
'''Yes''' on PS4 FW 9.50 and '''No''' as of PS5 FW 4.51 (need to test on PS5 FWs >=5.00). Not working on PS4 FWs <9.00 and PS5 FWs <2.10.
'''Yes''' on PS4 FW 9.50 and '''No''' as of PS5 FW 4.50.


Might have been introduced in PS4 FW 3.50 and before PS5 FW 1.00 according to dates (need to check). However the vulnerability cannot be exploited in some conditions depending on how WebKit was compiled. For example, on PS4 FWs 7.55-8.52 and PS5 FWs <= 2.00, the FontFaceSet constructor returns with an exception that is propagated to JavaScript, preventing exploitation this way.
Might have been introduced in PS4 FW 3.50 and before PS5 FW 1.00 according to dates (need to check). However the vulnerability cannot be exploited in some conditions depending on how WebKit was compiled. For example, on PS4 FWs 7.55-8.53 and PS5 FWs <= 2.00, the FontFaceSet constructor returns with an exception that is propagated to JavaScript, preventing exploitation this way.
 
 
==== Tested ====
Tested working on PS4 FWs 9.00-9.04 and PS5 FWs 3.00-4.50. Untested: PS5 FWs 2.10-2.50, 4.51.
Tested working on PS4 FWs 9.00-9.04 and PS5 FWs 3.00-4.51. Untested: PS5 FWs 2.10-2.50 and >=5.00.
----


=== FW 6.00-7.55 - WebCore::ValidationMessage::buildBubbleTree() UaF leading to arbitrary RW ===
=== FW 6.00-7.55 - WebCore::ValidationMessage::buildBubbleTree() UaF leading to arbitrary RW ===
Line 626: Line 534:


==== Patched ====
==== Patched ====
'''Yes''' in 8.00 FW.
'''Yes''' in 8.00 FW. Tested working on FWs 6.00-7.55, not working on FWs <= 5.56. HTML textarea guessed addresses for FWs 6.70-7.55 are known but not for FWs 6.00-6.51 so an attacker needs to make tests to determine these addresses on FWs 6.00-6.51.
 
==== Tested ====
Tested working on FWs 6.00-7.55, not working on FWs <= 5.56. HTML textarea guessed addresses for FWs 6.70-7.55 are known but not for FWs 6.00-6.51 so an attacker needs to make tests to determine these addresses on FWs 6.00-6.51.
----


=== FW 6.00-6.72 - bad_hoist Type Confusion exploit (CVE-2018-4386) leading to arbirary RW ===
=== FW 6.00-6.72 - bad_hoist Type Confusion exploit (CVE-2018-4386) leading to arbirary RW ===
Line 673: Line 577:


==== Patched ====
==== Patched ====
'''Yes''' in 7.00 FW.
'''Yes''' in 7.00 FW. Vulnerable on PS4 FWs 4.50-6.72. Not vulnerable on FWs <= 4.07. Not vulnerable on FWs >=7.00 according to manual tests but need to check WebKit sources.
 
==== Tested ====
Vulnerable on PS4 FWs 4.50-6.72. Not vulnerable on FWs <= 4.07. Not vulnerable on FWs >=7.00 according to manual tests but need to check WebKit sources.
----
----


Line 699: Line 600:


==== Patched ====
==== Patched ====
'''Yes''' in 6.50 FW.
'''Yes''' in 6.50 FW. It does not work on <= 4.07 FW PS4 according to tests as the exploit fails at step "Triggering memory corruption".
 
==== Tested ====
It does not work on <= 4.07 FW PS4 according to tests as the exploit fails at step "Triggering memory corruption".
----
----


Line 845: Line 743:
----
----


=== FW <= ?4.05? - Type confusion in WebCore::HTMLInputElement::onSearch (CVE-2017-2354) ===
=== FW 3.15-3.70 - JSArray::sortCompactedVector() Heap UaF leading to arbitrary RW ===


==== Credits ====
==== Credits ====
* Neymar of Tencent's Xuanwu Lab working with Trend Micro's Zero Day Initiative for discovering this vulnerability (2016-11)
* xyz for the original exploit on PSVita (HENkaku)
* Brent Fulgham for fixing the bug in WebKit (2016-11-14)
* Fire30 for porting to PS4
* Jasiel Spelman (@WanderingGlitch) for his writeup (2017-12-20)
* Specter for improved PS4 playground


==== Analysis ====
==== Analysis ====
* [https://www.zerodayinitiative.com/blog/2017/12/20/invariantly-exploitable-input-an-apple-safari-bug-worth-revisiting Writeup by Jasiel Spelman (2017-12-20)]
* [https://blog.xyz.is/2016/webkit-360.html PSVita 3.60 HENKaku WebKit exploit writeup]
* [https://github.com/WebKit/WebKit-http/commit/cf2bf6e58f51267d7ae25fcb82a315377c8e5cf6 WebKit fix commit by Brent Fulgham (2016-11-14)]


==== Bug Description ====
==== Bug Description ====
It is possible for JavaScript to change the type property of an input field. WebKit needs to gracefully handle this case.
When attempting to update a vector via sortCompactedVector() - data is written based on a pointer, though the pointer is not re-updated nor nulled. When this memory in free()'d, the reference is maintained and thus memory corruption can occur.
 
This bug could have been prevented had it a debug check been used instead of a runtime check. In fact, WebKit has support for this type of assertion already through a RELEASE_ASSERT macro, which would have turned this exploitable bug into a simple denial-of-service by immediately and safely crashing the browser.
 
The fix commit of the vulnerability adds a type traits specialization so that WebKit can properly downcast InputType elements. This should be used only to call search functions on actual search input types.
 
Although the access violation in WebCore::TimerBase::heapPop is where we see the result of the bug, it is not the cause of the issue. The crash actually occurs as a result of reading a pointer that comes from the 'this' object. Based on that, it would seem that something is wrong with the Timer object passed into the WebCore::TimerBase::heapPop function.
 
This vulnerability may be the one used by Chaintin Tech with a kernel exploit on PS4 FW 4.01 at GeekPwn 2016, a Tencent Security's conference, in Shanghai Station at the Pavilion Safety Research Lab, (https://www.chaitin.cn/ps4, https://www.psxhax.com/threads/ps4-4-01-linux-installation-ksploit-demo-at-geekpwn-2016.932/)


==== Exploit Implementation ====
==== Exploit Implementation ====
* PoC by Neymar (2016-11, disclosed publicly by Jasiel Spelman on 2017-12-20):
* [https://github.com/henkaku/henkaku/blob/master/webkit/exploit.js PSVita 3.60 WebKit exploit by xyz]
<source lang="js">
* [https://github.com/Fire30/PS4-3.55-Code-Execution-PoC PS4 playground 3.15-3.70 by Fire30]
<input id="m_input" type="search"></input>
* [https://github.com/Cryptogenic/PS4-Playground-3.55 Improved PS4 playground 3.15-3.70 by Specter]
<script type="text/javascript">
first = true;
m_input.addEventListener("input", function (e) {
if(first) {
first = false;
}
else {
m_input["type"] = "image";
}
}, false);
</script>
</source>
* [https://github.com/WebKit/WebKit-http/blob/master/LayoutTests/fast/forms/search-cancel-button-change-input.html Vulnerability test by Brent Fulgham (2016-11-15)]


==== Patched ====
==== Patched ====
'''Maybe''' in 4.06 FW
'''Yes''' in 4.0?0? FW


==== Tested ====
==== Tested ====
Not yet.
Works on 3.15-3.70. Not working on <= 3.11. Maybe working on 4.00.
----
 
=== FW 3.15-3.70 - JSArray::sortCompactedVector() Heap UaF leading to arbitrary RW ===
 
==== Credits ====
* xyz for the original exploit on PSVita (HENkaku)
* Fire30 for porting to PS4
* Specter for improved PS4 playground
 
==== Analysis ====
* [https://blog.xyz.is/2016/webkit-360.html PSVita 3.60 HENkaku WebKit exploit writeup]
 
==== Bug Description ====
When attempting to update a vector via sortCompactedVector() - data is written based on a pointer, though the pointer is not re-updated nor nulled. When this memory in free()'d, the reference is maintained and thus memory corruption can occur.
 
==== Exploit Implementation ====
* [https://github.com/henkaku/henkaku/blob/master/webkit/exploit.js PSVita 3.60 WebKit exploit by xyz]
* [https://github.com/Fire30/PS4-3.55-Code-Execution-PoC PS4 playground 3.15-3.70 by Fire30]
* [https://github.com/Cryptogenic/PS4-Playground-3.55 Improved PS4 playground 3.15-3.70 by Specter]
 
==== Patched ====
'''Yes''' in 4.0?0? FW
 
==== Tested ====
Works on 3.15-3.70. Not working on <= 3.11. Maybe working on 4.00.
----
----


=== FW <= 3.50 - WebCore::TimerBase::heapPopMin() Heap UaF leading to crash ===
=== FW <= 3.50 - WebCore::TimerBase::heapPopMin() Heap UaF leading to crash ===
==== Credits ====
* Brent Fulgham for fixing the bug in WebKit (2016-05-16)


==== Analysis ====
==== Analysis ====
* [https://github.com/WebKit/WebKit-http/commit/98845d940e30529098eea7e496af02e14301c704 WebKit fix commit (2016-05-17)]
* [https://github.com/WebKit/WebKit-http/commit/98845d940e30529098eea7e496af02e14301c704 WebKit fix commit (17-05-2016)]
* [https://xz.aliyun.com/t/292 Summary of Critical and Exploitable iOS Vulnerabilities in 2016 by Min (Spark) Zheng, Cererdlong, Eakerqiu @ Team OverSky]
* [https://xz.aliyun.com/t/292 Summary of Critical and Exploitable iOS Vulnerabilities in 2016 by Min (Spark) Zheng, Cererdlong, Eakerqiu @ Team OverSky]


Line 930: Line 778:


==== Exploit Implementation ====
==== Exploit Implementation ====
* [http://psxhax.com/threads/ps4-3-50-webkit-exploit-from-playstation-4-dev-qwertyoruiop.450/ Article about qwertyoruiop's tests (2016-05-20)]
* [http://psxhax.com/threads/ps4-3-50-webkit-exploit-from-playstation-4-dev-qwertyoruiop.450/ Article about qwertyoruiop's tests (20-05-2016)]
* [http://psxhax.com/threads/ps4-heap-use-after-free-at-webcore-3-50-poc-by-hunter128.452/ Article about initial PoC for PS4 (2016-05-21)]
* [http://psxhax.com/threads/ps4-heap-use-after-free-at-webcore-3-50-poc-by-hunter128.452/ Article about initial PoC for PS4 (21-05-2016)]
* [http://wololo.net/talk/viewtopic.php?t=45888 Initial PoC for PS4 (2016-05-21)]
* [http://wololo.net/talk/viewtopic.php?t=45888 Initial PoC for PS4 (21-05-2016)]
* [https://web.archive.org/web/20161030085033/http://cryptoanarchic.me/wat.txt iOS 9.3.2 WebKit RCE via heapPopMin (2016-07)]
* [https://web.archive.org/web/20161030085033/http://cryptoanarchic.me/wat.txt iOS 9.3.2 WebKit RCE via heapPopMin (07-2016)]
* [https://twitter.com/qwertyoruiopz/status/756268361282125824 qwertyoruiop's tweet (2016-07-22)]
* [https://twitter.com/qwertyoruiopz/status/756268361282125824 qwertyoruiop's tweet (22-07-2016)]
* [https://github.com/Jailbreaks/jbme/tree/master mirror of iOS 9.3.2 WebKit RCE via heapPopMin]
* [https://github.com/Jailbreaks/jbme/tree/master mirror of iOS 9.3.2 WebKit RCE via heapPopMin]


Line 1,043: Line 891:


* Vitaliy Toropov for the exploit on Mac OS X Safari (September 4, 2013)
* Vitaliy Toropov for the exploit on Mac OS X Safari (September 4, 2013)
* nas and Proxima for the first PS4 POC on 1.76 PS4 (October 23, 2014)
* nas and Proxima for the first PS4 POC on 1.76 PS4 (Oct. 23, 2014)
* sony for patching the exploit in FW 2.00 (October 27, 2014)
* sony for patching the exploit in FW 2.00 (Oct 27, 2014)
* CTurt for the rewriting (PS4 1.76 PlayGround) and implementation with his 1.76 kexploit (December 6, 2015) [https://twitter.com/CTurtE/status/673581693207502849]
* CTurt for the rewriting (PS4 1.76 PlayGround) and implementation with his 1.76 kexploit (December 6, 2015) [https://twitter.com/CTurtE/status/673581693207502849]


Line 1,068: Line 916:


==== Tested ====
==== Tested ====
* Working on PS4 1.00-1.76 FW, AppleWebKit/531.3-536.26
* Working on 1.00-1.76 FW, AppleWebKit/531.3-536.26
* Might work on PS4 FW 0.930.020.
* Might work on FW 0.930.020.
 
=== Possible WebKit vulnerabilities ===
 
Affecting WebKitGTK: CVE-2023-41074, CVE-2023-42917.


== Usermode securities ==
== Usermode securities ==
Line 1,138: Line 982:


== Kernel Exploits ==
== Kernel Exploits ==
=== FW <= 11.52 - Double free in bnet_netevent_set_queue ===
==== Credits ====
* Anonymous for sharing 11.52 and 12.00 PS4 kernel dumps.
* 2024-09-27 D-Link Turtle for diffing 11.52 and 12.00 PS4 kernel dumps.
* 2024-10-04 SlidyBat for figuring out the bug in bnet and its impact.
==== Analysis ====
* [https://x.com/iMrDJAi/status/1842306232125964473/photo/1 Analysis by abc (2024-10-04)]
==== Bug Description ====
A double free can happen by racing calls to bnet_netevent_set_queue and bnet_netevent_unset_queue.
The lack of mutexes allowed double free as fdrop is called unconditionally in bnet_netevent_unset_queue.
See also PS Vita SceNetPs kernel module that uses similar bnet functions.
==== Exploit Implementation ====
==== Patched ====
'''Yes''' in 12.00 FW. Maybe not working at all on PS5.
The bug was patched in PS4 FW 12.00 by adding some mutexes in bnet_netevent functions
----


=== FW <= 11.00 - Remote vulnerabilities in spp (yielding kernel ASLR defeat) (CVE-2006-4304 and no-CVE) ===
=== FW <= 11.00 - Remote vulnerabilities in spp (yielding kernel ASLR defeat) (CVE-2006-4304 and no-CVE) ===
Line 1,177: Line 996:
* [https://www.freebsd.org/security/advisories/FreeBSD-SA-06:18.ppp.asc FreeBSD Security Advisory for CVE-2006-4304 (2006-08-23)]
* [https://www.freebsd.org/security/advisories/FreeBSD-SA-06:18.ppp.asc FreeBSD Security Advisory for CVE-2006-4304 (2006-08-23)]
* [https://hackerone.com/reports/2177925 HackerOne report about Remote vulnerabilities in spp by TheFloW (2023-09-22)]
* [https://hackerone.com/reports/2177925 HackerOne report about Remote vulnerabilities in spp by TheFloW (2023-09-22)]
* [https://romhack.io/wp-content/uploads/sites/3/2024/10/Andy-Nguyen-PlayStation-4-Remote-Kernel-Exploitation-RomHack-2024.pdf Slides of TheFloW's presentation at RomHack 2024 (2024-09-28)]
* [https://www.youtube.com/watch?v=LRdbnGkk7JA Video of TheFloW's presentation at RomHack 2024 (2024-09-28)]


==== Bug Description ====
==== Bug Description ====
Line 1,460: Line 1,277:


==== Analysis ====
==== Analysis ====
* [https://fail0verflow.com/blog/2017/ps4-namedobj-exploit/ fail0verflow's writeup on the PS4 1.01-4.05 namedobj kernel exploit] (2017-10-19)
* [https://fail0verflow.com/blog/2017/ps4-namedobj-exploit/ fail0verflow's writeup on the 1.01-4.05 namedobj kernel exploit] (2017-10-19)
* [https://github.com/Cryptogenic/Exploit-Writeups/blob/master/PS4/NamedObj%20Kernel%20Exploit%20Overview.md Specter's first writeup] (2017-10-20)
* [https://github.com/Cryptogenic/Exploit-Writeups/blob/master/PS4/NamedObj%20Kernel%20Exploit%20Overview.md Specter's first writeup] (2017-10-20)
* [https://github.com/Cryptogenic/Exploit-Writeups/blob/master/PS4/%22NamedObj%22%204.05%20Kernel%20Exploit%20Writeup.md Specter's writeup on his PS4 4.05 implementation] (2017-12-28)
* [https://github.com/Cryptogenic/Exploit-Writeups/blob/master/PS4/%22NamedObj%22%204.05%20Kernel%20Exploit%20Writeup.md Specter's writeup on his 4.05 implementation] (2017-12-28)
* [https://github.com/RPCSX/rpcsx/blob/0bbab3eae53d01afbcdb16e97043b58e26fb54bd/orbis-kernel/src/sys/sys_sce.cpp#L469 Reimplementation of the sys_namedobj_create function in the RPCSX emulator]
* [https://wololo.net/2023/09/04/ps4-ps5-reverse-engineering-101-the-basics-of-ps4-exploits/ Short analysis by wololo (2023-09-04)]


==== Bug Description ====
==== Bug Description ====
Line 1,470: Line 1,285:


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://github.com/Cryptogenic/PS4-4.05-Kernel-Exploit PS4 4.05 WebKit + Kernel Exploit]
[https://github.com/Cryptogenic/PS4-4.05-Kernel-Exploit PS4 4.05 WebKit + Kernel Exploit]


==== Patched ====
==== Patched ====
Line 1,479: Line 1,294:
----
----


=== FW <= ?4.05? - amd64_set_ldt Heap Overflow (CVE-2016-1885) ===
=== FW <= 1.76 - dlclose Kernel Heap Overflow ===


==== Credits ====
==== Credits ====
* 2016-10-25 This vulnerability was discovered and researched by Francisco Falcon from Core Exploit Writers Team
* Discovered by CTurt.
* 2016-10-25 Revised patch to address a problem pointed out by ahaha from Chaitin Tech.
* Privately implemented thanks to qwertyoruiop.
* CTurt published a writeup.
* The exploit was publicly implemented by kR105 and on another side by Zer0xFF and Bigboss (psxdev).


==== Analysis ====
==== Analysis ====
* https://www.freebsd.org/security/advisories/FreeBSD-SA-16:15.sysarch.asc
[http://cturt.github.io/dlclose-overflow.html Analysis of sys_dynlib_prepare_dlclose PS4 kernel heap overflow (by CTurt with the help of qwertyoruiop)]
* https://www.coresecurity.com/core-labs/advisories/freebsd-kernel-amd64setldt-heap-overflow
* https://web.archive.org/web/20161028222346/https://www.securityfocus.com/archive/1/archive/1/537812/100/0/threaded
* https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-1885
* https://www.mail-archive.com/[email protected]/msg132464.html
* https://svnweb.freebsd.org/base?view=revision&revision=296956
* https://wololo.net/2016/10/26/details-surface-ps4-4-01-jailbreak-potentially-enough-public-release-soon


==== Bug Description ====
==== Bug Description ====
The IA-32 architecture allows programs to define segments, which provides based and size-limited view into the program address space. The memory-resident processor structure, called Local Descriptor Table, usually abbreviated LDT, contains definitions of the segments. Since incorrect or malicious segments would breach system integrity, operating
Integer overflow in the sys_dynlib_prepare_dlclose() system call can lead to a heap overflow causing memory corruption, allowing an attacker to obtain code execution in supervisor mode (ring0).
systems do not provide processes direct access to the LDT, instead they provide system calls which allow controlled installation and removal of segments.


A special combination of sysarch(2) arguments, specify a request to uninstall a set of descriptors from the LDT. The start descriptor is cleared and the number of descriptors are provided. Due to lack of sufficient bounds checking during argument validity verification, unbound zero'ing of the process LDT and adjacent memory can be initiated from usermode.
==== Exploit Implementation ====
 
[https://github.com/kR105/PS4-dlclose Public release by kR105]
sysarch is syscall #165 on FreeBSD 9.1 and on PS4. Sony removed set_ldt between System Software version 1.76 and 4.05, according to Red-EyeX32.
 
==== Exploit Implementation ====


==== Patched ====
==== Patched ====
'''Yes''' in some FW <= 4.05 and >= 2.00 as set_ldt was removed. The PS4 is maybe not vulnerable because of a possible lack of 32bit implementation for syscalls.
'''Yes''' in 2.00 FW
 
==== Tested ====
Not yet.
----
----


=== <= 3.15 - .symtab kernel table of symbols kept on low FWs ===
=== FW <= 1.76 - BadIRET (CVE-2014-9322, CVE-2015-5675) ===


==== Credits ====
==== Credits ====
* CelesteBlue for backporting kernel exploits to dump PS4 3.50 kernel (2019-05-09) and 3.15 (2019-05-25)
* Andy Lutomirski for CVE-2014-9322 (2014-11-22)
* zecoxao and SocraticBliss for analysing kernel dumps
* Konstantin Belousov, Andrew Lutomirski for CVE-2015-5675 (2015-07-08)
* Adam Zabrocki (pi3) for asking CTurt to test CVE-2015-5675 on PS4 (2015-08-21) [https://twitter.com/Adam_pi3/status/634514173263769600], [https://twitter.com/Adam_pi3/status/641166271157960704]
* Volodymyr Pikhur for exploiting FreeBSD and PS4 in private (2015-09-24) [https://twitter.com/vpikhur/status/646925039103705088]
* CTurt for porting the exploit from FreeBSD 9 to PS4 (2015-12-06) [https://twitter.com/CTurtE/status/673581693207502849]


==== Bug description ====
==== Analysis ====
After Sony removed .strtab since FW 1.03 and .dynstr/.dynsym since FW 2.50 from PS4 kernel binary, they still kept the .symtab one.
* [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f442be2fb22be02cafa606f1769fa1e6f894441 Fix commit for Linux CVE-2014-9322 by Andy Lutomirski]
* [https://nvd.nist.gov/vuln/detail/CVE-2014-9322 NVD Bug Description for CVE-2014-9322]
* [https://web.archive.org/web/20171118232027/https://blogs.bromium.com/exploiting-badiret-vulnerability-cve-2014-9322-linux-kernel-privilege-escalation/ 2014-9322 analysis by Rafal Wojtczuk]
* [http://blog.pi3.com.pl/?p=509 CVE-2014-9322 analysis by Adam Zabrocki (pi3)]


==== Patched ====
* [http://seclists.org/oss-sec/2015/q3/66 CVE-2015-5675 PoC for FreeBSD by Konstantin Belousov, Andrew Lutomirski (2015-07-08)]
'''Yes''' in 3.50 FW.
* [https://www.freebsd.org/security/advisories/FreeBSD-SA-15:21.amd64.asc FreeBSD security advisory by Konstantin Belousov, Andrew Lutomirski (2015-08-25)]
----


=== <= 2.50 - .dynstr/.dynsym kernel table of symbols kept on low FWs ===
* [http://cturt.github.io/ps4-3.html Hacking the PS4, part 3 - Kernel exploitation (by CTurt) (2015-12-17]


==== Bug description ====
==== Bug Description ====
After Sony removed .strtab from PS4 kernel binary since FW 1.03, they still kept the .dynstr/.dynsym one.
Faults associated with the stack segment (SS) register are not handled properly, allowing unprivileged users to trigger an IRET instruction that accesses a GS Base from usermode memory, providing an attacker with a method of privilege escalation.
 
==== Exploit Implementation ====
* [https://www.exploit-db.com/exploits/36266 CVE-2014-9322 kernel panic PoC for Linux by Emeric Nasi (2015-03-04)]
* [https://github.com/RKX1209/CVE-2014-9322 CVE-2014-9322 exploit code for Linux by Ren Kimura (@RKX1209) (2017-07-19)]
* [https://www.exploit-db.com/exploits/44205 CVE-2014-9322 exploit code for Linux by Ren Kimura (@RKX1209) (2017-07-24)]
* [http://seclists.org/oss-sec/2015/q3/66 CVE-2015-5675 PoC for FreeBSD by Konstantin Belousov, Andrew Lutomirski (2015-07-08)]


==== Patched ====
==== Patched ====
'''Yes''' in 2.50 FW.
'''Yes''' in 2.00 FW
----
 
=== FW ??? - setlogin Information Leak (CVE-2014-8476) ===


=== FW <= 1.76 - dlclose Kernel Heap Overflow ===
Warning: this has not been tested on PS4.


==== Credits ====
==== Credits ====
* Discovered by CTurt.
* Mateusz Guzik for finding the vulnerability
* Privately implemented thanks to qwertyoruiop.
* Volodymyr Pikhur for advising to use this vulnerability at his Playstation 4 Rest Mode DEMO in REcon Brussels 2018
* CTurt published a writeup.
* Francisco Falcon for making a PoC on FreeBSD 8.4
* The exploit was publicly implemented by kR105 and on another side by Zer0xFF and Bigboss (psxdev).


==== Analysis ====
==== Analysis ====
[http://cturt.github.io/dlclose-overflow.html Analysis of sys_dynlib_prepare_dlclose PS4 kernel heap overflow (by CTurt with the help of qwertyoruiop)]
* [https://www.cvedetails.com/cve/CVE-2014-8476/ CVE details]
* [https://www.freebsd.org/security/advisories/FreeBSD-SA-14%3A25.setlogin.asc FreeBSD Security Advisories]


==== Bug Description ====
==== Bug Description ====
Integer overflow in the sys_dynlib_prepare_dlclose() system call can lead to a heap overflow causing memory corruption, allowing an attacker to obtain code execution in supervisor mode (ring0).
The setlogin function in FreeBSD 8.4 through 10.1-RC4 does not initialize the buffer used to store the login name, which allows local users to obtain sensitive information from kernel memory via a call to getlogin, which returns the entire buffer.


==== Exploit Implementation ====
When setlogin(2) is called while setting up a new login session, the login name is copied into an uninitialized stack buffer, which is then copied into a buffer of the same size in the session structure. The getlogin(2) system call returns the entire buffer rather than just the portion occupied by the login name associated with the session.
[https://github.com/kR105/PS4-dlclose Public release by kR105]


==== Patched ====
An unprivileged user can access this memory by calling getlogin(2) and reading beyond the terminating NUL character of the resulting string. Up to 16 (FreeBSD 8) or 32 (FreeBSD 9 and 10) bytes of kernel memory may be leaked in this manner for each invocation of setlogin(2).
'''Yes''' in 2.00 FW
----


=== FW <= 1.76 - BadIRET (CVE-2014-9322, CVE-2015-5675) ===
This memory may contain sensitive information, such as portions of the file cache or terminal buffers, which an attacker might leverage to obtain elevated privileges.


==== Credits ====
==== Exploit Implementation ====
* Andy Lutomirski for CVE-2014-9322 (2014-11-22)
* [https://sysexit.wordpress.com/2014/11/12/analysis-of-cve-2014-8476-a-freebsd-kernel-memory-disclosure-vulnerability/ PoC for FreeBSD 8.4 by Francisco Falcon]
* Konstantin Belousov, Andrew Lutomirski for CVE-2015-5675 (2015-07-08)
* Adam Zabrocki (pi3) for asking CTurt to test CVE-2015-5675 on PS4 (2015-08-21) [https://twitter.com/Adam_pi3/status/634514173263769600], [https://twitter.com/Adam_pi3/status/641166271157960704]
* Volodymyr Pikhur for exploiting FreeBSD and PS4 in private (2015-09-24) [https://twitter.com/vpikhur/status/646925039103705088]
* CTurt for porting the exploit from FreeBSD 9 to PS4 (2015-12-06) [https://twitter.com/CTurtE/status/673581693207502849]


==== Analysis ====
==== Patched ====
* [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f442be2fb22be02cafa606f1769fa1e6f894441 Fix commit for Linux CVE-2014-9322 by Andy Lutomirski]
?
* [https://nvd.nist.gov/vuln/detail/CVE-2014-9322 NVD Bug Description for CVE-2014-9322]
* [https://web.archive.org/web/20171118232027/https://blogs.bromium.com/exploiting-badiret-vulnerability-cve-2014-9322-linux-kernel-privilege-escalation/ 2014-9322 analysis by Rafal Wojtczuk]
* [http://blog.pi3.com.pl/?p=509 CVE-2014-9322 analysis by Adam Zabrocki (pi3)]


* [http://seclists.org/oss-sec/2015/q3/66 CVE-2015-5675 PoC for FreeBSD by Konstantin Belousov, Andrew Lutomirski (2015-07-08)]
== Kernel securities ==
* [https://www.freebsd.org/security/advisories/FreeBSD-SA-15:21.amd64.asc FreeBSD security advisory by Konstantin Belousov, Andrew Lutomirski (2015-08-25)]


* [http://cturt.github.io/ps4-3.html Hacking the PS4, part 3 - Kernel exploitation (by CTurt) (2015-12-17]
=== Kernel ASLR ===


==== Bug Description ====
Since 3.50 FW, ASLR (Address Space Layout Randomization) has been enabled in PS4 kernel. This means that to properly exploit the kernel to escalate privileges, an information disclosure vulnerability will most likely be needed to defeat ASLR and locate the kernel in memory.
Faults associated with the stack segment (SS) register are not handled properly, allowing unprivileged users to trigger an IRET instruction that accesses a GS Base from usermode memory, providing an attacker with a method of privilege escalation.
 
=== Kernel SMAP ===


==== Exploit Implementation ====
PS4 APU does not support SMEP ("Supervisor Mode Execution Prevention") so there is no way it supports SMAP ("Supervisor Mode Access Prevention"). However, in PS4 5.0x FW and above, a sort of SMAP was added to the kernel to prevent exploiters from pivoting the kernel stack pointer (RSP) to usermode memory: attempting to do so would crash the system. Sony probably added checks into the scheduler to check the stack pointer (RSP) against usermode addresses when running in kernel context. A new exploitation strategy is needed to run kernel ROP chains because an exploiters now needs to get his kernel ROP chain inside kernel memory to be executed.
* [https://www.exploit-db.com/exploits/36266 CVE-2014-9322 kernel panic PoC for Linux by Emeric Nasi (2015-03-04)]
* [https://github.com/RKX1209/CVE-2014-9322 CVE-2014-9322 exploit code for Linux by Ren Kimura (@RKX1209) (2017-07-19)]
* [https://www.exploit-db.com/exploits/44205 CVE-2014-9322 exploit code for Linux by Ren Kimura (@RKX1209) (2017-07-24)]
* [http://seclists.org/oss-sec/2015/q3/66 CVE-2015-5675 PoC for FreeBSD by Konstantin Belousov, Andrew Lutomirski (2015-07-08)]


==== Patched ====
==== SMAP bypass method: JOP ====
'''Yes''' in 2.00 FW
----


=== FW ??? - setlogin Information Leak (CVE-2014-8476) ===
To bypass PS4 SMAP, qwertyoruiop decided in his 5.05 PS4 kernel exploit to go with the method he used on the Apple iPhone 7 - essentially using JOP to push a bunch of stack frames onto the kernel stack, and memcpy()'ing the kernel ROP chain into RSP. qwertyoruiop explained: "JOP seems to work, but exploit is not reliable enough to repeat it multiple times implementing logic in-between (like on the FW 4.55 kernel bug where every primitive would re-exploit the bug). Using pure JOP logic would be long because of the need to find good instructions gadgets, and would vary a lot from a FW version to another. The strategy chosen is thread-safe and calling-convention aware, but most importantly pivot-less. We use JOP to implement a simple loop based on deref&branch logic. Every iteration runs a function prolog followed by a branch. This pushes lots of stack frames on stack, padding RSP. When loop is done, prepare call to memcpy with RDI = RSP, RSI = controlled pointer, RDX = (size of pushed stack frame * number of iterations - 1). We overwrite all fake frames but one with ROP. Memcpy will return into our first gadget, kickstarting the chain. At tail end of chain we just return into matching function epilog to resume clean execution by popping the one untouched frame. RSP never pivoted so PS4 successfully runs the kernel ROP chain."


Warning: this has not been tested on PS4.
* [https://github.com/kpwn/PS4-5.05-Kernel-Exploit/blob/9e97c398342ed6499a00fce0c081f7bf1efaaef1/kernel.js Detailed annotation of the PS4 5.05 kernel exploit by Specter]
* [[:File:02r0.pdf|Zero2Ring0 Slides by qwertyoruiop]] ([https://web.archive.org/web/20210116214117/http://crack.bargains/02r0.pdf Archive])
* [https://web.archive.org/web/20120512144251/https://marcoramilli.blogspot.com/2011/12/from-rop-to-jop.html From ROP to JOP article by Marco Ramilli]


==== Credits ====
==== SMAP bypass method: cli/sti ====
* Mateusz Guzik for finding the vulnerability
* Volodymyr Pikhur for advising to use this vulnerability at his Playstation 4 Rest Mode DEMO in REcon Brussels 2018
* Francisco Falcon for making a PoC on FreeBSD 8.4


==== Analysis ====
A PS4 SMAP bypass has been showed by sleirsgoevy in his 6.72 PS4 kernel exploit implementation. It consists in wrapping the main kernel ROP with cli/sti pair, which would prevent it from being preempted. This way the thread's CPU core will not run other kernel code during kernel ROP execution, and other cores have no way of detecting the stack pivot, so the mitigation is defeated.
* [https://www.cvedetails.com/cve/CVE-2014-8476/ CVE details]
* [https://www.freebsd.org/security/advisories/FreeBSD-SA-14%3A25.setlogin.asc FreeBSD Security Advisories]


==== Bug Description ====
* [https://github.com/sleirsgoevy/ps4jb/blob/master/src/oldkex.c#L451 cli/sti SMAP bypass in 6.72 PS4 kernel exploit]
The setlogin function in FreeBSD 8.4 through 10.1-RC4 does not initialize the buffer used to store the login name, which allows local users to obtain sensitive information from kernel memory via a call to getlogin, which returns the entire buffer.


When setlogin(2) is called while setting up a new login session, the login name is copied into an uninitialized stack buffer, which is then copied into a buffer of the same size in the session structure. The getlogin(2) system call returns the entire buffer rather than just the portion occupied by the login name associated with the session.
==== SMAP bypass method: CVE-2021-29628 ====


An unprivileged user can access this memory by calling getlogin(2) and reading beyond the terminating NUL character of the resulting string. Up to 16 (FreeBSD 8) or 32 (FreeBSD 9 and 10) bytes of kernel memory may be leaked in this manner for each invocation of setlogin(2).
A SMAP bypass has been found by m00nbsd while working on FreeBSD 12. It is named CVE-2021-29628 and affects FreeBSD 12.2 and later (til it was patched). It does not work on PS4 because PS4 kernel is based on FreeBSD 9 which did not contain the vulnerability and because PS4 SMAP does not come from FreeBSD but is custom from Sony. It used to work on PS5 before it was disclosed and patched on PS5 FW 2.30 or later according to dates.


This memory may contain sensitive information, such as portions of the file cache or terminal buffers, which an attacker might leverage to obtain elevated privileges.
* [https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-29628 CVE-2021-29628 (FreeBSD SMAP bypass) by m00nbsd]
* [https://hackerone.com/reports/1048322 CVE-2021-29628 (PS5 SMAP bypass) by m00nbsd]


==== Exploit Implementation ====
=== CR0.WP protection ===
* [https://sysexit.wordpress.com/2014/11/12/analysis-of-cve-2014-8476-a-freebsd-kernel-memory-disclosure-vulnerability/ PoC for FreeBSD 8.4 by Francisco Falcon]
 
==== Patched ====
Maybe.
----


=== <= 1.01 - .strtab/.symtab kernel table of symbols kept on very low FWs ===
At least since firmware 6.51 Sony instrumented all instructions that write to the CR0 register with checks for attempts to clear CR0.WP (Write Protect), which is necessary for patching the kernel. This is what it looks like in 6.51 kernel:


==== Bug description ====
  a1b79:      0f 22 c0                mov    cr0,rax
  a1b7c:      48 a9 00 00 01 00      test  rax,0x10000
  a1b82:      75 02                  jne    a1b86 <-- skip the next instruction if CR0.WP is not cleared
  a1b84:      0f 0b                  ud2    <-- #UD exception, causes a kernel panic
  a1b86:      c3                      ret


* Sony used to have two tables of symbols on very low versions: .strtab/.symtab and .dynstr/.dynsym (.strtab/.symtab had all symbols, .dynstr/.dynsym had ~75% of them).
Note that the check is after the write, to prevent a ROP gadget from pointing straight at the mov and skipping the verification.


==== Patched ====
Bypasses (in chronological order):
'''Yes''' in 1.03 FW. Seen in 1.01 PS4 kernel.
 
== Kernel securities ==
 
=== Kernel ASLR ===
 
Since 3.50 FW, ASLR (Address Space Layout Randomization) has been enabled in PS4 kernel. This means that to properly exploit the kernel to escalate privileges, an information disclosure vulnerability will most likely be needed to defeat ASLR and locate the kernel in memory.
 
=== Kernel SMAP ===
 
PS4 APU does not support SMEP ("Supervisor Mode Execution Prevention") so there is no way it supports SMAP ("Supervisor Mode Access Prevention"). However, in PS4 5.0x FW and above, a sort of SMAP was added to the kernel to prevent exploiters from pivoting the kernel stack pointer (RSP) to usermode memory: attempting to do so would crash the system. Sony probably added checks into the scheduler to check the stack pointer (RSP) against usermode addresses when running in kernel context. A new exploitation strategy is needed to run kernel ROP chains because an exploiters now needs to get his kernel ROP chain inside kernel memory to be executed.
 
==== SMAP bypass method: JOP ====
 
To bypass PS4 SMAP, qwertyoruiop decided in his 5.05 PS4 kernel exploit to go with the method he used on the Apple iPhone 7 - essentially using JOP to push a bunch of stack frames onto the kernel stack, and memcpy()'ing the kernel ROP chain into RSP. qwertyoruiop explained: "JOP seems to work, but exploit is not reliable enough to repeat it multiple times implementing logic in-between (like on the FW 4.55 kernel bug where every primitive would re-exploit the bug). Using pure JOP logic would be long because of the need to find good instructions gadgets, and would vary a lot from a FW version to another. The strategy chosen is thread-safe and calling-convention aware, but most importantly pivot-less. We use JOP to implement a simple loop based on deref&branch logic. Every iteration runs a function prolog followed by a branch. This pushes lots of stack frames on stack, padding RSP. When loop is done, prepare call to memcpy with RDI = RSP, RSI = controlled pointer, RDX = (size of pushed stack frame * number of iterations - 1). We overwrite all fake frames but one with ROP. Memcpy will return into our first gadget, kickstarting the chain. At tail end of chain we just return into matching function epilog to resume clean execution by popping the one untouched frame. RSP never pivoted so PS4 successfully runs the kernel ROP chain."
 
* [https://github.com/kpwn/PS4-5.05-Kernel-Exploit/blob/9e97c398342ed6499a00fce0c081f7bf1efaaef1/kernel.js Detailed annotation of the PS4 5.05 kernel exploit by Specter]
* [[:File:02r0.pdf|Zero2Ring0 Slides by qwertyoruiop]] ([https://web.archive.org/web/20210116214117/http://crack.bargains/02r0.pdf Archive])
* [https://web.archive.org/web/20120512144251/https://marcoramilli.blogspot.com/2011/12/from-rop-to-jop.html From ROP to JOP article by Marco Ramilli]
 
==== SMAP bypass method: cli/sti ====
 
A PS4 SMAP bypass has been showed by sleirsgoevy in his 6.72 PS4 kernel exploit implementation. It consists in wrapping the main kernel ROP with cli/sti pair, which would prevent it from being preempted. This way the thread's CPU core will not run other kernel code during kernel ROP execution, and other cores have no way of detecting the stack pivot, so the mitigation is defeated.
 
* [https://github.com/sleirsgoevy/ps4jb/blob/master/src/oldkex.c#L451 cli/sti SMAP bypass in 6.72 PS4 kernel exploit]
 
==== PS5 SMAP bypass method: CVE-2021-29628 ====
 
A SMAP bypass has been found by m00nbsd while working on FreeBSD 12. It is named CVE-2021-29628 and affects FreeBSD 12.2 and later (til it was patched). It does not work on PS4 because PS4 kernel is based on FreeBSD 9 which did not contain the vulnerability and because PS4 SMAP does not come from FreeBSD but is custom from Sony. It used to work on PS5 before it was disclosed and patched. See [https://www.psdevwiki.com/ps5/Vulnerabilities#SMAP_bypass_%28CVE-2021-29628%29 CVE-2021-29628 on PS5 Dev Wiki].
 
=== CR0.WP protection ===
 
At least since PS4 System Software version 6.51, Sony instrumented all instructions that write to the CR0 register with checks for attempts to clear CR0.WP (Write Protect), which is necessary for patching the kernel. This is what it looks like in 6.51 kernel:
 
  a1b79:      0f 22 c0                mov    cr0,rax
  a1b7c:      48 a9 00 00 01 00      test  rax,0x10000
  a1b82:      75 02                  jne    a1b86 <-- skip the next instruction if CR0.WP is not cleared
  a1b84:      0f 0b                  ud2    <-- #UD exception, causes a kernel panic
  a1b86:      c3                      ret
 
Note that the check is after the write, to prevent a ROP gadget from pointing straight at the mov and skipping the verification.
 
Bypasses (in chronological order):
* Execute an unintended "move to cr0" instruction in the middle of another instruction (e.g. instruction "call $+0x220f1c" (e8 17 0f 22 00) contains an unintended "mov cr0, rax" (0f 22 00))
* Use kernel write to give your process JIT permissions, allocate JIT memory, and put entirely custom code there (avoids the problem altogether, as it is specific to ROP). This seems impossible on PS5 with a classic kernel exploit because of XOM.
* Since the IDT (Interrupt Descriptor Table) is writable on FreeBSD, PS4 and PS5, it is possible to overwrite an exception handler without clearing CR0.WP first. One can overwrite the handler of #UD with a gadget of their choice (a stack pivot, or an "add rsp, ... ; ret" instruction, or whatever), then the UD2 instruction in the mitigation code will happily jump to it instead of the real handler, with CR0.WP cleared. To be precise, one must set up IDT handlers and point the IST (Interrupt Stack) to a ROP chain. It is required to poison the upper 16 bits of a pointer to make it non-canonical. Finally, write a custom page fault handler to run any kernel code you want. This technique proposed by sleirsgoevy since PS4 System Software version 6.51 was later adapted to PS5. However, this method slows down system performance compared to native execution because alone it can just run kernel ROP chains and it requires knowledge of gadgets positions. So on PS4, it is better to only use the IDT trick initially in a kernel exploit to patch kernel and allow non-ROP code execution for example by allowing JIT. On PS5, it is required to bypass XOM so an hypervisor exploit is required.
 
== Secure Modules ==
 
=== <= ?7.55? - Missing HMAC key length check in Secure Kernel leading to Partial SAMU KeyRings bruteforce ===
 
==== Credits ====
 
* Discovered by yifan lu (2017-02-19), plutoo and Proxima (2018-08-09), Davee (2018-12-29) for PS Vita, by flatz (2021-12-18) for PlayStation 4.
 
=== Bug description ===
 
The PS4 Crypto Coprocessor (CCP) interface in Secure Kernel has a bug that allows to dump (or better saying, bruteforce) key rings from SAMU.
That is how AES/HMAC keys from PFS, portability keys, VTRM keys, etc can be retrieved. A crypto flaw was in the ability to issue HMAC operation with key length stricly lower than 16. For example, by setting it to 1 you can bruteforce key bytes one by one by comparing HMAC result with HMAC result with known partial key.
 
This trick may work on other crypto hardware as well if it does not restrict key lengths. Amazingly, Intel Secure Key Storage (SKS) of CSME subsystem also has a bug allowing to brute-force any key slot, but the issue exists at hardware level - insecure design of  the keys distribution to crypto engines (AES, SHA, RC4). Intel did not recognize the bug arguing that to access SKS the CSME privileged arbitrary code execution is required, but SKS is exactly designed to protect the ROM generated keys from CSME firmware...
 
This can be used to dump the AES XTS key and HMAC key of a specific PS4 game PKG. Then one can use maxton's LibOrbisPkg or flatz's pkg_pfs_tool to unpack this PKG file.
 
==== Analysis ====
 
* https://yifan.lu/2017/02/19/psvimgtools-decrypt-vita-backups/
* https://twitter.com/qlutoo/status/1027691272369262594
* https://www.lolhax.org/2019/01/02/extracting-keys-f00d-crumbs-raccoon-exploit/
* https://twitter.com/flat_z/status/1472243592815169546
 
==== Implementation ====
 
* [https://github.com/jocover/ps4-hen-vtx/releases/tag/pfs_dump Compiled payload for PS4 5.05 by jogolden]
* [https://github.com/jocover/ps4-hen-vtx/tree/samu_key_dump Implementation for PS4 5.05 by jogolden]
* [https://gist.github.com/flatz/22215327864d7512e52268f9c9c51cd8 Exploit PoC for PS4 7.55 by flatz]
 
==== Patched ====
 
'''Yes''' since a PS4 FW between 7.55 (unpatched) and 9.00 (patched).
----
 
=== <= 4.07 - Crashdumps encryption using symmetrical key and same key across software revisions ===
 
==== Credits ====
 
* Discovered by ps4_enthusiast of fail0verflow (2017-12-27).
 
==== Bug description ====
 
The PS4 crashdumps encryption keys never changed between 1.01 and 3.15 FWs. Then between 3.50 and 4.07 FWs, Sony developers changed the keys many times but still used symmetrical key.
 
==== Analysis ====
 
* [https://fail0verflow.com/blog/2017/ps4-crashdump-dump/#crashdump-decryptor Writeup by ps4_enthusiast of fail0verflow (2017-12-27)]
 
==== Patched ====
 
'''Yes''' on PS4 FW 4.50 by using asymmetrical key. Tested between 1.01 and 4.07 PS4 FWs.
----
 
=== <= 3.70 - Reused keys lead to decryption of any PS4 1.00- 3.70 usermode SELF ===
 
==== Bug description ====
 
Sony reused encryption keys from System Software version 1.00 to 3.70 for PS4 usermode modules. As a result, any PS4 usermode module from those FWs can be decrypted on a PS4 running FW between 1.00 and 3.70.
 
==== Patched ====
 
'''Yes''' in 4.00 FW with the introduction of new keyset.
----
 
=== <= 2.50 - IDPS leak in sceSblAuthMgrDriveData on low retail FWs ===
 
==== Credits ====
 
* Discovered by flatz (2018-08-27).
 
==== Bug analysis ====
 
By calling the sceSblAuthMgrDriveData kernel function on a PS4, which is a wrapper to the Authentication Secure Module associated fonction, it is possible to dump its IDPS ([[Console ID]]). It is possible because some PlayStation 4 operating system developer from Sony forgot to encrypt sceSblAuthMgrDriveData output by the Authentication Secure Module and that is how it was patched later. The PS4 IDPS is stored encrypted in an EID block in the [[Serial Flash]].
 
To dump the PS4's IDPS, execute sceSblAuthMgrDriveData(0, in_buf, 0x160, out_buf, 0xA4, 1). Pass 0x160 bytes at 0x90C00 from sflash0s1.crypt into `in_buf` and dump `out_buf`.
 
==== Analysis ====
 
==== Implementation ====
 
==== Patched ====
 
'''Yes''' in PS4 3.00 retail FW. Works on any PS4 TestKit/DevKit FW.
----
 
=== <= ?1.62? - Missing version checks allow decryption of any GEN3 PUP ===
 
==== Credits ====
 
* Discovered by flatz (2016).
 
==== Bug description ====
 
A bug in the Secure Module that handle PUP decryption allows any PS4 GEN3 on FW 1.62 or below to decrypt any GEN3 PUP (retail, TestKit, DevKit, Beta) with a version above 1.00 (post-prototype).https://github.com/SocraticBliss/ps4-pup_decrypt
 
The Secure Module mailbox code does not reset state after [[SMI]] checks failure, so to decrypt an arbitrary PUP, you need to ignore the mailbox error after executing the PupDecryptHeader command (1).
 
==== Implementation ====
 
Any PS4 PUP decryptor kernel payload that ignore the mailbox error could be used. See [[PUP#Decrypter_%28first_step%29]] for implementations.
 
==== Patched ====
 
'''Yes''' around PS4 FW 1.70.
 
== Secure Kernel ==
 
=== <=?3.70? - Kernel ASLR collision leads to decrypted kernel partial leak - Matroska vulnerability ===
 
==== Credits ====
* anonymous for sharing decrypted PS4 6.00b1 kernel file (2019-03-20)
* shykelit for dumping 3.55 Jig PS4 kernel (2019-04-17)
* zecoxao for discovering Matroska kernels and giving them that name (2019-04-18)
* z80 for dumping 3.70 PS4 DevKit kernel (2019-04-18)
* AlexAltea for reverse engineering kernel, ubios and vbios
* Many people for sharing dumps of their PS4 kernels
* CelesteBlue for backporting kernel exploits to dump PS4 4.74 kernel (2018-11-18), 3.50 (2019-05-09), 3.70 (2019-05-15) and 3.15 (2019-05-25)
 
==== Bug description ====
The kernel memory contains the kernel fSELF but with decrypted data, which in turn can be decompressed to grab ubios, vbios, kernel boot code and partial kernel.
 
By dumping PS4 kernel memory with a kernel exploit, in order to dump the x86 kernel, we sometimes find a strange fSELF. This fSELF is only partial: 1.5MB, but should be 17MB if it was the x86 kernel. Luckily it is only compressed, not encrypted. When uncompressing it using offzip, we can see only 1 segment. That is because the other segments have been cutted and the segment is incomplete. But we can see that it is the decrypted x86 kernel, as confirmed by diffing with anonymously shared decrypted full x86 kernel. In the decrypted x86 kernel, you can see a second ELF header. It is once again only compressed and not encrypted, and this is what zecoxao named the "Matroska kernel".
 
Sadly, this vulnerability is random, as it relies on kernel ASLR which is itself random. So depending on the System Software version, as modules have different sizes, kernel ASLR has more (100% on 3.15, 3.50 and 3.70) or less (1% on ?4.74?) chances to leak the Matroska kernel. It is unknown how we could improve this success rate. Maybe by instead of rebooting, causing a kernel panic or rebooting to recovery, entering rest mode then disconnecting power supply. A way to accelerate the process would be to scan kernel memory and check magics to see if there is a Matroska kernel. If there is, dump it, else reboot and cross fingers.
 
Note: vbios seems to be the same from 3.50 to 6.00b1 at least.
 
==== Analysis ====
Since PS4 3.50 FW, ASLR (Address Space Layout Randomization) has been enabled in PS4 kernel.
 
During PS4 boot, the following operations are executed:
* the encrypted x86 kernel is loaded from [[Serial Flash]]
* the secure kernel decrypt the x86 kernel SELF, without uncompressing it to some fixed address: at 0xFFFFFFFF84000000 in the case of 3.xx and 5.xx firmwares or 0xFFFFFFFFC4000000 in the case of 4.xx.
* the secure kernel randomly chooses a base address for Kernel ASLR, starting from 0xFFFFFFFF80000000.
* the secure kernel uncompresses the x86 kernel to the address determined by Kernel ASLR.
 
On some PS4 boots, Kernel ASLR base address can be very near of Matroska kernel address and the lack of memory separation and wipe renders the dump of Matroska kernel possible with only kernel memory read access.
 
==== Patched ====
'''Yes''' partially in 4.00 FW by increasing the kernel ASLR base address but it might have reappeared in newer versions like since 5.00 or 4.74, but with lower success rate.
 
It was also not present on 1.76 and below, so probably appeared when Sony worked on adding ASLR in PS4 Kernel. Also note that Matroska kernel is present on 3.15 even though there is no Kernel ASLR in this version.
 
== Hardware Exploits ==
 
=== PCIe man-in-the-middle attack ===
 
* First done on PS4 FW 1.01 by failoverflow on PS4 launch!
* Detailed at 33c3: [https://fail0verflow.com/media/33c3-slides/#/5 33c3 slides by Marcan]
* Permits kernel and usermode dumping
 
=== Syscon glitching ===
 
It is possible to glitch the [[Syscon]] debug interface to allow access and dump keys. It was originally done by an anonymous member of fail0verflow.
 
=== Aeolia and Belize (Southbridge) SCA/DPA ===
 
Side Channel Analysis (SCA) with Differential Power Analysis (DPA) on Aeolia and Belize (PS4 Southbridge revisions) has been shown to be able to recover key material. Since Sony never used private/public key pairs, it is possible to exploit this and gain complete control over the [[Southbridge]]. You can attack the main FreeBSD kernel from here.
 
Nearly same methods are working on recent PS4 Pro motherboard NVB-003 that has Belize [[Southbridge]] ([[CXD90046GG]]).
 
Contrarly to Aeolia, Belize has ROM readout protection and clears stack which makes it more secure.
 
Old notes:
 
This is a hack to gain unsigned code execution on the [[Southbridge]] for all motherboard/console revisions. You might be able to glitch the EMC bootrom in order to bypass further signature checks and break the chain of trust. This hack might involve slowing down the [[Syscon]] clock. Timing the glitch based on SPI read accesses then either doing a power glitch or clock glitch to skip signature check. If the glitch fails, then we simply reset. This can be done with a very cheap CPLD/FPGA. Most Xbox 360 glitching modchips used a Xilinx Coolrunner because it is cheap and easy to use (board can cost as low as $5).
 
Related:
* [https://fail0verflow.com/blog/2018/ps4-aeolia/ fail0verflow's writeup]
* [https://twitter.com/fail0verflow/status/1047690778527653889 fail0verflow's tweet]
* [https://www.youtube.com/watch?v=sMroXa-zYxk PlayStation 4 Rest Mode DEMO REcon Brussels 2018 by Volodymyr Pikhur]
* [https://recon.cx/2018/brussels/resources/slides/RECON-BRX-2018-Mess-with-the-best-die-like-the-rest_(mode).pdf Slides of REcon Brussels 2018 by Volodymyr Pikhur]
* [https://www.psxhax.com/threads/ps4-southbridge-reverse-engineered-code-examination-by-jogolden.6736/ jogolden's writeup]
 
=== Arbitrary code execution in AMD SMU by incomplete hashing and bounds checking ===
 
==== Credits ====
* Rudolf Marek discovered, disclosed to AMD then publicly through the following timeline:
** Christmas 2013 - SMU firmware was analyzed from public AMD documentation
** April 2014 - Bug was found in the SMU firmware
** 2014-04-30 - Request to AMD sent
** 2014-05-15 - Reply by AMD
** 2014-05-16 - Encrypted communication, sending details
** 2014-07-09 - AMD acknowledges the problem
** In the meanwhile - Occasional communication
** 2014-11-25 - AMD sends to Rudolf Marek a list of AMD AGESA versions which contain a fix
 
==== Bug description ====
A security vulnerability, discovered by Rudolf Marek in April 2014, in the recent AMD processors (Trinity and Richland, of FM2 socket) allows arbitrary code execution on the AMD System Management Unit (SMU).
 
It consists in two bugs in the SMU of AMD Trinity and Richland CPUs:
* The AMD SMU firmware is not padded so some part (256 bytes) of the runtime firmware is not correctly covered by protection cover (0x55 0xaa ...).
* The AMD SMU request function incorrectly checks bounds.
Similar, but not same problem affected AMD Kabini and Kaveri CPUs. It also likely affects PS4 as its [[APU]] is AMD Kabini/Jaguar.
 
Thanks to this vulnerability, the AMD SMU firmware can be dumped. From the dump, the [[Keys#AMD_SMU_Keys HMAC-SHA1 key]] was obtained.
 
Thanks to the knowledge of this key, the AMD SMU firmware could possibly be replaced by a custom one.
 
==== Analysis ====
* [https://fahrplan.events.ccc.de/congress/2014/Fahrplan/system/attachments/2503/original/ccc-final.pdf Slides about exploitation AMD SMU firmware exploitation at 31C3 by Rudolf Marek (2014-12-27)]
* [https://media.ccc.de/v/31c3_-_6103_-_en_-_saal_2_-_201412272145_-_amd_x86_smu_firmware_analysis_-_rudolf_marek Video of Rudolf Marek explaining AMD SMU firmware exploitation at 31C3 (2014-12-27)] or [https://www.youtube.com/watch?v=iYvhHey_dTk mirror]


==== Patched ====
* Use an "unintended" mov to cr0 in the middle of another instruction (e.g. instruction "call $+0x220f1c" (e8 17 0f 22 00) contains an unintended "mov cr0, rax" (0f 22 00))
Maybe after 2014-11-25, SMU vulnerability found by Rudolf Marek could have been patched on PS4 as AMD released patches: the fixed SMU firmware is part of updated AMD AGESA.
* Use kernel write to give your process JIT permissions, allocate JIT memory, and put entirely custom code there (avoids the problem altogether, as it is specific to ROP)
 
* Since the IDT is writable on FreeBSD and PS4, it is possible to overwrite an exception handler without clearing CR0.WP first. One can overwrite the handler of #UD with a gadget of their choice (a stack pivot, or a "add rsp, ... ; ret", or whatever else), and the UD2 instruction in the mitigation code will happily jump to it instead of the real handler, with CR0.WP cleared.
=== Untested - Arbitrary code execution in AMD SMU by custom firmware ===
 
==== Credits ====
* Rudolf Marek for his exploit and documentation (2014)
* zecoxao for public disclose (2023-05-17)
 
==== Bug description ====
It turns out that the "debug key" used to hash "debug" firmwares from AMD SMU effectively works on all retail (CEX) versions of the PS4 AMD SMU firmware as well.
 
According to zecoxao, as SMU is very privileged in PS4 (but not so privileged in PS5), one could probably dump his own PS4 keys/fuses with AMD SMU code execution. This could possibly lead to decryption of latest PS4 games, SEN access on PS4 running out-of-date System Software, conversion of any PS4 between CEX and DEX, as well as decrypting the PS4 Kernel and derived binaries.
 
==== Analysis ====
* [https://wololo.net/2023/05/18/ps4-reverse-engineering-progress-on-smu-system-management-unit-could-help-with-hacks/ Article by wololo (2023-05-18)]
 
==== Patched ====
Maybe on recent PS4 firmwares with a BIOS update that would require a different and possibly more secure digest or signature.




Please note that all contributions to PS4 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS4 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)