🐧 Linux (Bandit)

[OverTheWire][Linux] Bandit Level6 -> Level7

선달 2024. 12. 23. 08:08
λ°˜μ‘ν˜•

문제

Level Goal

The password for the next level is stored somewhere on the server and has all of the following properties:

  • owned by user bandit7
  • owned by group bandit6
  • 33 bytes in size

Commands you may need to solve this level

ls , cd , cat , file , du , find , grep

 

풀이

ν˜„μž¬ λ””λ ‰ν† λ¦¬μ—μ„œ ls -al 해도 아무것도 μ•ˆλœ¬λ‹€ (!!) 

루트 디렉토리뢀터 μ°Ύμ•„μ•Όν•˜λŠ” λ¬Έμ œλ‹€

 

bandit6@bandit:~$ find / -user bandit7 -group bandit6 -size 33c 2>/dev/null

 

  • find / : 루트 디렉토리(/)λΆ€ν„° μ‹œμž‘ν•΄μ„œ λͺ¨λ“  파일과 디렉토리λ₯Ό μž¬κ·€μ μœΌλ‘œ κ²€μƒ‰ν•©λ‹ˆλ‹€.
  • -user bandit7 : bandit7 μ‚¬μš©μžκ°€ μ†Œμœ ν•œ 파일만 κ²€μƒ‰ν•©λ‹ˆλ‹€.
  • -group bandit6 : bandit6 그룹에 μ†ν•œ 파일만 κ²€μƒ‰ν•©λ‹ˆλ‹€.
  • -size 33c : 크기가 μ •ν™•νžˆ 33 λ°”μ΄νŠΈμΈ 파일만 μ°ΎμŠ΅λ‹ˆλ‹€. cλŠ” 크기λ₯Ό λ°”μ΄νŠΈ λ‹¨μœ„λ‘œ μ§€μ •ν•©λ‹ˆλ‹€.
  • 2>/dev/null :κΆŒν•œμ΄ μ—†μ–΄μ„œ λ°œμƒν•˜λŠ” μ—λŸ¬ λ©”μ‹œμ§€λ₯Ό 좜λ ₯ν•˜μ§€ μ•Šλ„λ‘ μˆ¨κΉλ‹ˆλ‹€.

λ§ˆμ§€λ§‰ μš”μ†Œλ§Œ 잘 κΈ°μ–΅ν•˜λ©΄ 될 λ“― ν•˜λ‹€

 

  1. 2>
    • 2λŠ” ν‘œμ€€ μ—λŸ¬(standard error, stderr)λ₯Ό λ‚˜νƒ€λƒ…λ‹ˆλ‹€.
    • >λŠ” λ¦¬λ””λ ‰μ…˜ μ—°μ‚°μžλ‘œ, μ—λŸ¬ λ©”μ‹œμ§€λ₯Ό λ‹€λ₯Έ 곳으둜 λ³΄λ‚΄κ² λ‹€λŠ” λœ»μž…λ‹ˆλ‹€.
  2. /dev/null
    • /dev/null은 μœ λ‹‰μŠ€ 계열 μš΄μ˜μ²΄μ œμ—μ„œ **"μ—†μŒ"**을 μ˜λ―Έν•˜λŠ” 특수 νŒŒμΌμž…λ‹ˆλ‹€.
    • 여기에 데이터λ₯Ό 보내면 λ°μ΄ν„°λŠ” μ¦‰μ‹œ 사라지며, 아무 좜λ ₯도 ν‘œμ‹œλ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

 

 

더보기

morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj

λ°˜μ‘ν˜•