Dreamhack/Dreamhack Wargame (Challenge)

[120] IT 비전공자 [dreamhack]Just read flag문제 풀기

imaginefuture-1 2025. 1. 8. 08:50

ssh!!!! 젠장 일단 시간 없어서 학원갔다와서 문제 풀이하러올게요 ㅋㅋㅋ

 

CAT으로 문제 파일을 읽으니 이런 SSH키가 나온다, 이걸로 SSH 접속을해보자!

 

jihye@jihye-virtual-machine:~/Downloads/flag$ cp dreamhack_invitational_welcome id_rsa_dream
jihye@jihye-virtual-machine:~/Downloads/flag$ 
jihye@jihye-virtual-machine:~/Downloads/flag$ ssh -i id_rsa_dream dream@host1.dreamhack.games -p 17669
The authenticity of host '[host1.dreamhack.games]:17669 ([139.99.121.66]:17669)' can't be established.
ED25519 key fingerprint is SHA256:4or+Yb3zjAgyH6HbwN7hFE4nGS1Mm3CeJv0z/3bKV5A.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[host1.dreamhack.games]:17669' (ED25519) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for 'id_rsa_dream' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "id_rsa_dream": bad permissions
dream@host1.dreamhack.games's password: 
Permission denied, please try again.
dream@host1.dreamhack.games's password: 

jihye@jihye-virtual-machine:~/Downloads/flag$ chmod 600 id_rsa_dream 
jihye@jihye-virtual-machine:~/Downloads/flag$ ssh -i id_rsa_dream dream@host1.dreamhack.games -p 17669
Welcome to Ubuntu 22.04 LTS (GNU/Linux 4.19.234 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

 

권한 설정 해줘야한다, 키니까! 아니면 저렇게 UNPROTECTED PRIVATE KEY FILE 오류가 뜬다

이후 CAT으로 열심히 읽어줄려는데 안되서 GPT한테 물어보니 

 


 

nano가 설치되어 있지 않아 사용할 수 없는 상황입니다. 대신 다른 방법으로 파일을 생성하고 Python 스크립트를 작성할 수 있습니다.


대체 방법: echo를 사용해 파일 생성하기

nano 대신 echo 명령으로 Python 스크립트를 작성할 수 있습니다.

1. 스크립트 작성

다음 명령을 사용해 read.py 파일을 생성하세요:

echo 'with open("flag_welcome", "r") as file: content = file.read(); print("File Content:", content)' > read.py

2. 스크립트 실행

생성된 스크립트를 실행합니다:

python3 read.py

 

 

왜 사람들이 댓글에 꽁꽁 얼어붙은 한강위로 고양이가 있나 했더니..........ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ