Dukbong

[Linux 공부] Bandit wargames 32~33 단계 login shell & $0 본문

Linux

[Linux 공부] Bandit wargames 32~33 단계 login shell & $0

dukbong_dev 2025. 5. 20. 23:25
반응형
 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal After all this git stuff, it’s time for another escape. Good luck! Commands you may need to solve this level sh, man

overthewire.org

31 ~ 32 단계는 겨우겨우 찾은 $0 이라는 것입니다.

1. SSH 접속

31 ~ 32 단계 접속 비밀번호는 3O9RfhqyAlVBEZpVb6LYStshZoqoSx5K 입니다.

2. $0

# 접속을 하게 되면 >> 이런 표시가 나옵니다.
# 이게 뭐지 했는데 다 대문자로 바꾸면서 권한은 없다는 말만 계속 나오길래 답답해서 인터넷을 찾아보니
# 1. $0을 통해 빠져나올 수 있다는 내용을 찾았습니다.
# 2. ctrl + c로 도 빠져나올 수 있습니다.

>> $0

$ ls -al

total 36
drwxr-xr-x  2 root     root      4096 Apr 10 14:23 .
drwxr-xr-x 70 root     root      4096 Apr 10 14:24 ..
-rw-r--r--  1 root     root       220 Mar 31  2024 .bash_logout
-rw-r--r--  1 root     root      3771 Mar 31  2024 .bashrc
-rw-r--r--  1 root     root       807 Mar 31  2024 .profile
-rwsr-x---  1 bandit33 bandit32 15140 Apr 10 14:23 uppershell

# uppershell은 뭐지 싶어서 실행해봤더니 처음에 봤던 >> 이 화면이 나왔습니다.
# 여기서 얻은 힌트는 bandit32는 로그인 쉘이 아닌 uppershell이 열린다는 것이다.
# 그리고 해당 file 정보를 보면 setuid로 소유자의 권한을 쓸 수 있게 됩니다.

cat /ect/bandit_pass/bandit33

# 응답
tQdtbs5D5i2vJwkO8mEyYEyTL8izoeJ0
반응형
Comments