Cook: Security things in Linux v5.3
In recent exploits, one of the steps for making the attacker’s life easier is to disable CPU protections like Supervisor Mode Access (and Execute) Prevention (SMAP and SMEP) by finding a way to write to CPU control registers to disable these features. For example, CR4 controls SMAP and SMEP, where disabling those would let an attacker access and execute userspace memory from kernel code again, opening up the attack to much greater flexibility. CR0 controls Write Protect (WP), which when disabled would allow an attacker to write to read-only memory like the kernel code itself. Attacks have been using the kernel’s CR4 and CR0 writing functions to make these changes (since it’s easier to gain that level of execute control), but now the kernel will attempt to 'pin' sensitive bits in CR4 and CR0 to avoid them getting disabled. This forces attacks to do more work to enact such register changes going forward."
Posted Nov 15, 2019 14:49 UTC (Fri)
by zainryan (guest, #131584)
[Link] (1 responses)
Posted Nov 15, 2019 15:16 UTC (Fri)
by farnz (subscriber, #17727)
[Link]
If the attacker can execute arbitrary code in ring 0, they have full control of the kernel, and nothing done in kernel code can protect against them.
The point of pinning here is that there are techniques like ROP that allow you to call your choice of kernel code with your choice of arguments. By teaching native_write_cr4 to never unset some security-relevant bits, you've forced the attacker to find a harder route to arbitrary code execution than just "call native_write_cr4 to disable SMEP and then branch to my formerly userspace code". This, in turn, makes it less likely that any given bug will be actively exploited - it becomes harder to write a reliable exploit - and gives the kernel developers more time between "this bug permits ROP" and "this bug is being exploited in the wild".
Posted Nov 18, 2019 1:05 UTC (Mon)
by NYKevin (subscriber, #129325)
[Link] (6 responses)
That is a frightening statistic. Thanks to Mr. Silva for fixing those bugs!
Posted Nov 19, 2019 19:25 UTC (Tue)
by rweikusat2 (subscriber, #117920)
[Link] (5 responses)
I'm purposely not adding an interpretation here, just some missing facts and a very probable conjecture.
Posted Nov 19, 2019 19:38 UTC (Tue)
by rweikusat2 (subscriber, #117920)
[Link]
Posted Nov 21, 2019 7:09 UTC (Thu)
by bosyber (guest, #84963)
[Link] (1 responses)
Posted Nov 21, 2019 18:59 UTC (Thu)
by rweikusat2 (subscriber, #117920)
[Link]
Posted Nov 22, 2019 6:53 UTC (Fri)
by roc (subscriber, #30627)
[Link] (1 responses)
"Essentially dead" is poorly defined, and I think fuzzy thinking in this area lures people into a false sense of security.
Just because path is rarely taken in real-world usage or in tests, doesn't necessarily mean it's hard for an attacker to cause that path to be taken. For example lots of error handling code is easy to trigger but won't be triggered unless someone specifically targets it.
Posted Nov 22, 2019 19:02 UTC (Fri)
by rweikusat2 (subscriber, #117920)
[Link]
Modify CR4 and CR0 directly using mov
Modify CR4 and CR0 directly using mov
Cook: Security things in Linux v5.3
Cook: Security things in Linux v5.3
Cook: Security things in Linux v5.3
Cook: Security things in Linux v5.3
The kernel has obviously improved because these bugs were fixed. But calling this "a frightening statistic" is IMHO seriously overemphasizing this: Chances are that more more critical errors were fixed in the 'ordinary' way during this period. There are also some more general conclusions to be drawn here:
Cook: Security things in Linux v5.3
Cook: Security things in Linux v5.3
Cook: Security things in Linux v5.3