Changes

6,824 bytes added ,  15:39, 19 February 2019
standardization
Line 62: Line 62:  
| April 9, 2018
 
| April 9, 2018
 
| [[User:SciresM|SciresM]], almost surely others (independently).
 
| [[User:SciresM|SciresM]], almost surely others (independently).
 +
|-
 +
| Poor validation of bootrom SDRAM configuration parameters leads to arbitrary writes in bootrom
 +
|
 +
The Tegra X1 bootrom supports saving SDRAM parameters to scratch registers, and using the saved configuration to enable DRAM during warmboot.
 +
 +
The code that parses these parameters does if (params->EmcBctSpareN) *params->EmcBctSpareN = params->EmcBctSpareNPlusOne for most N, without validating either the address or value written to it.
 +
There are other arbitrary writes in this code, as well (e.g. BootromPatch parameters intended for patching MISC registers do not check a relative offset to 0x7000000, etc).
 +
 +
This allows a user with access to the PMC registers (via pre-sleep bpmp execution, or otherwise) to gain arbitrary bootrom code execution.
 +
| None
 +
| HAC-001 (Tegra210)
 +
| 2017
 +
| December 16, 2018
 +
| Everyone (independently).
 
|}
 
|}
   Line 123: Line 137:  
|  January 2018
 
|  January 2018
 
|  April 29, 2018
 
|  April 29, 2018
|  [[User:Hexkyz|hexkyz]]
+
|  [[User:Hexkyz|hexkyz]], probably others (independently).
 +
|-
 +
|  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 150: Line 182:  
| December 2017 (Probably earlier by others)
 
| December 2017 (Probably earlier by others)
 
| January 18, 2018
 
| January 18, 2018
| [[User:SciresM|SciresM]], probably others.
+
| [[User:SciresM|SciresM]], probably others (independently).
 
|-
 
|-
 
|  jamais vu (non-secure world access to PMC MMIO and pre-deep sleep firmware)
 
|  jamais vu (non-secure world access to PMC MMIO and pre-deep sleep firmware)
Line 174: Line 206:  
|  January, 2018
 
|  January, 2018
 
|  February 23, 2018
 
|  February 23, 2018
|  [[User:SciresM|SciresM]] and [[User:motezazer|motezazer]], [[User:Naehrwert|naehrwert]], [[User:Hexkyz|hexkyz]], probably others, independently.
+
|  [[User:SciresM|SciresM]] and [[User:motezazer|motezazer]], [[User:Naehrwert|naehrwert]], [[User:Hexkyz|hexkyz]], probably others (independently).
 
|-
 
|-
 
|}
 
|}
Line 195: Line 227:  
| 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 236:  
| 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 246:  
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 239: Line 271:  
| January 2018
 
| January 2018
 
| [[User:SciresM|SciresM]], [[User:Yellows8|yellows8]]
 
| [[User:SciresM|SciresM]], [[User:Yellows8|yellows8]]
 +
|-
 +
| Potential [[SVC|svcWaitForAddress]] thread use-after-free
 +
| Between [[4.0.0]], where svcWaitForAddress was introduced, and [[7.0.0]], there was a second intrusive rbtree node in KThread for the WaitForAddress tree (the key being (address, priority), sorted lexicographically). Unlike the WaitProcessWideKeyAtomic tree, the kernel forgot to reinsert the WaitForAddress node when the thread's priority changed (priority inheritance and/or SetPriority), breaking the rbtree invariants; and since the kernel walks through the entire tree to remove intrusive nodes, you could cause threads to stay in the tree even after their deletion.
 +
 +
[[7.0.0]] fixed the issue by using the same intrusive node for both trees. The thread/node knows which tree it is in, and the latter is correctly updated when thread priority changes.
 +
| It unluckily didn't look exploitable
 +
| [[7.0.0]]
 +
| [[7.0.0]]
 +
| July 2018
 +
| February 2019
 +
| [[User:TuxSH|TuxSH]]
 
|-
 
|-
 
|}
 
|}
Line 370: Line 413:  
| 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 423:  
| 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]]
 
|-
 
|-
| [https://daeken.svbtle.com/nintendo-switch-nvservices-info-leak transfermeme (nvservices info leak)]
+
| Transfer Memory leak in nvservices system module
| The nvservices sysmodule does not clear its transfer memory prior to release.
+
| 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.
+
| 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]]
| 4.1.0
+
| [[6.0.0]]
| 7 September 2017
+
| June 2017
 
| 16 October 2018
 
| 16 October 2018
| [[User:daeken|daeken]]
+
| [[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 (independently).
 +
|-
 +
| 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
 +
|-
 
|}
 
|}