ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

CHALLENGE

[LOS] Dragon ํ’€์ด(20)

๐ŸŒง: 2020. 12. 11.

20 ๋ฒˆ์งธ ๋ฌธ์ œ์ธ "Dragon"์ž…๋‹ˆ๋‹ค.

 

if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); 

์ฟผ๋ฆฌ๋ฌธ์„ ์ž…๋ ฅ๋ฐ›์•„ ์‹คํ–‰ํ•˜๊ฒŒ ํ•ด์ฃผ๋Š” ๋ณ€์ˆ˜๋Š” GET [pw]์ด๋ฉฐ ํ•„ํ„ฐ๋งํ•˜๊ณ  ์žˆ๋Š” ๋ฌธ์ž์—ด์€ / _ . () ์ƒ๋Œ€์ ์œผ๋กœ ์ ์–ด์„œ ๊นŒ๋‹ค๋กœ์›Œ ๋ณด์ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

 

$query = "select id from prob_dragon where id='guest'# and pw='{$_GET[pw]}'";

์ž…๋ ฅ๋˜๋Š” ์ฟผ๋ฆฌ ๋ฌธ์„ ๋ณด๋ฉด id='guest'๋กœ ์ง€์ •๋˜์–ด ์žˆ์œผ๋ฉฐ ๋ฐ”๋กœ ์•ž์— "#(์ฃผ์„)" ์ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— "pw" ๊ฐ’์— ์ž…๋ ฅ๋œ ๊ตฌ๋ฌธ๋“ค์„ ๋ชจ๋‘ ๋ฌดํšจ ์ฒ˜๋ฆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

 

if($result['id'] == 'admin') solve("dragon");

๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด id๊ฐ€ "admin"์ธ ๊ณ„์ •์œผ๋กœ ๋ถˆ๋Ÿฌ์™€์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์šฐ๋ฆฌ๋Š” GET [pw] ๋ณ€์ˆ˜์— id๊ฐ€ admin ์ธ ๊ณ„์ •์„ ์ฐธ ๊ฐ’์„ ์ž‘์„ฑํ•ด์„œ ์‹คํ–‰์‹œ์ผœ์•ผ ํ•ฉ๋‹ˆ๋‹ค.

 

New Line ์‚ฌ์šฉ

์ „์— ์ž…๋ ฅ๋œ #(์ฃผ์„)์„ ์˜๋ฏธ ์—†๊ฒŒ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด New Line (%0a)์„ ์ด์šฉํ•ด์„œ ์ƒˆ๋กœ์šด ์ค„์„ ๊ตฌ์„ฑํ•˜๋ฉด ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Input Code

pw=%0a% 1 and id='admin

 

"pw" ๋ณ€์ˆ˜์— %0a(New Line)์„ ์‚ฌ์šฉํ•ด์„œ ์ƒˆ๋กœ์šด ์ค„์„ ๊ตฌ์„ฑํ•ด์ฃผ๊ณ  "%"๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ €์žฅ๋˜์–ด ์žˆ๋Š” ๋ชจ๋“  ์ •๋ณด๋ฅผ ๋Œ€์ƒ์œผ๋กœ ์žก์•„์ฃผ๊ณ  and ์—ฐ์‚ฐ์ž๋ฅผ ํ†ตํ•ด id ๊ฐ€ "admin"์ธ ๊ณ„์ •์„ ๋ถˆ๋Ÿฌ์˜ค๋ฉด ๋ฉ๋‹ˆ๋‹ค.

'CHALLENGE' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

XSS Challenges 9  (0) 2021.08.25
XSS Challenges 8-1  (0) 2020.12.12
XSS Challenges 8  (0) 2020.12.11
[LOS] Xavis ํ’€์ด(19)  (0) 2020.12.10
[LOS] Nightmare ํ’€์ด(18)  (0) 2020.12.10
๊ณต์œ ํ•˜๊ธฐ ๋งํฌ
Comment