News for hackers. Stuff that matters.
Re:“Most serious” Linux privilege-escalation bug ever is und... by kentonv on Friday October 21, 2016 @01:10AM (#12758270)
As others have pointed out, mounting read-only wouldn't have helped here.

What would have helped:

* Block ptrace() syscall using seccomp.

* Don't mount /proc, or mount it read-only.

As I understand it, those steps would close all attack vectors for this bug.

FWIW, the Sandstorm.io sandbox blocks ptrace() and doesn't mount /proc at all, so I think the bug has never been exploitable by Sansdtorm apps. (Disclosure: I am the tech lead of Sandstorm.)

I think Docker now defaults to mounting /proc read-only and blocking ptrace(), so it may mitigate this vulnerability as well, but I'm not 100% sure about that.

Re:“Most serious” Linux privilege-escalation bug ever is und... by r3w on Friday October 21, 2016 @01:47AM (#12758393)
* don't let network services mmap (or even open!) random executables through mandatory access control (SELinux)
Re:“Most serious” Linux privilege-escalation bug ever is und... by AstralStorm on Friday October 21, 2016 @01:20PM (#12762439)
Ptrace is not needed for an exploit, you only need to be able to mmap a file. Does not even have to be writable.
Re:“Most serious” Linux privilege-escalation bug ever is und... by kentonv on Friday October 21, 2016 @06:27PM (#12765459)
No, it's more complicated than that. You need one process to mmap a file, and then you need a second process to be writing into the first process's address space while the first process triggers the COW. You can't do it with one process attacking itself.
Re:“Most serious” Linux privilege-escalation bug ever is und... by amscanne on Saturday October 22, 2016 @07:25AM (#12768276)
No, it requires only two threads to trigger the race. Two processes are not needed.
Re:“Most serious” Linux privilege-escalation bug ever is und... by kentonv on Tuesday October 25, 2016 @03:54PM (#12791116)
Update: We talked to Andy Lutomirski who was involved in reverse-engineering the original exploit and tracking down the bug. He says the code path is not triggered by regular memory writes; you have to go through ptrace() or /proc/self/mem. Details in this blog post:

https://sandstorm.io/news/2016-10-25-cve-2016-5195-dirtycow-...

Of course, if you have evidence to the contrary, we'd all like to know about it!

(You are technically correct that the writes can come from another thread rather than another process, but the important part is that it has to go through one of those interfaces.)

Re:“Most serious” Linux privilege-escalation bug ever is und... by kentonv on Saturday October 22, 2016 @03:43PM (#12770267)
https://bugzilla.redhat.com/show_bug.cgi?id=1384344#c13

> Please note that this mitigation disables ptrace functionality which debuggers and programs that inspect other processes (virus scanners) use and thus these programs won't be operational.

> The in the wild exploit we are aware of doesn't work on Red Hat Enterprise Linux 5 and 6 out of the box because on one side of the race it writes to /proc/self/mem, but /proc/self/mem is not writable on Red Hat Enterprise Linux 5 and 6.

Is everyone barking up the wrong tree here?

EDIT: All of the PoCs here use ptrace() or /proc/self/mem. Why would they do that if they didn't need to?

https://github.com/dirtycow/dirtycow.github.io/wiki/PoCs

Re:“Most serious” Linux privilege-escalation bug ever is und... by kentonv on Monday October 24, 2016 @09:42PM (#12784569)
I just talked to amluto who explained that the race can only be triggered by a write that uses the "force" flag to get_user_pages() (a kernel function). /proc/pid/mem and ptrace() do this but regular writes and process_vm_writev() do not.
Re:“Most serious” Linux privilege-escalation bug ever is und... by ifhs on Saturday October 22, 2016 @01:36AM (#12767377)
Yup, you guys reinvented docker
Re:“Most serious” Linux privilege-escalation bug ever is und... by kentonv on Saturday October 22, 2016 @07:21PM (#12771052)
We had this sandboxing ~2 years before Docker did, so apparently Docker reinvented Sandstorm?

(They're actually completely different products.)