Files
vulhub/aria2/rce/README.zh-cn.md
Aaron 63285f61aa
Some checks failed
Vulhub Format Check and Lint / format-check (push) Has been cancelled
Vulhub Format Check and Lint / markdown-check (push) Has been cancelled
Vulhub Docker Image CI / longtime-images-test (push) Has been cancelled
Vulhub Docker Image CI / images-test (push) Has been cancelled
first commit
2025-09-06 16:08:15 +08:00

38 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Aria2 任意文件写入漏洞
Aria2是一个命令行下轻量级、多协议、多来源的下载工具支持 HTTP/HTTPS、FTP、BitTorrent、Metalink内建XML-RPC和JSON-RPC接口。在有权限的情况下我们可以使用RPC接口来操作aria2来下载文件将文件下载至任意目录造成一个任意文件写入漏洞。
参考文章:[https://paper.seebug.org/120/][1]
## 环境搭建
启动漏洞环境:
```
docker compose up -d
```
6800是aria2的rpc服务的默认端口环境启动后访问`http://your-ip:6800/`发现服务已启动并且返回404页面。
## 漏洞复现
因为rpc通信需要使用json或者xml不太方便所以我们可以借助第三方UI来和目标通信如 http://binux.github.io/yaaw/demo/ 。
打开yaaw点击配置按钮填入运行aria2的目标域名`http://your-ip:6800/jsonrpc`:
![](1.png)
然后点击Add增加一个新的下载任务。在Dir的位置填写下载至的目录File Name处填写文件名。比如我们通过写入一个crond任务来反弹shell
![](2.png)
这时候arai2会将恶意文件我指定的URL下载到/etc/cron.d/目录下文件名为shell。而在debian中/etc/cron.d目录下的所有文件将被作为计划任务配置文件类似crontab读取等待一分钟不到即成功反弹shell
![](3.png)
> 如果反弹不成功注意crontab文件的格式以及换行符必须是`\n`,且文件结尾需要有一个换行符。
当然,我们也可以尝试写入其他文件,更多利用方法可以参考[这篇文章][1]
[1]: https://paper.seebug.org/120/