Private Investigator - H@cktivityCon CTF

Category: Misc
Solves (at time of writing): 433
Description: We have hired you to help investigate this private key. Please use it to connect to the server.

Private Investigator

We are given a private key and a ssh server to connect to.

If we try connecting with ssh -i id_rsa user@jh2i.com -p 50004, it doesnt work.


load pubkey "id_rsa": invalid format
Load key "id_rsa": invalid format
user@jh2i.com's password:
    

So the Key doesnt work.

I opened it in Vim to take a closer look, maybe there are some non-ascii bytes in there or something.

I didn't find anything, but to my surprise after re-saving the file in vim (without edits) the key worked?

After seeing the flag it was obvious to me.

SSH Keys need a newline at the end.

And Vim is nice and puts one after you save the file automatically.

~sw1tchbl4d3, 03/08/2020 (dd/mm/yyyy)