基本信息
端口扫描
常规22和80:

80
需要加一下host:
1 | 10.10.10.183 forwardslash.htb |

扫一下目录:
1 | gobuster dir -u http://forwardslash.htb/ -w /usr/share/wordlists/dirb/common.txt -x php,txt |
发现一个note.txt:


1
2
3
4 Pain, we were hacked by some skids that call themselves the "Backslash Gang"... I know... That name...
Anyway I am just leaving this note here to say that we still have that backup site so we should be fine.
-chiv
backup site
根据提示信息以及vhost扫描,找到backup.forwardslash.htb,同样加到hosts里:
1 | gobuster vhost -u http://forwardslash.htb/ -w /usr/share/wordlists/dirb/common.txt |


注册账号登录进去,这个功能有个可疑的地方:


取消disable测试,发现是post一个url参数:

LFI
这里有一个明显的LFI:
/etc/passwd

根据passwd文件得到两个用户名:
1 | pain:x:1000:1000:pain:/home/pain:/bin/bash |
config.php
直接读取config.php得到数据库配置信息:

1 | define('DB_USERNAME', 'www-data'); |
api.php
部分文件直接读没权限可以用php伪协议:


dev/index.php
得到chiv账号密码:

1 | chiv : N0bodyL1kesBack/ |
chiv ssh
用这个账号密码能ssh登录chiv,但user.txt在另一个用户目录里:

backup 条件竞争
存在/var/backups目录和/usr/bin/backup程序, 直接使用报错:

根据报错信息,可以利用条件竞争:
1 | cat shell.sh |
得到pain用户密码:

1 | define('DB_USERNAME', 'pain'); |
user flag
切换到pain用户,得到user.txt:

encryptorinator
在这个目录有一个加密文本和加解密代码:

根据代码写一个解密程序爆破key,获得message:
1 | def decrypt(key, msg): |
结果:
1 | python miao.py |
信息
根据结果得到这个加密的img:
1 | /var/backups/recovery/encrypted_backup.img |
并且sudo -l
能够看到当前用户可以无密码cryptsetup以及指定目录mount:

pain用户目录也有个note.txt说明这些:
1 | cat note.txt |
decrypt & mount
1 | sudo /sbin/cryptsetup luksOpen /var/backups/recovery/encrypted_backup.img backup |
里面是一个SSH私钥:

root flag
使用这个私钥可以ssh登录root,得到root.txt:

参考资料
https://sushant747.gitbooks.io/total-oscp-guide/local_file_inclusion.html
Hackthebox Forwardslash Walkthrough - YouTube
https://www.youtube.com/watch?v=hSGOLMgr5bw