[overthewire] Bandit Level 29 → Level 30

moon_security·2025년 3월 24일

[OverTheWire] Bandit

목록 보기
29/32

문제 목표!

There is a git repository at ssh://bandit29-git@localhost/home/bandit29-git/repo via the port 2220. The password for the user bandit29-git is the same as for the user bandit29.
Clone the repository and find the password for the next level.

git과 관련된 문제는 형태가 동일하네요.
git repository를 clone하는 과정까지 진행하도록 하겠습니다.

문제 풀이!

이전 단계의 문제와 동일하게 진행했더니 'no passwords in production!'
라는 문자열이 보이네요.
이게 무슨 뜻일까요?

bandit29@bandit:/tmp/bandit_pass/repo$ cat README.md 
# Bandit Notes
Some notes for bandit30 of bandit.

## credentials

- username: bandit30
- password: <no passwords in production!>

git commit을 체크해봐도 username만 변경됐다는 정보네요.
별다른 특이점은 없는 듯 합니다.

bandit29@bandit:/tmp/bandit_pass/repo$ git log
commit 6ac7796430c0f39290a0e29a4d32e5126544b022 (HEAD -> master, origin/master, origin/HEAD)
Author: Ben Dover <noone@overthewire.org>
Date:   Thu Sep 19 07:08:41 2024 +0000

    fix username

commit e65a928cca4db1863b478cf5e93d1d5b1c1bd6b2
Author: Ben Dover <noone@overthewire.org>
Date:   Thu Sep 19 07:08:41 2024 +0000

    initial commit of README.md

이 문제를 풀기 위해서는 branch를 알아야 합니다.

📌 branch란?
브랜치는 Git에서 작업 내역의 갈라진 선, 즉 개발의 분기점입니다.
쉽게 말해서 복사본을 떠서 다른 내용으로 실험하거나 개발할 수 있는 독립된 트랙이에요.
-> 브랜치는 원본 코드에 영향을 주지 않고 테스트가 가능하다!

위에서 확인했다 싶이 'no passwords in production!(운영 환경에는 비밀번호가 없음!)'를 보아 개발 환경의 브랜치에서는 비밀번호를 찾을 수 있을 것 같군요.
git branch -a를 통해 모든 브랜치를 검색해 보겠습니다.

bandit29@bandit:/tmp/bandit_pass/repo$ git branch -a
* (HEAD detached at e65a928)
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev
  remotes/origin/master
  remotes/origin/sploits-dev

remotes/origin/dev 브랜치가 나왔군요!
개발 환경에서 비밀번호를 남겨둬서 유출되는 경우가 왕왕있다고 하네요.
해당 브랜치로 접속해볼까요?
브랜치를 변경하고!
README.md 파일을 다시 읽어보았더니 짜잔!
비밀번호가 나오는 군요!!

bandit29@bandit:/tmp/bandit_pass/repo$ git checkout remotes/origin/dev
bandit29@bandit:/tmp/bandit_pass/repo$ cat README.md 
# Bandit Notes
Some notes for bandit30 of bandit.

## credentials

- username: bandit30
- password: qp30ex3VLz5MDG1n91YowTv4Q8l7CDZL

profile
모의해킹 & 보안 공부 기록 블로그

0개의 댓글