Level 2 -> Level 4

2024. 12. 27. 19:16ยท๐Ÿฆ– Private/bandit

Level 2 -> Level 3

<Level Goal>
The password for the next level is stored in a file called spaces i this filename located in the home directory

 

 

Solve

ํ™ˆ ๋””๋ ‰ํ† ๋ฆฌ์— ์œ„์น˜ํ•œ 'space in this filename'์— password๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•œ๋‹ค. pwd๋กœ ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ home ๋””๋ ‰ํ† ๋ฆฌ์ธ ๊ฒƒ์„ ํ™•์ธํ•˜๊ณ  ls ๋ช…๋ น์–ด๋กœ ์–ด๋–ค ํŒŒ์ผ์ด ์žˆ๋Š”์ง€ ์‚ดํŽด๋ดค๋‹ค.

 

์ผ๋‹จ space in this filename์ด๋ผ๋Š” ํŒŒ์ผ์ด ์กด์žฌํ•˜๋Š” ๊ฒƒ์€ ํ™•์ธํ–ˆ๋‹ค. ํ•˜์ง€๋งŒ cat ๋ช…๋ น์–ด์—์„œ error๊ฐ€ ๋‚œ๋‹ค. ์ŠคํŽ˜์ด์Šค๋กœ ์ธํ•ด ํ•˜๋‚˜์˜ ํŒŒ์ผ ์ด๋ฆ„์ด 4๊ฐœ์˜ ํŒŒ์ผ๋กœ ๋ถ„๋ฆฌ๋˜์„œ ํ•ด์„๋˜๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™๋‹ค.

bandit2@bandit:~$ pwd
/home/bandit2

bandit2@bandit:~$ ls
spaces in this filename

bandit2@bandit:~$ cat space in this filename
cat: space: No such file or directory
cat: in: No such file or directory
cat: this: No such file or directory
cat: filename: No such file or directory

 

๊ทธ๋ ‡๋‹ค๋ฉด ์ŠคํŽ˜์ด์Šค๊ฐ€ ํฌํ•จ๋œ ํŒŒ์ผ ๋ช…์ด ํ•˜๋‚˜์˜ ํŒŒ์ผ๋ช…์œผ๋กœ ์ธ์‹๋˜๊ฒŒ ํ•˜๋ฉด ๋œ๋‹ค.

์ž‘์€ ๋”ฐ์˜ดํ‘œ๋Š” ๋ชจ๋“  ํŠน์ˆ˜ ๋ฌธ์ž๋ฅผ ๋ฌด์‹œํ•˜๊ณ , ํฐ ๋”ฐ์˜ดํ‘œ๋Š” $์™€ `(๋ฐฑ ๋”ฐ์˜ดํ‘œ)์™€ \(๋ฐฑ์Šฌ๋ž˜์‹œ)๋ฅผ ์ œ์™ธํ•œ ๋ชจ๋“  ๋ฌธ์ž๋ฅผ ๋ฌด์‹œํ•œ๋‹ค.

# ํฐ ๋”ฐ์˜ดํ‘œ๋กœ ๋ฌถ๊ธฐ
bandit2@bandit:~$ cat "spaces in this filename"
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

# ์ž‘์€ ๋”ฐ์˜ดํ‘œ๋กœ ๋ฌถ๊ธฐ
bandit2@bandit:~$ cat 'spaces in this filename'
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

 

์•„๋‹ˆ๋ฉด \(๋ฐฑ์Šฌ๋ž˜์‹œ)๋ฅผ ์ด์šฉํ•ด ๊ณต๋ฐฑ์„ ์ด์Šค์ผ€์ดํ”„ ํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

bandit2@bandit:~$ cat spaces\ in\ this\ filename
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

 

 

More

๊ณต๋ฐฑ์ด ์žˆ๋Š” ํŒŒ์ผ์„ ๋งŒ๋“ค ๋•Œ๋„ ์œ„์˜ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. ์•„๋ž˜์˜ 3๊ฐ€์ง€ ๋ฐฉ์‹์œผ๋กœ ๊ณต๋ฐฑ์„ ํฌํ•จํ•œ ํŒŒ์ผ ์ด๋ฆ„์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ touch 'file name with space' 

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ touch file\ name\ with\ spaces 

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ vi 'file name with enter'

Level 3 -> Level 4

<Level Goal>
The password for the next level is stored in a hidden file in the inhere directory

 

 

Solve

inhere ๋””๋ ‰ํ† ๋ฆฌ์˜ hidden file(์ˆจ๊ฒจ์ง„ ํŒŒ์ผ)์— password๊ฐ€ ์กด์žฌํ•œ๋‹ค๊ณ  ํ•œ๋‹ค.

ls ๋ช…๋ น์–ด ๊ฒฐ๊ณผ home ๋””๋ ‰ํ† ๋ฆฌ ํ•˜์œ„์— inhere ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์กด์žฌํ•œ๋‹ค. inhere ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™ํ•œ ์œ„ ls ๋ช…๋ น์–ด๋ฅผ ์จ๋ดค์„ ๋–„๋Š” ์•„๋ฌด ๊ฒƒ๋„ ์—†๋‹ค๊ณ  ๋œฌ๋‹ค.

bandit3@bandit:~$ ls
inhere

bandit3@bandit:~$ cd inhere
bandit3@bandit:~/inhere$ ls
bandit3@bandit:~/inhere$

 

ls -l ๋ช…๋ น์–ด ๊ฒฐ๊ณผ๊ฐ€ total 0์ด๋ผ '์ •๋ง ์•„๋ฌด๊ฒƒ๋„ ์—†๋‚˜?'๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์ง€๋งŒ, hidden file์ด๋ผ๋Š” ์ด๋ฆ„์ด ๊ฑธ๋ ค์„œ ls -a ๋ช…๋ น์–ด๋ฅผ ์จ๋ดค๋‹ค. ๊ทธ๋žฌ๋”๋‹ˆ ๋ญ”๊ฐ€ ์ถœ๋ ฅ๋˜์—ˆ๋‹ค.

bandit3@bandit:~/inhere$ ls -l
total 0

bandit3@bandit:~/inhere$ ls -a
.  ..  ...Hiding-From-You

 

์ถœ๋ ฅ๋œ ...Hiding-From-Yor ํŒŒ์ผ์„ cat ๋ช…๋ น์–ด๋กœ ์ฝ์–ด๋ดค๋‹ค. ๊ทธ๋žฌ๋”๋‹ˆ password๊ฐ€ ๋‚˜์™”๋‹ค. 4๋‹จ๊ณ„๋„ ํด๋ฆฌ์–ด๋‹ค!

-> cat ๋ช…๋ น์–ด๋กœ๋Š” ์ˆจ๊ฒจ์ง„ ํŒŒ์ผ๋„ ์ฝ์„ ์ˆ˜ ์žˆ๊ตฌ๋‚˜.

bandit3@bandit:~/inhere$ cat ...Hiding-From-You
2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ

 

 

Question

ls -a ๊ฒฐ๊ณผ์— ๋‚˜ํƒ€๋‚˜๋Š” .๊ณผ ..๋Š” ๋ญ˜๊นŒ?

 

ls -a๋Š” ์ˆจ๊ฒจ์ง„ ํŒŒ์ผ์„ ํฌํ•จํ•ด ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด์˜ ๋ชจ๋“  ํ•ญ๋ชฉ์„ ํ‘œ์‹œํ•œ๋‹ค. ๋ฆฌ๋ˆ…์Šค ํŒŒ์ผ ์‹œ์Šคํ…œ์—์„œ .์™€ ..๋Š” ๋ชจ๋“  ๋””๋ ‰ํ† ๋ฆฌ์— ๊ธฐ๋ณธ์ ์œผ๋กœ ์กด์žฌํ•˜๋Š” ํŠน์ˆ˜ ์—”ํŠธ๋ฆฌ์ด๋‹ค. ์ด๋Š” ํŒŒ์ผ์ด๋‚˜ ๋””๋ ‰ํ† ๋ฆฌ๋Š” ์•„๋‹ˆ๋ฉฐ, ํŒŒ์ผ ์‹œ์Šคํ…œ์˜ ๊ตฌ์กฐ๋ฅผ ๋‚˜ํƒ€๋‚ด๊ธฐ ์œ„ํ•œ ๋ฉ”ํƒ€ ๋ฐ์ดํ„ฐ์ด๋‹ค.

-> ์šฐ๋ฆฌ๊ฐ€ cd. ๋˜๋Š” cp ../file.txt ๋“ฑ๊ณผ ๊ฐ™์€ ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ ์‚ฌ์šฉ๋œ๋‹ค.

 

 

More

01. ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ls ์˜ต์…˜

-l ํŒŒ์ผ๋“ค์„ ๋‚˜์—ดํ•  ๊ฒฝ์šฐ ์ž์„ธํžˆ ์ถœ๋ ฅํ•œ๋‹ค
-a ๊ฒฝ๋กœ ์•ˆ์˜ ๋ชจ๋“  ํŒŒ์ผ์„ ๋‚˜์—ดํ•œ๋‹ค(์ˆจ๊ธด ํŒŒ์ผ๋„ ํฌํ•จ)
-R ์œ„์น˜ํ•œ ๋””๋ ‰ํ† ๋ฆฌ ํ•˜๋ถ€ ๋””๋ ‰ํ† ๋ฆฌ์˜ ํŒŒ์ผ๊นŒ์ง€ ๋ชจ๋‘ ์ถœ๋ ฅํ•œ๋‹ค
-h ํŒŒ์ผ์˜ ํฌ๊ธฐ๋ฅผ ํ•ด์„ํ•˜๊ธฐ ํŽธํ•˜๊ฒŒ ์ถœ๋ ฅํ•œ๋‹ค
-r ์ถœ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ ๋‚ด๋ฆผ์ฐจ์ˆœ์œผ๋กœ ์ •๋ ฌํ•œ๋‹ค
-t ์ถœ๋ ฅ ๊ฒฐ๊ณผ๋ฅผ ํŒŒ์ผ์ด ์ˆ˜์ •๋œ ์‹œ๊ฐ„์„ ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌํ•œ๋‹ค.

 

 

02. Linux ์ˆจ๊ธด ํŒŒ์ผ

๋ฆฌ๋ˆ…์Šค์—์„œ ์ˆจ๊ฒจ์ง„ ํŒŒ์ผ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์€, ํŒŒ์ผ ์ด๋ฆ„ ์•ž์— .์„ ๋ถ™์ด๋Š” ๊ฒƒ์ด๋‹ค.

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ touch .hidden_file            
                                                                                             
โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ ls
                                                                                             
โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ ls -a       
.  ..  .hidden_file

 

๋ฐ˜๋Œ€๋กœ ์ˆจ๊ฒจ์ง„ ํŒŒ์ผ์„ ์ˆจ๊น€ ํ•ด์ œํ•˜๊ณ  ์‹ถ์œผ๋ฉด ํŒŒ์ผ๋ช… ์•ž์˜ .๋ฅผ ์ œ๊ฑฐํ•˜๋ฉด ๋œ๋‹ค.

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ mv .hidden_file hidden_file
                                                                                             
โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ ls   
hidden_file

 

์ˆจ๊ฒจ์ง„ ํŒŒ์ผ์„ ์ฝ์œผ๋ ค๋ฉด ์ˆจ๊ฒจ์ง„ ํŒŒ์ผ์˜ ์ด๋ฆ„์„ ๊ทธ๋Œ€๋กœ ์ž…๋ ฅํ•ด์•ผํ•œ๋‹ค(.์„ ํฌํ•จํ•ด์•ผ ํ•œ๋‹ค๋Š” ์˜๋ฏธ์ด๋‹ค).

โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ ls
                                                                                             
โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ ls -a
.  ..  .hidden_file
                                                                                             
โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ cat hidden_file
cat: hidden_file: No such file or directory

# ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด .hidden_file์˜ ๋‚ด์šฉ์„ ์ฝ์„ ์ˆ˜ ์žˆ๋‹ค
โ”Œโ”€โ”€(kaliใ‰ฟkali)-[~/bandit]
โ””โ”€$ cat .hidden_file

 

'๐Ÿฆ– Private > bandit' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

Level 4 -> Level 6  (1) 2024.12.27
Level 0 -> Level 2  (0) 2024.12.26
Level 0-SSH  (0) 2024.12.25
'๐Ÿฆ– Private/bandit' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€
  • Level 4 -> Level 6
  • Level 0 -> Level 2
  • Level 0-SSH
SONOTREE
SONOTREE
@-@
  • SONOTREE
    SONOTRI
    SONOTREE
  • ์ „์ฒด
    ์˜ค๋Š˜
    ์–ด์ œ
    • ๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ (72)
      • ๐ŸŒฒ Dreamhack (18)
        • System Hacking (2)
        • Web Hacking (4)
        • Reverse Engineering (10)
        • Digital Forensics (2)
      • ๐Ÿฆ– Private (20)
        • C Language (2)
        • Java Language (6)
        • LinuxMaster (1)
        • webhacking.kr (3)
        • bandit (4)
        • CTF Wriet-Up (3)
        • GoN Club Study (1)
      • ๐Ÿ  Public (13)
        • Development (2)
        • web (8)
        • forensic (0)
        • elif (3)
  • ๋ธ”๋กœ๊ทธ ๋ฉ”๋‰ด

    • ํ™ˆ
    • ํƒœ๊ทธ
    • ๋ฐฉ๋ช…๋ก
  • ๋งํฌ

  • ๊ณต์ง€์‚ฌํ•ญ

  • ์ธ๊ธฐ ๊ธ€

  • ํƒœ๊ทธ

  • ์ตœ๊ทผ ๋Œ“๊ธ€

  • ์ตœ๊ทผ ๊ธ€

  • hELLOยท Designed By์ •์ƒ์šฐ.v4.10.3
SONOTREE
Level 2 -> Level 4
์ƒ๋‹จ์œผ๋กœ

ํ‹ฐ์Šคํ† ๋ฆฌํˆด๋ฐ”