Home General Computer Multimedia Business Lounge
|
Linux pkexec and polkitd 0.96 race condition privilege escalation
|
|
10-09-2011, 04:12 AM
(This post was last modified: 10-10-2011 02:18 AM by ev1lut10n.)
|
|||
|
|||
|
Linux pkexec and polkitd 0.96 race condition privilege escalation
exploit download:
http://packetstormsecurity.org/files/vie...xec.sh.txt Brief Descriptions thanks to : thanks to all devilzc0de crews and members, X-hack,Danzel src/polkit/polkitunixprocess.c where it fails to clarify the real uid, under this race condition it will return the effective one. on : polkit_unix_process_get_owner (PolkitUnixProcess *process, g_snprintf (procbuf, sizeof procbuf, "/proc/%d", process->pid); if (stat (procbuf, &statbuf) != 0) { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED, "stat() failed for /proc/%d: %s", process->pid, g_strerror (errno)); goto out; } where the code only rely on stat of the pseudo filesystem src/polkit/polkitsubject.c ---------> there's not enough validation to run polkit_unix_process_new on polkit_subject_from_string (const gchar *str, there's no enough validation before launching polkit_unix_process_new if (g_str_has_prefix (str, "unix-process:")) { val = g_ascii_strtoull (str + sizeof "unix-process:" - 1, &endptr, 10); if (*endptr == '\0') { subject = polkit_unix_process_new ((gint) val); the fix is to add more validations (polkit_unix_process_new_for_owner,polkit_unix_process_new_full,polkit_unix_process_new_full): if (sscanf (str, "unix-process:%d:%" G_GUINT64_FORMAT ":%d", &scanned_pid, &scanned_starttime, &scanned_uid) == 3) { + subject = polkit_unix_process_new_for_owner (scanned_pid, scanned_starttime, scanned_uid); + } + else if (sscanf (str, "unix-process:%d:%" G_GUINT64_FORMAT, &scanned_pid, &scanned_starttime) == 2) + { + subject = polkit_unix_process_new_full (scanned_pid, scanned_starttime); + } + else if (sscanf (str, "unix-process:%d", &scanned_pid) == 1) + { + subject = polkit_unix_process src/polkitbackend/polkitbackendsessionmonitor.c function polkit_backend_session_monitor_get_user_for_subject (PolkitBackendSessionMonitor if (POLKIT_IS_UNIX_PROCESS (subject)) { GError *local_error; local_error = NULL; uid = polkit_unix_process_get_owner (POLKIT_UNIX_PROCESS (subject), &local_error); as we may see from above code : "polkit_unix_process_get_owner" will not avoid "Time of Check to Time of Use Problem" http://www.usenix.org/events/fast05/tech...ei/wei.pdf src/programs/pkexec.c pkexec doesn't use the uid of parent process had and will still continue when the parent die : pid_of_caller = getppid (); if (pid_of_caller == 1) { pid_of_caller = getpgrp (); } subject = polkit_unix_process_new (pid_of_caller); where it will continue even if the parent is dead. where the patch has been applied by adding prctl to check the death signal of the parent process (PR_SET_PDEATHSIG): if (prctl (PR_SET_PDEATHSIG, SIGTERM) != 0) + { + g_printerr ("prctl(PR_SET_PDEATHSIG, SIGTERM) failed: %s\n", g_strerror (errno)); /**So if our parent die goto out***/ + goto out; + } pkexec.sh Code: #!/bin/sh
|
|||
|
10-09-2011, 01:14 PM
|
|||
|
|||
|
RE: Linux pkexec and polkitd 0.96 race condition privilege escalation
wow.....
:privilege escalation, nyobain ah barangkali beruntung bisa dapet root.....
|
|||
|
10-09-2011, 05:20 PM
|
|||
|
|||
|
RE: Linux pkexec and polkitd 0.96 race condition privilege escalation
Thanks and Good Job bro :)
|
|||
|
10-12-2011, 09:40 AM
|
|||
|
|||
|
RE: Linux pkexec and polkitd 0.96 race condition privilege escalation
thanks om, langsung eksekusi
|
|||
|
« Next Oldest | Next Newest »
|
| Topic Tools | ||||||
| ||||||
| Users Browsing |
| 1 Guest(s) |






:






