文章预览
前言 作者利用任意地址读写分别改写 modprobe_path 以及 cred 结构体去实现提权的操作,由于改写 modprobe_path 的方法之前已经研究过了,因此现在详细记录一下如何修改 cred 结构体完成提权操作。 cred结构体 cred 结构体通常出现在UNIX/Linux操作系统内核中,用于表示进程的凭据(credentials)。这些凭据包括有关进程身份的信息,如用户ID、组ID、权限等。结构体部分成员如下 struct cred { atomic_t usage ; # ifdef CONFIG_DEBUG_CREDENTIALS atomic_t subscribers ; /* number of processes subscribed */ void * put_addr ; unsigned magic ; # define CRED_MAGIC 0x43736564 # define CRED_MAGIC_DEAD 0x44656144 # endif 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
………………………………