tl;dr
- Anonymous login to FTP server.
- Retrieve SSH login username and password from Firefox History
Challenge Points: 930
No. of solves: 85
Solved by: g4rud4, f4lc0n
Challenge Description
Hack Bob’s box!
nmap is allowed for this problem only. However, you may only target misc.utctf.live:8121
and misc.utctf.live:8122
with nmap.
Initial Analysis
We are given 2 servers where one has an FTP server and the other has SSH. We don’t know the username and password for the SSH. Our 1st assumption was the FTP server might be having the details related to the SSH. We don’t the username and password for the FTP server, let try if the FTP server is having any anonymous user
login.
Listing out files from FTP Server
Now we logged into the FTP server, lets see what all files present in this server. When we tried to LIST
out the files in the server we got 425 No data connection
as a message. So we need to have a data connection for getting the data.
We have PORT
command, for establishing a secondary connection for data transfer. PORT command has six number series(ex: PORT 127,0,0,1,10,10
).
Let us see what this decodes to:
- The first four numbers indicate the client’s IP
- Next 2 numbers indicate the PORT number where the server establishes a connection to the client.
num(5)*256 + num(6) = Port number
=>10*256 + 10 = 2570
So let us try to set the connection to localhost on port 2570. But we got an error saying 500 I won't open a connection to 127.0.0.1 (only to 35.238.186.24)
. It is saying it can attempt to connect for local IP only.
Once we changed the localhost to our local IP, we got a reply saying it was successful. Then let us try to LIST
the files present on the server. And we got the files listed out on localhost on port 2570.
In the screenshot we can see that we have the .ssh
folder, so let’s see if we can retrieve the PRIVATE
and PUBLIC
key.
Retrieving the Public and Private keys
Let us list out the contents of the .ssh
folder.
So we got to know that we have the public and private keys present on the server. So let us dump those keys.
We have RETR
command to extract the files from FTP server. On executing these two commands, RETR .ssh/id_rsa
& RETR .ssh/id_rsa.pub
.
Private Key:
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEAsXz+QCTZeGn190BUQRdfROq1Qmy/vXzVxLej9yVFN/ehjNLkouEw
JTt8UINqOn2zwD3QFmM5jAJobDydXe1t0qPLEC0bogAy7O65RiyN1rxNJOjbMAvz9Adg2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kxGRbOh0DzgWR8aVoNc9H7bCBvK22QZ32GjHcvabO8QxH+lVAd/yUJ7hcnsKRwGV/eBBr
05uBm7Z14U3/F2yPXEs1cQLEWazqBLc2qZjSkjGzI16MakEDjV4SGSlCYSlnFCmJBIZCP1
Hxy53Kg47SuiiVqwAAACFtYXR0aGV3cEBzdHJlZXRwaXp6YS5hdHRsb2NhbC5uZXQ=
-----END OPENSSH PRIVATE KEY-----
Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxfP5AJNl4afX3QFRBF19E6rVCbL+9fNXEt6P3JUU396GM0uSi4TAlO3xQg2o6fbPAPdAWYzmMAmhsPJ1d7W3So8sQLRuiADLs7rlGLI3WvE0k6NswC/P0B2DYQ0yn0GBO4j9OXITnfKlWbNhh6RCGp30nEtncqYR0wZGgMxPywZxOCLYIX0Tn+63JrJOZ7SAv/v2w9TYY+HVy0t8Qi7wIFv33uIKsa6ov4jMLl8uwRPqDWTh5S3d1cMhHcIF0wyP9f5eR70Xz1cCRHb7KwVJiwuQvGLCzUAcgn6j0peRbc2fGg9RCiCYB/7mjsX1oisMoheRTTsPc84a3ewC8AHDIj32zKgzPg1iLeXtrfAtGQCAgizUerU8nUKZX1kTei2M4dnRUMj6npQ9MXIgVXUbFJeCo5xLUjrhJb9gXZ9kVx7n29M28JwJh3oCbfmwczAbCgmIyvF8rwpXEiH+eTxJG29H6QuhgQ+DR6+DYPtN//EfXNg2d94vP6adXNezphxM= matthewp@streetpizza.attlocal.net
From the public key, we can get the username of the ssh server we need to login to. So we got the private key and the username.
Let us try to login to the ssh server. But unfortunately, that private key is not getting accepted, that it’s not the correct private key or username.
Let us see what all files present in other folders.
Listing and retrieving files from Other folders
We have .mozilla
, docs
& favs
folder left. Let us see what all files were present in the docs folder
.
Docs folder
We have 3 files present in this folder. Let us retrieve the contents from them.
drwxr-xr-x 2 0 0 4096 Mar 12 18:53 .
drwxr-xr-x 1 0 0 4096 Mar 12 18:53 ..
-rw-rw-r-- 1 0 0 508 Mar 12 06:45 letter.txt
-rw-rw-r-- 1 0 0 435 Mar 12 06:45 notes.md
-rw-rw-r-- 1 0 0 251 Mar 12 06:45 todo.txt
Let us see what all contents present in these files.
todo.txt
| Bob's TODO List |
-------------------------------
-text jeff about gme
-think of a bday gift for tom
-sell my gme stocks
-look up how to sell organs
-figure out what a short is
-check my website is secure
notes.md
# 1/3/2021 Group Meeting
## Georgia's project
- something about APIs ???
- apparently, I have to do something with some newfangled language called Rust >:(
## Security team
- don't click on those emails that say you won a new laptop
- even if they say you're the millionth visitor
- rain on my parade more, why don't you
## My presentation
- seemed like people responded really well
- silence means everyone understood I think
letter.txt
Dear RobinHood employee,
As a user of your application, I was extremely disappointed to
find out that your platform had colluded with Citadel Securities
to protect their interests in shorting $GME. I had a considerable
amount of my life savings invested in this stock, and now I am
having to make difficult decisions about how to pay rent this
month. Hopefully you can appreciate the difficulty that you have
caused me and reinstate my account so I can sell my remaining
shares.
Best,
Bob Bobberson
In all these files, we can see the details about a person named Bob
. From Bob’s todo list
we can see some info about a website. So let us check the Firefox history.
Retrieving details from Firefox’s history
Firefox stores its history in a file named places.sqlite
, by dumping it and opening it in an SQLite viewer, We see a request for a website http://bobsite[.]com/login?user=bob&pass=i-l0v3-d0lph1n5
. Where can see the username as bob
and password as i-l0v3-d0lph1n5
. So let us use them as the ssh login credentials.
Retrieving flag
As we got the username and password, and ssh’ed into that server, and traversing through the root directory we got the flag.
Flag
utflag{red_teams_are_just_glorified_password_managers}