[OverTheWire] bandit 30 -> 31

2025. 12. 13. 21:19·bandit

There is a git repository at ssh://bandit30-git@bandit.labs.overthewire.org/home/bandit30-git/repo via the port 2220. The password for the user bandit30-git is the same as for the user bandit30.

 

Clone the repository and find the password for the next level.

 

hint: git

 

오늘 사용할 명령어

  • git
  • clone
  • log
  • branch
  • ref(reference)
  • tag
  • show

 

이번에도 git clone으로 시작하네요 바로 clone 해와서 README.md파일 읽어봅시다

┌──(miso㉿Miso)-[~]
└─$ ls
bandit26.sshkey  repo

┌──(miso㉿Miso)-[~]
└─$ rm -rf repo/

┌──(miso㉿Miso)-[~]
└─$ ls
bandit26.sshkey

┌──(miso㉿Miso)-[~]
└─$ git clone ssh://bandit30-git@bandit.labs.overthewire.org:2220/home/bandit30-git/repo
Cloning into 'repo'...
                         _                     _ _ _
                        | |__   __ _ _ __   __| (_) |_
                        | '_ \ / _` | '_ \ / _` | | __|
                        | |_) | (_| | | | | (_| | | |_
                        |_.__/ \__,_|_| |_|\__,_|_|\__|


                      This is an OverTheWire game server.
            More information on http://www.overthewire.org/wargames

backend: gibson-0
bandit30-git@bandit.labs.overthewire.org's password:
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (4/4), done.

┌──(miso㉿Miso)-[~]
└─$ ls
bandit26.sshkey  repo

┌──(miso㉿Miso)-[~]
└─$ cd repo

┌──(miso㉿Miso)-[~/repo]
└─$ ls
README.md

┌──(miso㉿Miso)-[~/repo]
└─$ cat README.md
just an epmty file... muahaha

 

 

 

읽어봤는데 빈파일이라고 하면서 심지어 웃었어요 ( ᵕ ̯ ᵕ̩̩ )

그래서 어떤 log랑 branch들이 있는지 확인해볼게요

┌──(miso㉿Miso)-[~/repo]
└─$ git log
commit 62152a9969c62cb647406aa88c1b5376dcf58968 (HEAD -> master, origin/master, origin/HEAD)
Author: Ben Dover <noone@overthewire.org>
Date:   Tue Oct 14 09:26:22 2025 +0000

    initial commit of README.md

┌──(miso㉿Miso)-[~/repo]
└─$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

 

 

 

진짜 뭐 아무 기록도 없네요 처음 커밋한 README.md 파일이고 내용도 처음부터 저거였던 것 같습니다.

그래서 branch의 상위 개념인 reference를 써볼겁니다.

.git/refs/
 ├─ heads/        # 로컬 branch (유동적인 ref)
 │   ├─ master
 │   └─ dev
 ├─ remotes/      # 원격 branch
 │   └─ origin/dev
 └─ tags/         # tag         (고정적인 ref)
     └─ secret

 

 

reference의 개념은 위와 같고, reference 전체를 살펴봅시다.

┌──(miso㉿Miso)-[~/repo]
└─$ git show-ref
62152a9969c62cb647406aa88c1b5376dcf58968 refs/heads/master
62152a9969c62cb647406aa88c1b5376dcf58968 refs/remotes/origin/HEAD
62152a9969c62cb647406aa88c1b5376dcf58968 refs/remotes/origin/master
84368f3a7ee06ac993ed579e34b8bd144afad351 refs/tags/secret

 

 

이렇게 네 가지가 나왔는데요. 세 개는 같은 커밋인데 맨 밑에 secret만 다른 커밋을 가지고 있네요. 한번 읽어봅시다.

┌──(miso㉿Miso)-[~/repo]
└─$ git show secret
fb5S2xb7bRyFmAvQYQGEqsbhVyJqhnDy

 

 

정답은 나왔는데요.

이번 문제는 유동적 커밋인 branch와 고정적 커밋인 tag가 있다는 것을 확실히 알면 좋을 것 같습니다.

리눅스에서 설정 파일들이 디렉토리로 분류되듯,
git에서도 reference 파일들이 heads, tags로 나뉘어져 있습니다.

 

 

그래서 아까

  • git show-ref 

명령어를 쓸 수도 있지만, git tag명령어를 이용해도 secret 파일을 확인할 수 있습니다

┌──(miso㉿Miso)-[~/repo]
└─$ git tag
secret

┌──(miso㉿Miso)-[~/repo]
└─$ git show secret
fb5S2xb7bRyFmAvQYQGEqsbhVyJqhnDy

 

'bandit' 카테고리의 다른 글

[OverTheWire] bandit 32 -> 33  (0) 2025.12.17
[OverTheWire] bandit 31 -> 32  (0) 2025.12.13
[OverTheWire] bandit 29 -> 30  (0) 2025.12.12
[OverTheWire] bandit 28 -> 29  (0) 2025.12.11
[OverTheWire] bandit27 -> 28  (0) 2025.12.10
'bandit' 카테고리의 다른 글
  • [OverTheWire] bandit 32 -> 33
  • [OverTheWire] bandit 31 -> 32
  • [OverTheWire] bandit 29 -> 30
  • [OverTheWire] bandit 28 -> 29
jokkams
jokkams
jokkams 님의 블로그 입니다.
  • jokkams
    jokkams 님의 블로그
    jokkams
  • 전체
    오늘
    어제
    • 분류 전체보기 (56)
      • 코드업 (8)
      • bandit (32)
      • 학교 (2)
      • 드림핵 (5)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    100제
    코드업
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
jokkams
[OverTheWire] bandit 30 -> 31
상단으로

티스토리툴바