/* * The security context of a task * * The parts of the context break down into two categories: * * (1) The objective context of a task. These parts are used when some other * task is attempting to affect this one. * * (2) The subjective context. These details are used when the task is acting * upon another object, be that a file, a task, a key or whatever. * * Note that some members of this structure belong to both categories - the * LSM security pointer for instance. * * A task has two security pointers. task->real_cred points to the objective * context that defines that task's actual details. The objective part of this * context is used whenever that task is acted upon. * * task->cred points to the subjective context that defines the details of how * that task is going to act upon another object. This may be overridden * temporarily to point to another security context, but normally points to the * same context as task->real_cred. */ structcred { atomic_long_t usage; kuid_t uid; /* real UID of the task */ kgid_t gid; /* real GID of the task */ kuid_t suid; /* saved UID of the task */ kgid_t sgid; /* saved GID of the task */ kuid_t euid; /* effective UID of the task */ kgid_t egid; /* effective GID of the task */ kuid_t fsuid; /* UID for VFS ops */ kgid_t fsgid; /* GID for VFS ops */ unsigned securebits; /* SUID-less security management */ kernel_cap_t cap_inheritable; /* caps our children can inherit */ kernel_cap_t cap_permitted; /* caps we're permitted */ kernel_cap_t cap_effective; /* caps we can actually use */ kernel_cap_t cap_bset; /* capability bounding set */ kernel_cap_t cap_ambient; /* Ambient capability set */ #ifdef CONFIG_KEYS unsignedchar jit_keyring; /* default keyring to attach requested * keys to */ structkey *session_keyring;/* keyring inherited over fork */ structkey *process_keyring;/* keyring private to this process */ structkey *thread_keyring;/* keyring private to this thread */ structkey *request_key_auth;/* assumed request_key authority */ #endif #ifdef CONFIG_SECURITY void *security; /* LSM security */ #endif structuser_struct *user;/* real user ID subscription */ structuser_namespace *user_ns;/* user_ns the caps and keyrings are relative to. */ structucounts *ucounts; structgroup_info *group_info;/* supplementary groups for euid/fsgid */ /* RCU deletion */ union { int non_rcu; /* Can we skip RCU deletion? */ structrcu_headrcu;/* RCU deletion hook */ }; } __randomize_layout;
内核的一些函数
关于在内核中有一些函数
本地打内核
用c写exp然后编译成可执行文件,然后再添加到cpio文件夹下,然后启动环境,运行exp,然后提权
远程打内核
远程打内核也是使用Python脚本打。
这里附上一个其他人博客的远程打内核pwn的脚本(只是示例,非本题)
远程打内核最重要的就是将exp上传到远程环境,然后在远程环境执行exp即可提权,提权之后就可以cat flag