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 3: Line 3:
=== PS1 games savedata exploits ===
=== PS1 games savedata exploits ===


See [[PS1 Emulation]] for a list of candidate games.
See [https://www.psdevwiki.com/ps1/Vulnerabilities PS1 savedata exploits on PS1 Dev Wiki].


See [https://www.psdevwiki.com/ps1/Vulnerabilities PS1 Dev Wiki] for a list of PS1 savedata exploits.
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
* 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/
* 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."


=== PS2 games savedata exploits ===
=== PS2 games savedata exploits ===


See [[PS2 Emulation]] for a list of candidate games.
See [https://www.psdevwiki.com/ps2/Vulnerabilities#PS2_Savedata_exploits PS2 savedata exploits on PS2 Dev Wiki].


See [https://www.psdevwiki.com/ps2/Vulnerabilities#PS2_Savedata_exploits PS2 Dev Wiki] for a list of PS2 savedata exploits.
Official PS2onPS4 games sold on the PS Store (as of September, 2024):
* ADK DAMASHII™ UP0576-CUSA03783_00-SLPS259060000001 https://image.api.playstation.com/cdn/UP0576/CUSA03783_00/BpMMUC8q1MRAsL9iWDh6vbW844hq3JXK.png
* Arc the Lad: Twilight of the Spirits
* Art of Fighting Anthology
* Ape Escape 2
* Bully (Canis Canem Edit)
* Dark Chronicle (Dark Cloud 2) UP9000-CUSA02037_00-SCUS972130000001 https://image.api.playstation.com/cdn/UP9000/CUSA02037_00/hIKSKqBMerypNW49TCECATZSBBUcSBph.png
* Dark Cloud
* Destroy All Humans!
* Destroy All Humans! 2
* Eternal Ring UP1022-CUSA04654_00-SLUS200150000001 https://image.api.playstation.com/cdn/UP1022/CUSA04654_00/DRIS0z7mtNMYZPchoqLnKlhJqyNvM8mZ.png
* FantaVision
* Fatal Fury Battle Archives Vol. 2
* Forbidden Siren
* Fu'un Super Combo UP0576-CUSA03784_00-SLPS257810000001 https://image.api.playstation.com/cdn/UP0576/CUSA03784_00/QWsetumZLYupFHsOIkoGbKYpySGBdtlp.png
* Ghosthunter (English, Japanese) UP9000-CUSA47996_00-SLUS209930000000
* GTA III
* GTA Vice City
* GTA San Andreas
* Harvest Moon: Save the Homeland
* 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
* Indigo Prophecy
* Jak and Daxter™ HP9000-CUSA08427_00-SCPS560030000001 patch 1.01 requires PS4 4.73
* 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
* 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
* 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
* 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
* 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
* Kinetica UP9000-CUSA01725_00-SCUS971320000001 https://image.api.playstation.com/cdn/UP9000/CUSA01725_00/EKH34FKOEt3dTXLCiccuawdS8iGIqGLF.png
* Manhunt
* Max Payne
* Metal Slug Anthology
* 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
* Primal
* Psychonauts
* Puzzle Quest: Challenge of the Warlords
* Red Dead Revolver
* Red Faction
* Red Faction II
* Resident Evil Code: Veronica X
* Rise of the Kasai
* Rogue Galaxy
* Samurai Shodown VI
* 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
* Star Wars Bounty Hunter
* 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
 
* See [https://www.playstation.com/en-us/editorial/iconic-must-play-titles-on-playstation-plus-classics-catalog/].
 
Official PS2onPS4 games sold on Bluray Discs:
* 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.


=== PSP games savedata exploits ===
=== PSP games savedata exploits ===


See [[PSP Emulation]] for a list of candidate games.
See [https://www.psdevwiki.com/psp/Vulnerabilities PSP savedata exploits on PSP Dev Wiki].


See [https://www.psdevwiki.com/psp/Vulnerabilities PSP Dev Wiki] for a list of PSP savedata exploits.
* https://wololo.net/2012/09/01/when-the-psp-and-the-vita-show-their-battle-scars/
* 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):
* 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) ===
=== PS4/PS5 PS2emu sandbox escape (mast1c0re) ===
Line 46: Line 181:
'''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.
'''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.


=== PS4/PS5 game savedata Lua exploit ===
=== PS4/PS5 game savedata LUA exploit ===


==== Credits ====
==== 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].
* 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].
* Used by Flatz on 2024-09-14 in [https://gist.github.com/flatz/5e12f75cdb210516d31df03069f7ed0a his implementation of the umtx UaF kernel exploit].
* Used by Flatz on 2024-09-14 in [https://gist.github.com/flatz/5e12f75cdb210516d31df03069f7ed0a his implementation of the umtx UaF kernel exploit].
* Lua sandbox escape makers (to document): Peter Cawley (corsix), erezto, Morgan Jones (numinit), Maxim Ivanov (ulidtko)


==== Bug description ====
==== Bug description ====
Some PS4 (and maybe PS5) games, in disc version (usually also available in PS Store version, some even in free demo version, but potentially patched), can be exploited as they allow the user to execute Lua code by crafting an evil save data. By running malicious Lua code, the attacker can escape the Lua sandbox and obtain usermode arbitrary read-write then ROP chain execution in usermode.
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.
 
On PS Vita, you can simply install the DRM demos, the same way as you would for Bitter Smile Demo (see h-encore by TheFloW).
 
If you have access to the PS4/PS5 PS Store, you can simply buy the trial version to test it.
 
Artemis and MUGEN engines are known to use Lua and so are vulnerable to various sandbox escape exploits.
 
Most of Artemis games automatically load save9999.dat file from save data folder when the game boots. By editing this file, one can load custom LUA scripts.
 
Game boots -> "save9999.dat" is loaded -> "inject.iet" is loaded -> "inject.lua" is loaded.
 
You might have to create a different save9999.dat file for each game as the Lua interpreter version might differ.
 
On Windows, you have access to luasocket and os.execute. However, on PS Vita/PS4/PS5, you have limited access.
 
You have to copy PS Vita/PS4/PS5 savedata files to the console.


==== Vulnerable games ====
==== Vulnerable games ====
See [[Artemis Engine]] for a list of candidate games.


Confirmed exploitable games:
Not confirmed:
* Raspberry Cube (CUSA16074)
Pay Day 2, Mafia III, God of War (which one?).
* Aibeya (CUSA17068)
* Hamidashi Creative (CUSA27389)
* Hamidashi Creative Demo (CUSA27390)


Other games that may use Lua scripts:
Confirmed:
* Pay Day 2, Mafia III, God of War (which one?).
TODO
* Games using the MUGEN engine are vulnerable to many exploits, but it is unknown if some PS4 games use this engine. https://mugen-cheap.fandom.com/wiki/SuperNull


==== Analysis ====
==== Analysis ====


==== Exploit Implementation ====
==== Patched
* [https://github.com/shahrilnet/remote_lua_loader/blob/b5f2420495e66308de06934530b3c449ab4bcf9b/savedata/inject.lua#L793 Lua ?5.1? sandbox escape in PS4 games running Artemis engine by shahrilnet (2024-11-25)]
* [https://gist.github.com/flatz/cbb84539aeee1ade1983ee2eea499dbc ROP chain manager in Lua by flatz (2024-11-02)]
* [https://github.com/Gezine/ArtemisLuaLoader Lua script execution PoC for Raspberry Cube (PS4 CUSA16074 and Windows) by Gezine (2024-10-06)]
* [https://github.com/erezto/lua-patcher LUA 5.1-5.3 bytecode patching tool by erezto (2015-10-19)]
* [https://github.com/erezto/lua-sandbox-escape/blob/master/x86_64/exploit.lua Lua 5.2 sandbox escape for x86 and x86-64 by erezto (2016-04-27)]
* [https://github.com/adamivora/lua-hardening-suite/tree/main/exploits Various Lua exploits by Adam Ivora (adamivora) (2023-12-14)]
* [https://web.archive.org/web/20201029040829/https://apocrypha.numin.it/talks/lua_bytecode_exploitation.pdf Escaping the Lua 5.2 sandbox with untrusted bytecode by Morgan Jones (numinit) (2016-09-12)]
* [https://www.corsix.org/content/malicious-luajit-bytecode Malicious LuaJIT bytecode by Peter Cawley (corsix) (2015-11-11)]
* [https://gist.github.com/corsix/49d770c7085e4b75f32939c6c076aad6 Exploiting Lua 5.2 on x64 by Peter Cawley (corsix) (2016-08-21)]
* [https://gist.github.com/ulidtko/51b8671260db79da64d193e41d7e7d16 Exploiting Lua 5.1 with bytecode type confusion on 32-bit Windows by Maxim Ivanov (ulidtko) (2018-03-21)]
* [https://gist.github.com/corsix/6575486 Exploiting Lua 5.1 on 32-bit Windows by Peter Cawley (corsix) (2013-09-16)]
* [https://gist.github.com/corsix/1fc9b13a2dd5f3659417b62dd54d4500 LuaJIT 2.1.0beta1 string hash table collision by Peter Cawley (corsix) (2019-04-27)]
* [https://github.com/gonzalezjo/ljhashdos LuaJIT 2.1.0beta1 string hash table collision by gonzalezjo (2018-07-09)]
* [https://benmmurphy.github.io/blog/2015/06/04/redis-eval-lua-sandbox-escape/ Redis EVAL Lua Sandbox Escape by Ben Murphy (2015-06-04)]
* [https://www.youtube.com/watch?v=8Q0KLTma_FA LuaJIT, something interesting inside at Lua Workshop 2016 by Peter Cawley (corsix) (2016-12-04)]
* [https://www.youtube.com/watch?v=OSMOTDLrBCQ Lua: Mitigating the Danger of Malicious Bytecode at Lua Workshop 2011 by Peter Cawley (corsix) (2011-09-08)]
* [https://github.com/ZiddiaMUGEN/LuaSupernull Lua exploits for the MUGEN 1.1 engine]
* [https://www.lua.org/bugs.html Lua bugs for any version disclosed by lua.org]
 
==== Patched ====
'''No''' as of PS4 FW ?12.00? and PS5 FW 7.61.
'''No''' as of PS4 FW ?12.00? and PS5 FW 7.61.


Line 125: Line 218:


==== Analysis ====
==== Analysis ====
* [https://github.com/TheOfficialFloW/Presentations/blob/master/2022-hardwear-io-bd-jb.pdf Pages 27 and 28 of slides presented at hardwear.io by TheFloW (2022-06-10)]
* [https://twitter.com/theflow0/status/1701154155744645349 Removed tweet of BD-JB2 logs on a 7.61 PS5 by TheFloW (2023-09-11)]
* [https://twitter.com/theflow0/status/1701154155744645349 Removed tweet of BD-JB2 logs on a 7.61 PS5 by TheFloW (2023-09-11)]
* [https://github.com/TheOfficialFloW/bd-jb/commit/44713ef59f897ff2125efccbdcb5d07dbe1ffdb5 Diff between UserPreferenceManagerImpl hijack and Path traversal sandbox escape implementations by TheFloW (2024-11-28)]


==== Bug Description ====
==== Bug Description ====
Basing on the 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. This vulnerability can efficiently replace the UserPreferenceManagerImpl to extend the supported System Software versions range compared to BD-JB1.
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.


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://twitter.com/theflow0/status/1717088032031982066 Removed PoC by TheFloW (2023-10-25)]
* [https://twitter.com/theflow0/status/1717088032031982066 PoC by TheFloW (2023-10-25)]
* [https://github.com/TheOfficialFloW/bd-jb/blob/d21fd76c0768d05ad01c4722eb21480fa8a8b619/src/com/bdjb/Loader.java#L62 Implementation by TheFloW (2024-11-28)]


==== Patched ====
==== Patched ====
'''No''' as of PS4 FW 10.71 (maybe patched on PS4 FW 11.00). '''Yes''' on PS5 FW 8.00. Probably not patched on PS3.
'''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 ===
=== FW <= 9.00 - BD-JB - Five vulnerabilities chained by TheFloW ===
Line 153: Line 243:


==== Bug Description ====
==== Bug Description ====
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.
TO ADD DESCRIPTION OF EACH ONE OF THE 5 BUGS:


TODO!: 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)
* #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)


===== #1 - userprefs hijack (?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.
 
com.sony.gemstack.org.dvb.user.UserPreferenceManagerImpl userprefs hijack leads to classes instantiation under privileged context.
 
===== #2 - com.oracle.security.Service (?PS3?, PS4, not PS5) =====
 
com.oracle.security.Service leads to privileged constructor call.
 
===== #3 - com.sony.gemstack.org.dvb.io.ixc.IxcProxy leading to privileged method call (?PS3?, PS4, PS5) =====
 
com.sony.gemstack.org.dvb.io.ixc.IxcProxy leads to privileged method call.
 
===== #4 - JIT compiler hack (?PS3?, PS4, not PS5) =====
 
JIT compiler hack leads to usermode arbitrary RW and usermode arbitrary code execution.
 
===== #5 - UDF buffer overflow (?PS3?, PS4, PS5) =====
 
The UDF driver in kernel contains a buffer overflow. Note that no implementation of the UDF kernel exploit has ever been done even by TheFloW, only a kernel panic PoC.


==== Exploit Implementation ====
==== Exploit Implementation ====
Line 194: Line 270:
=== WebKit sources ===
=== WebKit sources ===


[https://doc.dl.playstation.net/doc/ps4-oss/webkit.html WebKit sources]
[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://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.
 
=== FW ?6.00-11.52? - get_by_id_with_this associated with ProxyObject can leak JSScope objects ===
 
==== Credits ====
* 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 ====
* [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 ====
=== FW ?10.00?-11.52 - Unknown heap and string overflow (no CVE) leading to crash ===
* TODO: document the general vulnerability coming from |this|.
 
According to the spec [1], `var base = { foo }; with (base) foo();` should be called with `this`
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
`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 ====
* [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 ====
'''Maybe'''
 
==== Tested ====
Not tested yet on PS4 or PS5.
----
 
=== FW ?6.00-11.52? - Integer underflow in JSC genericTypedArrayViewProtoFuncCopyWithin (CVE-2023-38600) ===


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


==== Analysis ====
==== Analysis ====
* [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/Debvt/Wm/tree/Root0 PoC and analysis by Debty (2024-08-29)]
* [https://github.com/WebKit/WebKit/commit/6e7e654417b61630d67f02b65798439cf3d6b0b5 WebKit fix commit by Yusuke Suzuki (2023-07-31)]


==== Bug Description ====
==== Bug Description ====
It is required to recompute length properly when resize happens during TypedArray copyWithin.
* TODO
 
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.
 
The issue was patched by aborting the copy if either of the two variables to or from is larger than the updated length.
 
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.


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 ?6.00-11.00? - CloneDeserializer::deserialize() UaF (CVE-2023-28205) leading to arbitrary RW ===
=== FW 10.00-11.02 - JSC DFG Abstract Intepreter clobberWorld Type Confusion (no CVE) leading to crash ===


==== Credits ====
==== Credits ====
* Clément Lecigne of Google's Threat Analysis Group and Donncha Ó Cearbhaill of Amnesty International’s Security Lab for discovering the vulnerability and reporting it to Apple (2023-04-10)
* ENKI for public disclose and analysis (2024-06-03)
* Justin Michaud, Mark Lam and JonWBedard for fixing the bug in WebKit (2023-04-17)
* abc (anonymous) for making an OOM PoC for PS4 and PS5 (2024-12-01)


==== Analysis ====
==== Analysis ====
* [https://github.com/WebKit/WebKit/commit/c9880de4a28b9a64a5e1d0513dc245d61a2e6ddb WebKit fix commit (2023-04-17)]
* [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 (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 ====
Previously, CloneDeserializer::deserialize() was storing pointers to newly created objects in a few Vectors, in a MarkedArgumentBufferBase. This is problematic because the GC is not aware of Vectors, and cannot scan them. Instead, CloneDeserializer::deserialize() should store cell pointers in a MarkedVector.
According to abc (anonymous):
 
"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 came across a bug that can leak `GetterSetter`s at WebKit's git main branch: `ceb7e89febcd [JSC] get_by_id_with_this + ProxyObject can leak JSScope objects https://bugs.webkit.org/show_bug.cgi?id=267425 <rdar://120777816>`
The PoC code triggers a use-after-free (UaF) vulnerability by delaying the addition of Map and Date objects, which allows the garbage collector (GC) to free them. This can potentially lead to accessing freed objects to corrupt memory. Then it cannot avoid executing a release assert that causes an Out-Of-Memory crash.
<br />
 
In summary with tinkering with this bug, we do not think you can do anything useful with accessing a `GetterSetter`. The clobber bug however does allow setting properties in places where you usually cannot like `Function's prototype` in the article. But without JIT, we do not think you can cause any memory corruption. The impact for both bugs is probably just JS execution, which we already have, which is a no go in some context (JS injection) but it does not help in gaining PS4/PS5 usermode execution.
The WebKit patch refactors the MarkedArgumentBuffer class into a MarkedVector template class.
<br />
Note that the PS4 webbrowser JIT has been removed around PS4 System Software version 5.00 or lower so using the article is not applicable."


==== Exploit Implementation ====
==== Exploit Implementation ====
* [https://github.com/ntfargo/uaf-2023-28205/blob/main/poc.js PoC by abc (2024-12-01)]
* [https://medium.com/@enki-techblog/ios-16-5-1-safari-rce-analysis-cve-2023-37450-89bb8583bebc PoC by ENKI (2024-06-03)]


==== Patched ====
==== Patched ====
'''Yes''' on PS4 FW ?11.00? and PS5 FW ?8.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.
Tested working on PS4 FWs ? and PS5 FWs 6.00-7.61.
----


=== FW 6.00-9.60 - FrameLoader::loadInSameDocument() UaF (CVE-2022-22620) leading to arbitrary RW ===
=== FW 6.00-9.60 - FrameLoader::loadInSameDocument() UaF (CVE-2022-22620) leading to arbitrary RW ===
Line 301: Line 326:
* 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 364: Line 389:
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 415: Line 438:
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.52 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.51. Untested: PS5 FWs 2.10-2.50 and >=5.00.
Tested working on PS4 FWs 9.00-9.04 and PS5 FWs 3.00-4.51. Untested: PS5 FWs 2.10-2.70 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 445: Line 466:


==== 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 492: Line 509:


==== 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 518: Line 532:


==== 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 662: Line 673:
==== Tested ====
==== Tested ====
Works on 3.15-4.07. Not working on <= 3.11.
Works on 3.15-4.07. Not working on <= 3.11.
----
=== FW <= ?4.05? - Type confusion in WebCore::HTMLInputElement::onSearch (CVE-2017-2354) ===
==== Credits ====
* Neymar of Tencent's Xuanwu Lab working with Trend Micro's Zero Day Initiative for discovering this vulnerability (2016-11)
* Brent Fulgham for fixing the bug in WebKit (2016-11-14)
* Jasiel Spelman (@WanderingGlitch) for his writeup (2017-12-20)
==== 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://github.com/WebKit/WebKit-http/commit/cf2bf6e58f51267d7ae25fcb82a315377c8e5cf6 WebKit fix commit by Brent Fulgham (2016-11-14)]
==== Bug Description ====
It is possible for JavaScript to change the type property of an input field. WebKit needs to gracefully handle this case.
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 ====
* PoC by Neymar (2016-11, disclosed publicly by Jasiel Spelman on 2017-12-20):
<source lang="js">
<input id="m_input" type="search"></input>
<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 ====
'''Maybe''' in 4.06 FW
==== Tested ====
Not yet.
----
----


Line 719: Line 683:


==== Analysis ====
==== Analysis ====
* [https://blog.xyz.is/2016/webkit-360.html PSVita 3.60 HENkaku WebKit exploit writeup]
* [https://blog.xyz.is/2016/webkit-360.html PSVita 3.60 HENKaku WebKit exploit writeup]


==== Bug Description ====
==== Bug Description ====
Line 737: Line 701:


=== 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 749: Line 710:


==== 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 862: Line 823:


* 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 887: Line 848:


==== 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 ===
 
<pre>
CVE-2017-7064
https://project-zero.issues.chromium.org/issues/42450258
 
CVE-2018-4192
https://blog.ret2.io/2018/06/13/pwn2own-2018-vulnerability-discovery/
https://blog.ret2.io/2018/06/19/pwn2own-2018-root-cause-analysis/#arrayreverse-considered-harmful
https://blog.ret2.io/2018/07/11/pwn2own-2018-jsc-exploit/
 
CVE-2018-4443
WebKit JSC - 'AbstractValue::set' Use-After-Free
lokihardt of Google Project Zero
2019-01-22
https://www.exploit-db.com/exploits/46071
 
Improper Restriction of Operations within the Bounds of a Memory Buffer
 
Unknown CVE
Luca Todesco (qwertyruiopz)
before 2019-08-15
https://gist.github.com/jakeajames/5ceb90ebaa34eabb3e170b5c7eb2c7d1/revisions
</pre>
 
=== Resources for WebKit exploitation ===
 
https://webkit.org/blog/12967/understanding-gc-in-jsc-from-scratch/
 
https://googleprojectzero.blogspot.com/2019/08/jsc-exploits.html


== Usermode securities ==
== Usermode securities ==
Line 957: Line 887:
* See the PS4 [[Syscalls]] list.
* See the PS4 [[Syscalls]] list.


=== Direct Syscall invocation disabled in PS4 Kernel ===
=== Syscall 0 disabled i.e Error Kernel: The application directly issues a syscall instruction (24) ===
 
Between 2.00 and 2.57, SCE has disabled direct system calls by usermode, by adding some checks in the PS4 kernel. An attacker can no longer call any syscall he wants by specifying the call number in the rax register and jump directly to the call instructions part of a syscall stub. Indeed, now the PS4 (but not PS5) implementation of <code>amd64_syscall</code> checks the following:
* The address in the Instruction Pointer (IP) of the call must be within the memory range of the associated libkernel module of the process,
* The code pointed by the Instruction Pointer (IP) must follow the syscall stub format,
* The syscall number passed in argument to <code>amd64_syscall</code> must corresponds to the stub's syscall number. <code>amd64_syscall</code> checks the stub's <code>mov rax, syscall_number</code> instruction.


Since PS4 version 3.00, issuing directly a syscall instruction crashes the application and gives error CE-34878-0, (<code>SCE_KERNEL_ABORT_REASON_SYSTEM_ILLEGAL_FUNCTION_CALL</code>), displaying the message "Kernel: The application directly issues a syscall instruction (24)".
* Between 2.00 and 2.57, SCE has removed system call 0, so we can no longer call any syscall we want by specifying the call number in the rax register.
 
* Doing so now crashes the app and gives error CE-34878-0, SCE_KERNEL_ABORT_REASON_SYSTEM_ILLEGAL_FUNCTION_CALL, with the message "Kernel: The application directly issues a syscall instruction (24)".
An attacker is now forced to use wrappers provided from the libkernel / libkernel_web / libkernel_sys modules to trigger system calls.
* We now have to use wrappers provided to us from the libkernel / libkernel_web / libkernel_sys modules to access system calls.
 
The PS5 does not enforce the passed syscall number and thus any code can directly issue an arbitrary syscall even if the associated libkernel does not provide it.


=== bpf_write function stripped out of the kernel ===
=== bpf_write function stripped out of the kernel ===
Line 990: Line 913:
* For select types implemented by WebKit (such as JSC::JSFunction), certain pointer fields are XOR'ed by a cryptographic key generated at runtime. The key is generated once every process launch, one must recover it to unpoison the pointers.
* For select types implemented by WebKit (such as JSC::JSFunction), certain pointer fields are XOR'ed by a cryptographic key generated at runtime. The key is generated once every process launch, one must recover it to unpoison the pointers.


=== Flush-to-Zero and Denormals-are-Zero Floating-Point environment ===
== Kernel Exploits ==
 
[https://en.wikipedia.org/wiki/Subnormal_number Subnormal numbers] (also called as denormal numbers in IEEE 754 documents before the 2008 version) are treated as 0 on the PlayStation runtime environment. This isn't technically a security technique but it does inhibit any exploit that uses floating-point numbers for read/write.
 
An example entrypoint is WebKit where exploits have commonly used double arrays with incorrect length to read/write certain memory areas to gain arbitrary read/write or even code execution. With FTZ/DAZ, the possible 64-bit values one can write have become even more limited. Reads using double arrays are also affected. Even if the bit pattern is nonzero but encodes a subnormal, it will be read by the JavaScript engine as 0.
 
== Kernel ==


=== FW <= 11.52 - Double free in bnet_netevent_set_queue ===
=== FW <= 11.52 - Double free in bnet_netevent_set_queue ===
Line 1,036: Line 953:
* [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,243: Line 1,158:


==== Patched ====
==== Patched ====
'''Yes''' in PS4 7.50 FW and in PS5 5.00 or 5.02 FW. Not working in PS5 FWs <= 2.70.
'''Yes''' in PS4 7.50 FW and in PS5 5.00 or 5.02 FW. Not working in PS5 FWs <= 2.50.
----
----


Line 1,319: Line 1,234:


==== 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,329: Line 1,242:


==== 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,336: Line 1,249:
==== Tested ====
==== Tested ====
Works on FWs 4.00-4.05. On <= 3.70 FW we have not found a way to leak the target object, but it might be doable as Fail0verflow did it on 1.01.
Works on FWs 4.00-4.05. On <= 3.70 FW we have not found a way to leak the target object, but it might be doable as Fail0verflow did it on 1.01.
----
=== FW <= ?4.05? - amd64_set_ldt Heap Overflow (CVE-2016-1885) ===
==== Credits ====
* 2016-10-25 This vulnerability was discovered and researched by Francisco Falcon from Core Exploit Writers Team
* 2016-10-25 Revised patch to address a problem pointed out by ahaha from Chaitin Tech.
==== Analysis ====
* https://www.freebsd.org/security/advisories/FreeBSD-SA-16:15.sysarch.asc
* 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 ====
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
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.
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 ====
'''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.
==== Tested ====
Not yet.
----
----


Line 1,537: Line 1,418:
* 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.
* 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 ====
=== 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. 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 exploit can be used to dump the PFS AES XTS and HMAC keys of a specific PS4 game PKG. Then one can use maxton's LibOrbisPkg or flatz's pkg_pfs_tool to unpack this PKG file.
 
It also lets one retrieve portability master keys. They decrypt blobs (stored in non-secure world, like in [[SceShellcore]]) that contain the portability keys.
 
Below is a sample code to dump some "raw" keys (as named by flatz).
<source lang="C">
unsigned int key_count = 0x160;
unsigned int max_key_size = 0x40;
unsigned int *key_ids = (unsigned int *) malloc (key_count * 4);
unsigned int key_id = 0;
while (key_id < 0x160) {
    key_ids[key_id] = key_id;
    key_id++;
}
uint8_t* key_data = NULL;
size_t key_data_size = 0;
dump_raw_keys(key_ids, key_count, max_key_size, &key_data, &key_data_size);
hexdump(&key_data, &key_data_size);
</source>
 
A sample code to dump portability keys is available on [https://github.com/SiSTR0/ps4-hen-vtx/compare/master...jocover:ps4-hen-vtx:samu_key_dump#diff-e44475b3203baef04439ee15f01629a5752685028fc9118e3d2087dab7379698R908 line 908 of kpayload/source/samu_dump.c]. Note that not all keys are used as some may be deprecated or added with System Software revisions.


Dumped savedata keys would be per-save, as the dumped key ring should only contain the derivated key (XTS) but not the one used to generate it.
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.


Finally, one can retrieve its per-console VTRM keys (which are notably used for per-account securities like for act.dat and [[RIF]]).
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...


However, master keyrings are the 0, 1, and 2 ones and cannot be dump them with this trick because they get locked during the [[bootprocess]] and cannot be read nor written nor copied to other keyrings. See also [https://wiki.henkaku.xyz/vita/Cmep_Key_Ring_Base PS Vita keyrings].
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 ====
==== Analysis ====
Line 1,576: Line 1,432:
* https://twitter.com/qlutoo/status/1027691272369262594
* https://twitter.com/qlutoo/status/1027691272369262594
* https://www.lolhax.org/2019/01/02/extracting-keys-f00d-crumbs-raccoon-exploit/
* https://www.lolhax.org/2019/01/02/extracting-keys-f00d-crumbs-raccoon-exploit/
* [https://twitter.com/flat_z/status/1472243592815169546 Short explanation by flatz (2021-12-18)]
* https://twitter.com/flat_z/status/1472243592815169546


==== Implementation ====
==== Implementation ====


* [https://github.com/jocover/ps4-hen-vtx/releases/tag/pfs_dump Compiled payload for PS4 5.05 by jogolden (2023-03-18)]
* [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 (2023-03-18)]
* [https://github.com/jocover/ps4-hen-vtx/tree/samu_key_dump Implementation for PS4 5.05 by jogolden]
* [https://github.com/SiSTR0/ps4-hen-vtx/compare/master...jocover:ps4-hen-vtx:samu_key_dump Minimal implementation for PS4 5.05 by jogolden (2023-03-18)]
* [https://gist.github.com/flatz/22215327864d7512e52268f9c9c51cd8 Exploit PoC for PS4 7.55 by flatz]
* [https://gist.github.com/flatz/22215327864d7512e52268f9c9c51cd8 Exploit PoC for PS4 7.55 by flatz (2021-12-18)]


==== Patched ====
==== Patched ====
Line 1,699: Line 1,554:
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.
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 ==
== Hardware Exploits ==


=== PCIe man-in-the-middle attack ===
=== PCIe man-in-the-middle attack ===
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)