How to use SUID to escalate privileges under Linux

WBOY
Release: 2023-05-23 23:52:05
forward
1671 people have browsed it

SUID is a permission mechanism in Linux. When a file with this permission is executed, the caller will temporarily obtain the permissions of the owner of the file. If you have SUID permissions, you can use binaries and tools in the system to perform root privilege escalation.

The following command can discover all SUID executable files running on the system. Specifically, the command will try to find files with a SUID that has root permissions.

find / -user root -perm -4000 -print 2>/dev/null find / -perm -u=s -type f 2>/dev/null find / -user root -perm -4000 -exec ls
Copy after login

How to use SUID to escalate privileges under Linux


How to use SUID to escalate privileges under Linux

All the above binaries will be executed with root user rights because of their permissions Contains "s" and corresponds to root permissions.

Bash

The following command will open a bash shell with root privileges.

bash -p bash-3.2# id uid=1002(service) gid=1002(service) euid=0(root) groups=1002(service)
Copy after login

How to use SUID to escalate privileges under Linux

The above is the detailed content of How to use SUID to escalate privileges under Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!