Home > Article > Operation and Maintenance > What does linux privilege escalation mean?
提权指的是低权限用户利用各种合法的或非法的手段获取到了高于本用户的系统权限;Linux提权一般是指获取root用户权限的操作过程。Linux提权的本质一方面是信息收集,另一方面是对内核漏洞的掌握情况;提权是否成功的关键是信息收集是否完整。
本教程操作环境:linux7.3系统、Dell G3电脑。
提权是什么
提权指的是低权限用户利用各种合法的或非法的手段获取到了高于本用户的系统权限。
详细来说,就是指利用操作系统或应用软件中的程序漏洞、设计缺陷或配置疏忽来获取对应用程序或用户来说受保护资源的高级访问权限。其结果是,应用程序可以获取比应用程序开发者或系统管理员预期的更高的特权,从而可以执行授权的动作。
Linux提权一般是指获取root用户权限的操作过程。
Linux提权目的
提权操作有风险为什么还要进行提权?什么情况下需要进行提权?获取高权限之后可以做什么?
通过命令执行漏洞获取的一个反弹shell或是通过Web漏洞获取了一个Webshell后,一般情况下权限都较低。在执行一些重要敏感的操作或是对重要的文件进行修改时无法正常进行,便需要进行提权。Linux中安装的数据库、中间件等一般都不是以root用户启动的,通过数据库或是中间件获取到的权限是是低权限的。
获取一个root权限是每一个黑客的梦想。
- 读取写入服务器中的重要文件:
- 修改root密码
- 替换系统命令
- 在系统中放置更为隐蔽的后门:
- ping后门
- Rootkit
- 保证服务器重启之后权限仍在:
- 内存后门
Linux提权本质
Linux提权的本质一方面是信息收集,另一方面是对内核漏洞的掌握情况。
Linux信息收集
任何提权的第一步操作一定是对操作系统进行信息收集。提权是否成功的关键是信息收集是否完整。
内核设备信息:
用户和群组信息:
用户和权限信息:
环境系统变量信息:
内核漏洞提权指的是普通用户访问操作系统内核,利用内核漏洞将权限提高为root权限,一般首先需要知晓操作系统的内核,内核的版本等信息,再寻找内核漏洞的EXP进行提权
linux常用查看系统信息命令 uname -a 查看系统全部信息 uname -r 查看内核版本 cat /proc/version 查看内核信息 cat /etc/*-realease 查看CentOS版本 cat /etc/issue 查看Ubuntu版本 cat /etc/redhat-release 查看RedHat版本 env 查看环境变量 echo $PATH 查看当前环境变量 awk -F: '($3==0){print $1}' /etc/passwd 查找UID为0的用户 find / -user root -perm -4000 -exec ls -ldb {} \; 查找设置了SUID的文件
1)查看系统的内核版本
2) Use kali’s searchsploit to find the corresponding kernel vulnerability or search for the corresponding kernel vulnerability online
3) Use gcc to Compile the C language program into an executable file, upload it to the target machine, and execute it to escalate privileges to root privileges
1. Scheduled task privilege escalation
Utilization principle:
2. Utilization SUID privilege escalation
SUID concept: SUID (set user ID) is a permission given to a file. It will appear in the execution bit of the file owner's permissions. It has this A file with this kind of permission will allow the caller to temporarily obtain the permissions of the file owner when it is executed. SUID allows the caller to run the file as the file owner, so our idea of using SUID to escalate privileges is to run the file with the SUID owned by the root user. Then when we run the file, we have to obtain the identity of the root user. So, why do we need to set this permission on Linux binaries? In fact, there are many reasons. For example, the program ping requires root privileges to open a network socket, but the user who executes the program is usually an ordinary user to verify connectivity with other hosts.
SUID privilege escalation: What is suid privilege escalation? A file has an s flag, and if it enters root, then we can have root permissions by running this program, and the program must be able to execute commands, then we can upgrade from an ordinary user to root permissions.
Find local files that meet the conditions.
Common programs that can escalate privileges
3. Use SUDO to escalate privileges
Can be used in Linux systems sudo executes a command that only root can execute. The configuration file is saved in /etc/sudoers. sudo -l can list the commands that the current user supports sudo.
Try to analyze the vulnerability from the code level.
4. Environment variable privilege escalation
View the current environment variables:
5. Services running with root privileges
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What does linux privilege escalation mean?. For more information, please follow other related articles on the PHP Chinese website!