Re: [PATCH] prctl: remove one-shot limitation for changing exe link

From: One Thousand Gnomes
Date: Mon Jul 18 2016 - 16:14:03 EST

> >> 1) Attach to process via ptrace (protected by CAP_SYS_PTRACE)
> >> 2) Unmap all the process file mappings, related to "exe" file.
> >> 3) Change exe link (protected by CAP_SYS_RESOURCE).
> >>
> >> IOW, some other process already has an access to process internals (and thus
> >> it's already compromised), and can inject fork and use the child of the
> >> compromised program to masquerade.
> >> Which means this limitation doesn't solve the problem it was aimed to.

IFF it is the same uid or root (in which case you already lost). In the
case of cross uid activity this is not true.