基本信息
- https://www.hackthebox.com/home/machines/profile/372
- 10.10.11.103
端口扫描
22和80:
1 | nmap -sC -sV 10.10.11.103 |
80
加hosts后访问,一个CTF练习平台:
1 | 10.10.11.103 developer.htb |
CTF
注册登录后,有一些CTF练习:
challenge PSE
需要完成任意一个challenge后,会出现提交writeup功能:
PSE这个就是PS2EXE,还原出来一个powershell,根据其中的加密函数对应解密:
- https://github.com/studoot/ps2exe
- https://github.com/buuren/powershell/blob/master/misc/encryptPassword.ps1
1 | DHTB{P0w3rsh3lL_F0r3n51c_M4dn3s5} |
提交后,出现submit walkthrough功能:
challenge Phished List
受保护的xlsx中有一列隐藏,去除保护后在其中得到flag
- EASILY UNLOCK Protected Excel Sheets WITHOUT Password - YouTube
https://www.youtube.com/watch?v=2x23vZIRYRs&ab_channel=LeilaGharani
1 | DHTB{H1dD3N_C0LuMn5_FtW} |
challenge Lucky Guess
一个elf,其中有winner函数,直接gdb之类跳过去就可以
1 | DHTB{gOInGWITHtHEfLOW} |
challenge RevMe
.net exe,反编译,EmbeddedSecret函数中得到flag:
1 | DHTB{TCG5_S1mPl3_R3v3r51nG_Ch4773nG3} |
challenge Authentication
64位elf,check_password函数比较两个参数,其中一个是flag
- Reversing Simple Rust Application [Hackthebox - Developer - Authentication] - YouTube
https://www.youtube.com/watch?v=YrxFXvdtyDo&ab_channel=0xdf
1 | DHTB{rusty_bu5in3s5} |
challenge PwnMe
64位elf,check_password调用strcmp比较两个参数,得到密码 supersaiyan3 ,然后运行elf输入正确密码得到flag:
1 | DHTB{b4s1c0v3rF7ow} |
challenge Easy Encryption
就是异或加密,根据flag格式前五位固定是DHBT{可以得到密钥,然后得到flag:
1 | DHTB{XoringIsFun} |
challenge Triple Whammy
还是xor:
1 | DHTB{XorXorXorFunFunFun} |
check walkthrough
任意一个challenge提交wp链接后,应该是管理员定是查看,大概两分钟一次
admin
简单的目录扫描可以发现是django:
reverse tabnabbing
- HackTheBox was vulnerable to reverse tabnabbing | 0xPrashant Blog
https://blog.0xprashant.in/posts/htb-bug/
当 Web 开发人员想要在新选项卡中打开链接时,他们会添加target="_blank"到<a>标签中。问题是,如果该链接导向恶意页面并且没有采取缓解措施,那么该页面上的 JavaScript 实际上可以更改原始页面的位置。因此,如果您链接到网站没有的用户控制内容,这实际上只是一个问题。对此的缓解措施是也添加rel="noopener nofollow"到<a>标签中。
我们提交的walkthrough也是这样,这里的目标是托管一个页面,以便当管理员单击链接时,它会在现在可见的新选项卡中打开。该选项卡中的 JavaScript 将反转选项卡-nab 原始选项卡以将其发送到我托管的另一个页面,该页面看起来像开发人员的登录页面。当管理员阅读完我的页面并返回时,他们会认为他们已出于某种原因注销,然后再次登录,我在此获得了凭据
exploit
就是自己writeup里将返回界面设置为fake login,action指向自己的login函数记录密码
1 | http://10.10.14.2:7777/writeup |
writeup.html
1 | <html> |
app.py
1 | #!/usr/bin/env python3 |
loginform.html
直接复制login界面后修复js,css路径:
1 |
|
Django
diango admin界面发现另一个site,加hosts后访问:
developer-sentry.developer.htb
账号是django admin那里得到的用户名:
1 | jacob@developer.htb SuperSecurePassword@HTB2021 |
secret
执行一些操作触发报错,例如创建一个项目后再删除,报错信息中得到配置信息,包括secret:
1 | 'system.secret-key': 'c7f3a64aa184b7cbb1a7cbe9cd544913'} |
diango rce
就是diango的cookie可以使用pickle反序列化,有secret就可以构造出任意cookie:
- Remote Code Execution on a Facebook server – Sec Team Blog
https://blog.scrt.ch/2018/08/24/remote-code-execution-on-a-facebook-server/
diango_rce.py
1 | #!/usr/bin/python2 |
Postgres
/var/www/developer_ctf/developer_ctf/settings.py 里得到postgresql配置信息:
/etc/sentry/sentry.conf.py 中是另一组账号密码:
1 | DATABASES = { |
数据库中枚举信息:
1 | psql postgresql://ctf_admin:CTFOG2021@localhost:5432/platform |
hash crack
Django (PBKDF2-SHA256)格式hash:
1 | sudo hashcat -m 10000 hash.txt /usr/share/wordlists/rockyou.txt |
user flag
破解出来的密码就是karl的ssh密码,ssh登录得到user.txt:
rust逆向 & root flag
可以sudo运行一个elf,查看strings可以知道是rust:
1 | scp karl@10.10.11.103://root/.auth/authenticator . |
经过一系列逆向分析得到密码:RustForSecurity@Developer@2021:)
(分析过程直接看0xdf文章和ippsec视频吧)
验证通过后可以写公钥:
root flag
然后ssh登录root,读取root.txt:
参考资料
- https://github.com/studoot/ps2exe
- https://github.com/buuren/powershell/blob/master/misc/encryptPassword.ps1
- EASILY UNLOCK Protected Excel Sheets WITHOUT Password - YouTube
https://www.youtube.com/watch?v=2x23vZIRYRs&ab_channel=LeilaGharani - HackTheBox was vulnerable to reverse tabnabbing | 0xPrashant Blog
https://blog.0xprashant.in/posts/htb-bug/ - Remote Code Execution on a Facebook server – Sec Team Blog
https://blog.scrt.ch/2018/08/24/remote-code-execution-on-a-facebook-server/ - HTB Developer [Discussion] | RaidForums
https://raidforums.com/Thread-Tutorial-HTB-Developer-Discussion - HTB: Developer | 0xdf hacks stuff
https://0xdf.gitlab.io/2022/01/15/htb-developer.html - https://www.hackthebox.com/home/machines/writeup/372
- HackTheBox - Developer - YouTube
https://www.youtube.com/watch?v=MjkDCy10BYM&ab_channel=IppSec