Search code examples
linuxsshterminalportctf

Stuck on 16 - 17 level of Overthewire bandit game


I'm playing the CTF game on Overthewire and stuck on 16 - 17 where you got a public key and have to submit it to play the next level.

I got the public key saved at /tmp/ and set read only for the user.Then proceed to submit it by this command

ssh -i /tmp/bokeh/sshkey17.private [email protected] -p 2220

Then I got these messages

The authenticity of host '[bandit.labs.overthewire.org]:2220 
([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is 
SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.                                          
This key is not known by any other names                                                                                
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes                                                
Could not create directory '/home/bandit16/.ssh' (Permission denied).                                                   
Failed to add the host to the list of known hosts 
(/home/bandit16/.ssh/known_hosts).   
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
This is an OverTheWire game server.                                                                           
More information on http://www.overthewire.org/wargames  
                                                                                                                                                                       
!!! You are trying to log into this SSH server with a password on port 
2220 from localhost.                             
!!! Connecting from localhost is blocked to conserve resources.                                                         
!!! Please log out and log in again.                                                                                                                                                                                                            
Load key "/tmp/bokeh/sshkey17.private": error in libcrypto                                                              
[email protected]: Permission denied (publickey). 

Please help me, thank you!

I think the error is at those permission denied that can not create the ssh folder


Solution

  • I found something people use VMs, which have independent networks stuff from local environments. I can't explain clearly, since it might be different depending on the environments, but if you use VMs, I think you can solve it :))

    You can do it in the bandit16's shell then it will work!

    ssh -i key.rsa bandit17@localhost -p 2220
    

    Before that, I used 'xshell' to connect to the bandit env in my local environment (my computer uses the school's private network...), and it didn't work. 'xshell' might have some connection limitations. But I tried to do it with a VM, and it works) (NOTE that I can't still specify the reason for it!)