๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โœ’๏ธ Web Hacking/Dreamhack

[Dreamhack] File Download - 1 ๋“œ๋ฆผํ•ต ์›Œ๊ฒŒ์ž„ ๋ฌธ์ œ ํ’€์ด

by A Lim Han 2022. 11. 1.

5 - 0 - 2. File Download - 1 ์›น & ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ ์ทจ์•ฝ์  ์‹ค์Šต

 

 

#  File Download - 1 ์›น & ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ ์ทจ์•ฝ์  ์‹ค์Šต

1. ๋ฌธ์ œ ํ™•์ธ ๋ฐ ๋ฌธ์ œ ํŒŒ์ผ ๋‹ค์šด๋กœ๋“œ

flag.py๋ฅผ ๋‹ค์šด๋ฐ›์•„์•ผ ํ•˜๋Š” ์ƒํ™ฉ

 

 

 

 

2. ๋ฌธ์ œ์˜ app.py ํŒŒ์ผ ๋ถ„์„

app.py ํŒŒ์ผ

+ << Line 26 ~ 27 >>  

: ๋””๋ ‰ํ„ฐ๋ฆฌ ์ด๋™์„ ์ œํ•œํ•˜๋Š” ์ฝ”๋“œ

 

ex) ์‹ค์ œ๋กœ ํŒŒ์ผ๋ช…์„ ../flag.py , Content์˜ ๋‚ด์šฉ์„ Content๋กœ ์ž‘์„ฑํ•  ๊ฒฝ์šฐ "bad characters,," ๋ฉ”์„ธ์ง€๊ฐ€ ์ถœ๋ ฅ

 

-->  ํŒŒ์ผ ์—…๋กœ๋”ฉ์„ ํ†ตํ•œ ๋””๋ ‰ํ„ฐ๋ฆฌ ์ด๋™์ด ์•„๋‹Œ, URL์„ ์ด์šฉํ•˜๋Š” ๋ฐฉ์‹์„ ํ†ตํ•ด Flag ์ถœ๋ ฅํ•ด์•ผ ํ•จ

 

 

 

 

2. ์ ‘์† ์ •๋ณด ํ™•์ธ ํ›„ ์•ˆ๋‚ด๋œ ๋งํฌ๋กœ ์ ‘์†

 

 

 

 

 

3. ํ™ˆํŽ˜์ด์ง€์—์„œ Upload My Memo๋ฅผ ํด๋ฆญํ•˜์—ฌ ์—…๋กœ๋”ฉ ํŽ˜์ด์ง€๋กœ ์ด๋™

 

 

 

 

4. ์—…๋กœ๋”ฉ ํŽ˜์ด์ง€์—์„œ ํŒŒ์ผ๋ช… ์นธ์— 'filename'์„, Content ์นธ์— 'Content' ์ž…๋ ฅ

 

 

 

 

5. ๋‹ค์‹œ ํ™ˆ์œผ๋กœ ๋Œ์•„๊ฐ„ ๋’ค ์˜ฌ๋ฆฐ ํŒŒ์ผ( = filename ) ํด๋ฆญ

 

+ << ํ™•์ธ ๊ฐ€๋Šฅํ•œ ์š”์†Œ >>

URL์„ ํ™•์ธํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ ํŒŒ์ผ๋ช…์ด ๊ทธ๋Œ€๋กœ name ํŒŒ๋ผ๋ฏธํ„ฐ์— ๋“ค์–ด๊ฐ
Content ๋‚ด์šฉ์—๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ content ๊ฐ’์ด, ํŒŒ์ผ๋ช…์—๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ ํŒŒ์ผ๋ช… ๊ฐ’์ด ๋“ค์–ด๊ฐ

 

+ Memo ์ž‘์„ฑ ํŽ˜์ด์ง€์— ํŒŒ์ผ๋ช…๊ณผ Content๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ = ํŒŒ์ผ ๋‹ค์šด๋กœ๋”ฉ

 

 

 

 

7. ํŒŒ์ผ ์—…๋กœ๋”ฉ ํŽ˜์ด์ง€ URL์˜ ๊ธฐ์กด name๊ฐ’์„ ../flag.py๋กœ ์น˜ํ™˜

์ˆ˜์ • ์ „ URL

 

์ˆ˜์ • ํ›„ URL

 

 

 

 

8. Flag๊ฐ€ ์ถœ๋ ฅ๋จ์„ ํ™•์ธ

Flag๋Š” DH{uploading_webshell_in_python_program_is_my_dream}