SWLUG/CTF ๋ฌธ์ œ ํ’€์ด (2) 17

[Dreamhack/๋“œ๋ฆผํ•ต] web-misconf-1

https://dreamhack.io/wargame/challenges/45 web-misconf-1๊ธฐ๋ณธ ์„ค์ •์„ ์‚ฌ์šฉํ•œ ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธํ•œ ํ›„ Organization์— ํ”Œ๋ž˜๊ทธ๋ฅผ ์„ค์ •ํ•ด ๋†“์•˜์Šต๋‹ˆ๋‹ค. Reference Server Side Basicdreamhack.io[1] ๋ฌธ์ œ ์›น ํŽ˜์ด์ง€ ๋ถ„์„ ์„œ๋ฒ„๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์›น ํŽ˜์ด์ง€์— ๋“ค์–ด๊ฐ€์ž๋งˆ์ž ๋‚˜์˜ค๋Š” ํ™”๋ฉด์ด๋‹ค. ์ผ๋‹จ ์•„๋ฌด ๋ฌธ์ž์—ด์ด๋‚˜ ์ž…๋ ฅํ•ด๋ณด์•˜๋‹ค.  1234, 1234 ์ด๋ ‡๊ฒŒ ์ž…๋ ฅํ•˜์˜€๋‹ค.  ์ด๋Ÿฐ ํŒ์—…์ฐฝ์ด ๋œฌ๋‹ค.  Forget your password? ๋ถ€๋ถ„์„ ํด๋ฆญํ•œ๋‹ค.  ๊ทธ๋Ÿผ ์ด๋Ÿฐ ํŽ˜์ด์ง€๊ฐ€ ๋‚˜์˜จ๋‹ค.   ์ž์„ธํžˆ ๋ณด๋ฉด user๋ฅผ ์ž…๋ ฅํ•˜๊ณ  user์˜ Password๋ฅผ Reset ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฒ„ํŠผ์ด ์žˆ๋Š” ๊ฒƒ ๊ฐ™๋‹ค.   1234๋ฅผ ์ž…๋ ฅํ–ˆ๋”๋‹ˆ ์ด๋ ‡๊ฒŒ ๋˜๊ธธ๋ž˜...์‹ค์ œ ์ด๋ฉ”์ผ..

[Dreamhack/๋“œ๋ฆผํ•ต] simple-web-request

https://dreamhack.io/wargame/challenges/830 ๐ŸŒฑ simple-web-requestDescription STEP 1~2๋ฅผ ๊ฑฐ์ณ FLAG ํŽ˜์ด์ง€์— ๋„๋‹ฌํ•˜๋ฉด ํ”Œ๋ž˜๊ทธ๊ฐ€ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  ๋‹จ๊ณ„๋ฅผ ํ†ต๊ณผํ•˜์—ฌ ํ”Œ๋ž˜๊ทธ๋ฅผ ํš๋“ํ•˜์„ธ์š”. ํ”Œ๋ž˜๊ทธ๋Š” flag.txt ํŒŒ์ผ๊ณผ FLAG ๋ณ€์ˆ˜์— ์žˆ์Šต๋‹ˆ๋‹ค. ํ”Œ๋ž˜๊ทธ ํ˜•์‹์€ DH{...} ์ž…๋‹ˆ๋‹ค. ๐Ÿ“œdreamhack.io[1] ๋ฌธ์ œ ํ’€๊ธฐ       STEP1์˜ ํŽ˜์ด์ง€์ด๋‹ค. ๋ญ˜ ์ž…๋ ฅํ•ด์•ผ ํ•˜๋Š”์ง€ ๋ชจ๋ฅด๊ฒ ์–ด์„œ STEP2, FLAG ํŽ˜์ด์ง€๋„ ๋“ค์–ด๊ฐ€๋ดค๋Š”๋ฐ  ์•„์ง์€ ๋ญ˜ ํ•  ์ˆ˜ ์—†๋‚˜๋ณด๋‹ค.  ์ผ๋‹จ STEP1 ํŽ˜์ด์ง€๋กœ ๋Œ์•„๊ฐ€์„œ, ์•„๋ฌด๊ฐ’์ด๋‚˜ ์ž…๋ ฅํ•ด๋ณด์•˜๋Š”๋ฐ, ๊ทธ๋Œ€๋กœ ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์ถœ๋ ฅ๋˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค. ์—ฌ๊ธฐ์—์„œ ์•Œ ์ˆ˜ ์žˆ๋Š” ๊ฒŒ ์—†์–ด์„œ ๋ฌธ์ œ ํŒŒ์ผ์„ ํ™•์ธํ•ด์ฃผ์—ˆ๋‹ค.  ์—ฌ๊ธฐ์—์„œ,..

[Dreamhack/๋“œ๋ฆผํ•ต] pathtraversal

https://dreamhack.io/wargame/challenges/12 pathtraversal์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋ฅผ ์กฐํšŒํ•˜๋Š” API ์„œ๋ฒ„์ž…๋‹ˆ๋‹ค. Path Traversal ์ทจ์•ฝ์ ์„ ์ด์šฉํ•ด /api/flag์— ์žˆ๋Š” ํ”Œ๋ž˜๊ทธ๋ฅผ ํš๋“ํ•˜์„ธ์š”! Reference Server-side Basicdreamhack.io [1] ๋ฌธ์ œ ๋ถ„์„ ๋ฌธ์ œ ์„ค๋ช…์— ์˜ํ•˜๋ฉด Path Traversal ์ทจ์•ฝ์ ์„ ์ด์šฉํ•ด์•ผ ํ•œ๋‹ค.๋”ฐ๋ผ์„œ ๋จผ์ € Path Traversal ์ทจ์•ฝ์ ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ณ ์ž ํ•œ๋‹ค.  Path Traversal ์ทจ์•ฝ์ ์ด๋ž€?์ผ๋ฐ˜์ ์œผ๋กœ ๊ฒฝ๋กœ ์ˆœํšŒ(Path Traversal)๋ผ๊ณ ๋„ ๋ถˆ๋ฆฌ๋ฉฐ, ์ด ์ทจ์•ฝ์ ์„ ์ด์šฉํ•˜์—ฌ ๊ณต๊ฒฉ์ž๋Š” ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ ์„œ๋ฒ„์˜ ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ฒฝ๋กœ๋ฅผ ๋ฒ—์–ด๋‚˜๋ ค๊ณ  ์‹œ๋„ํ•œ๋‹ค. ๋ณดํ†ต์€ ํŒŒ์ผ ๊ฒฝ๋กœ์— "../" ๋˜๋Š” ์ƒ์œ„ ๋””๋ ‰ํ† ..

[Dreamhack/๋“œ๋ฆผํ•ต] baby-union

https://dreamhack.io/wargame/challenges/984 baby-unionDescription ๋กœ๊ทธ์ธ ์‹œ ๊ณ„์ •์˜ ์ •๋ณด๊ฐ€ ์ถœ๋ ฅ๋˜๋Š” ์›น ์„œ๋น„์Šค์ž…๋‹ˆ๋‹ค. SQL INJECTION ์ทจ์•ฝ์ ์„ ํ†ตํ•ด ํ”Œ๋ž˜๊ทธ๋ฅผ ํš๋“ํ•˜์„ธ์š”. ๋ฌธ์ œ์—์„œ ์ฃผ์–ด์ง„ init.sql ํŒŒ์ผ์˜ ํ…Œ์ด๋ธ”๋ช…๊ณผ ์ปฌ๋Ÿผ๋ช…์€ ์‹ค์ œ ์ด๋ฆ„๊ณผ ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ํ”Œ๋ž˜dreamhack.io[1] ๋ฌธ์ œ ์„ค๋ช…     ์šฐ์„  SQL INJECTION ์ทจ์•ฝ์ ์„ ์ด์šฉํ•˜์—ฌ ์œ„์™€ ๊ฐ™์€ ์ž…๋ ฅ๊ฐ’์„ ์ œ์ถœํ•ด์ฃผ์—ˆ๋‹ค.admin ๊ณ„์ •์œผ๋กœ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ์—ˆ๊ณ , ๋ณ„ ์˜๋ฏธ ์—†๋Š” ํ…Œ์ด๋ธ”์„ ๋ณผ ์ˆ˜ ์žˆ์—ˆ๋‹ค...  app.py๋ฅผ ์‚ดํŽด๋ณด์ž.import osfrom flask import Flask, request, render_templatefrom flask_mysqldb import MySQLa..