Changes

5,422 bytes added ,  22:10, 24 November 2018
RIP part 2
Line 124: Line 124:  
|  April 29, 2018
 
|  April 29, 2018
 
|  [[User:Hexkyz|hexkyz]]
 
|  [[User:Hexkyz|hexkyz]]
 +
|-
 +
|  pk1ldrhax
 +
|  Package1ldr decrypts and verifies the keyblob inside of the current BCT in order to get the package1 key, and then uses the package1 key to decrypt package1. It then validates package1 before jumping to it by checking the PK11 magic number, and that the section sizes sum to the expected size (and are individually less than the expected size).
 +
 +
However, package1ldr does not actually validate the package1 key against a fixed vector (much like kernel9loader forgot to do so on the 3ds). This would normally not matter, as keyblobs are validated -- however, with bootrom code execution one can dump SBK and forge keyblobs, and thus control the package1 key.
 +
 +
Thus ('''in theory, but not in practice due to the size of the brute force required''') one can replace the package1 key with garbage, causing package1 to decrypt into garbage, and hope that this garbage passes validation checks and that package1ldr jumping into the garbage will do something useful.
 +
 +
This was fixed incidentally in [[6.2.0]], as pk1ldr does not use keyblob data to decrypt package1 any more.
 +
 +
|  With a large enough brute force: arbitrary package1 code execution from coldboot.
 +
 +
However, a usable brute force is on the order of >= ~2^80, so '''this is almost certainly not actually usable in any meaningful context'''.
 +
|  [[6.2.0]]
 +
|  [[6.2.0]]
 +
|  Early 2017 (as soon as plaintext package1ldr was first dumped)
 +
|  November 20, 2018
 +
|  Everyone
 
|-
 
|-
 
|}
 
|}
Line 195: Line 213:  
| Many syscalls leaked kernel pointers on sad paths (for example svcSetHeapSize and svcQueryMemory), until they landed a bunch of fixes in 2.0.0.
 
| Many syscalls leaked kernel pointers on sad paths (for example svcSetHeapSize and svcQueryMemory), until they landed a bunch of fixes in 2.0.0.
 
| Nothing really.
 
| Nothing really.
| 2.0.0
+
| [[2.0.0]]
| 2.0.0
+
| [[2.0.0]]
 
|  
 
|  
 
|  
 
|  
Line 204: Line 222:  
| If there is a page fault when fetching handles from the userspace array, it cleans up by dereferencing all objects despite having only loaded first N. Allows the attacker to make arbitrary decrefs on any kernel synchronization object, and thus can be used to get UAF. Haven't actually been tried on real HW though, but should work (tm).
 
| If there is a page fault when fetching handles from the userspace array, it cleans up by dereferencing all objects despite having only loaded first N. Allows the attacker to make arbitrary decrefs on any kernel synchronization object, and thus can be used to get UAF. Haven't actually been tried on real HW though, but should work (tm).
 
| Kernel code execution
 
| Kernel code execution
| 2.0.0
+
| [[2.0.0]]
| 2.0.0
+
| [[2.0.0]]
 
|  
 
|  
 
| 24 April
 
| 24 April
Line 214: Line 232:  
On 1.0.0 you could supply irq_id < 32 and it would write outside the SharedIrqs table.
 
On 1.0.0 you could supply irq_id < 32 and it would write outside the SharedIrqs table.
 
| You can register irq's in the Core3Irqs table, and thus register per-core irqs for core3, that are normally reserved for kernel. Useless.
 
| You can register irq's in the Core3Irqs table, and thus register per-core irqs for core3, that are normally reserved for kernel. Useless.
| 2.0.0
+
| [[2.0.0]]
| 2.0.0
+
| [[2.0.0]]
 
| ~October
 
| ~October
 
| 17 October
 
| 17 October
Line 370: Line 388:  
| Prior to [[2.0.0]], object IDs in [[IPC_Marshalling#Domain_message|domain messages]] are not bounds checked. This out-of-bounds read could be exploited to brute-force ASLR and get PC control in some services that support domain messages.
 
| Prior to [[2.0.0]], object IDs in [[IPC_Marshalling#Domain_message|domain messages]] are not bounds checked. This out-of-bounds read could be exploited to brute-force ASLR and get PC control in some services that support domain messages.
 
|
 
|
| 2.0.0
+
| [[2.0.0]]
| 2.0.0
+
| [[2.0.0]]
 
| ~July 2017
 
| ~July 2017
 
| 20 July 2017‎
 
| 20 July 2017‎
Line 380: Line 398:  
| Sysmodule crashes.  Most usefully, crashing ldr allows access to fsp-ldr and crashing pm allows access to fsp-pr. Useless after [[4.0.0]], which mitigated a number of single-session service access issues.
 
| Sysmodule crashes.  Most usefully, crashing ldr allows access to fsp-ldr and crashing pm allows access to fsp-pr. Useless after [[4.0.0]], which mitigated a number of single-session service access issues.
 
| Unfixed
 
| Unfixed
| 4.1.0
+
| [[4.1.0]]
 
| 24 June 2017
 
| 24 June 2017
 
| 8 March 2018
 
| 8 March 2018
 
| [[User:daeken|daeken]]
 
| [[User:daeken|daeken]]
 +
|-
 +
| Transfer Memory leak in nvservices system module
 +
| The nvservices sysmodule does not clear most of its transfer memory prior to release.
 +
| The calling process can read key bits of memory, including breaking ASLR (by revealing the image base) and exposing the address of other transfer memory to set up attacks. More details here: [https://daeken.svbtle.com/nintendo-switch-nvservices-info-leak transfermeme (nvservices info leak)] by [[User:daeken|daeken]]
 +
| [[6.0.0]]
 +
| [[6.0.0]]
 +
| June 2017
 +
| 16 October 2018
 +
| [[User:qlutoo|qlutoo]] and [[User:hexkyz|hexkyz]],
 +
[[User:daeken|daeken]] (independently)
 +
|-
 +
| OOB write in audio system module
 +
| Prior to [[2.0.0]], the [[Audio_services#audout:u|AppendAudioOutBuffer]] and [[Audio_services#audin:u|AppendAudioInBuffer]] IPC commands would blindly increment the appended buffers' count while using said count value as an index to where the user data should be copied into. This resulted in an 0x28 bytes, user controlled, out-of-bounds memory write into the [[Audio_services|audio]] sysmodule's memory space.
 +
Combined with the [[Audio_services#audout:u|GetReleasedAudioOutBuffer]] or [[Audio_services#audin:u|GetReleasedAudioInBuffer]] commands, this could also be used as an 8 byte infoleak.
 +
 +
In [[2.0.0]], the commands now return error code 0x1099 if the number of unreleased buffers exceeds 0x1F.
 +
| Code execution under audio sysmodule
 +
| [[2.0.0]]
 +
| [[2.0.0]]
 +
|
 +
| November 2, 2018
 +
| [[User:hexkyz|hexkyz]], probably others.
 +
|-
 +
| nvhax (memory corruption in nvservices system module)
 +
| Prior to [[6.2.0]], the [[NV_services|nvservices]] ioctl [[NV_services#.2Fdev.2Fnvhost-ctrl-gpu|NVGPU_GPU_IOCTL_WAIT_FOR_PAUSE]] would take a single "pwarpstate" argument which would be interpreted by nvservices as a memory pointer for writing 2 "warpstate" structs (one for each Streaming Multiprocessor).
 +
This resulted in nvservices attempting to blindly memcpy into this user supplied address and trigger a crash. However, if paired with an infoleak, this could be used to arbitrarily write 0x30 bytes anywhere in nvservices' memory space.
 +
Additionally, the "warpstate" struct itself was never initialized, which means nvservices would leak the 0x30 bytes from the stack. By invoking other ioctls it was also possible to partially control the stack contents and achieve a usable arbitrary memory write primitive.
 +
 +
In [[6.2.0]], [[NV_services#.2Fdev.2Fnvhost-ctrl-gpu|NVGPU_GPU_IOCTL_WAIT_FOR_PAUSE]] now takes 2 inline "warpstate" structs instead of a "pwarpstate" pointer, thus effectively avoiding the bad memcpy.
 +
| Code execution under nvservices sysmodule
 +
| [[6.2.0]]
 +
| [[6.2.0]]
 +
| April 5, 2017
 +
| November 24, 2018
 +
| [[User:hexkyz|hexkyz]]
 +
|-
 +
| Infoleak in nvservices system module
 +
| The [[NV_services|nvservices]] ioctl [[NV_services#NVMAP_IOC_ALLOC|NVMAP_IOC_ALLOC]] takes an optional argument "addr" which allows the calling process to pass a pointer to user allocated memory for backing a nvmap object. If "addr" is left as 0, nvservices uses the transfer memory region (donated by the user during initialization) instead, when allocating memory for the nvmap object.
 +
By design, freeing the nvmap object by calling the ioctl [[NV_services#NVMAP_IOC_FREE|NVMAP_IOC_FREE]] returns, in its "refcount" argument, the user address previously supplied if the reference count reaches 0.
 +
However, prior to [[6.2.0]], the case where the transfer memory region is used to allocate the nvmap object was not taken into account, thus resulting in [[NV_services#NVMAP_IOC_FREE|NVMAP_IOC_FREE]] leaking back an address from within the transfer memory region mapped in nvservices' memory space.
 +
 +
In [[6.2.0]], [[NV_services#NVMAP_IOC_FREE|NVMAP_IOC_FREE]] no longer returns the address when the transfer memory region is used instead of user supplied memory.
 +
| Combined with other vulnerabilities: Defeating ASLR in nvservices sysmodule.
 +
| [[6.2.0]]
 +
| [[6.2.0]]
 +
| April 2017
 +
| November 24, 2018
 +
| Everyone
 +
|-
 
|}
 
|}