๐Ÿ” Security

[Security] Fuzzer, Fuzzing ์ด๋ž€?

Rosieblue 2023. 3. 3. 16:01
728x90

์˜ค๋Š˜์€ Fuzzer, Fuzzing์— ๋Œ€ํ•ด์„œ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋‹ค๋ค„๋ณด๋ ค๊ณ  ํ•œ๋‹ค
 

๋งˆ! ๋‹ˆ ์ด์ •๋„๋ฉด ๋ธ”๋กœ๊ทธ ์ค‘๋…์ด๋‹ค !

  "Fuzzing refers to a process of repeatedly running a program with generated inputs to test if a program violates a correctness policy." ๋ผ๊ณ  ํ•œ๋‹ค.
 
๊ฑ ์ทจ์•ฝ์  ๋ถ„์„์„ ์œ„ํ•ด์„œ ์ธํ’‹์„ ๋ฐ˜๋ณตํ•ด์„œ ์—„์ฒญ ๋งŽ์ด ๋„ฃ์–ด๋ด์„œ(๋žœ๋คํ•˜๋“  ์•ˆ ๋žœ๋คํ•˜๋“ ) ๋ฒ„๊ทธ๊ฐ™์€ ๊ฑฐ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๊ฑฐ๋‹ค!!!! ๊ทธ ๋‚ด๊ฐ€ Python ํ†ตํ•ด์„œ Blind SQL Injection ์ž๋™ํ™” ๋„๊ตฌ ๋งŒ๋“ค๋ ค๊ณ  ํ–ˆ๋˜๊ฑฐ๋ž‘ ๋น„์Šทํ•œ๊ฑธ๋กœ ๋ณด์ธ๋‹ค(์•„๋งˆ?)
๊ทผ๋ฐ ์ผ๋‹จ ์ € Python ํ†ตํ•ด์„œ ๋งŒ๋“œ๋Š”๊ฑฐ๋ž‘ ใ„นใ…‡๋กœ ๋น„์Šทํ•œ ๊ฑฐ๋ฉด fuzzer ๋งŒ๋“œ๋Š”๊ฑด ๊ฝค๋‚˜ ๋‚ด ์ทจํ–ฅ์ผ ์ˆ˜๋„...? ์™œ๋ƒ๋ฉด ๊ฐœ๋ฐœ๋„ ์žฌ๋ฐŒ๊ณ  ๋ณด์•ˆ๋„ ์žฌ๋ฐŒ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค ํ—คํ—น ์ด๊ฑฐ ๋„˜ ์ผ๊ธฐ์Šค๋Ÿฌ์šด ํฌ์ŠคํŠธ๊ฐ™์€๋ฐ ใ…Žใ…Žใ…Ž,, ํ˜น์‹œ๋‚˜ ์ด ๊ธ€์„ ๋ณธ๋‹ค๋ฉด ๋ฌด์‹œํ•ด๋„ ๋œ๋‹ค.. ์‚ฌ์‹ค ์ง€๊ธˆ ๋ฐฐ๊ฐ€ ์•„ํŒŒ์„œ ์ •์‹ ์ด ์—†๋‹น ใ…  ใ…  
 
 

ํผ์ง•์„ ํ˜„์žฌ ์•„๋Š” ์ •๋ณด์˜ ์–‘์œผ๋กœ ๊ตฌ๋ถ„ํ•  ์ˆ˜์žˆ๋Š”๋ฐ ์ด๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • Black-box Fuzzing: ๊ฑ ๋‚ด๋ถ€ ๊ตฌ์กฐ ๋ชจ๋ฅด๊ณ  ์ธํ’‹ ์•„์›ƒํ’‹๋งŒ ์•Œ ์ˆ˜ ์žˆ๋Š” ์ƒํƒœ์—์„œ ํผ์ง•
  • White-box Fuzzing: ํ”„๋กœ๊ทธ๋žจ ๋‚ด๋ถ€ ๊ตฌ์กฐ ์•„๋Š” ์ƒํƒœ์—์„œ ํผ์ง•
  • Grey-box Fuzzing: ํ”„๋กœ๊ทธ๋žจ ๋‚ด๋ถ€์˜ ์ผ๋ถ€๋ฅผ ์•„๋Š” ์ƒํ™ฉ์—์„œ ํผ์ง•

๊ฑ ๋‚ด๊ฐ€ ํ˜„์•”๊ธฐ์—์„œ ๋ฐฐ์› ๋˜ ๋ธ”๋ž™(๊ทธ๋ ˆ์ด,ํ™”์ดํŠธ)๋ฐ•์Šค ์–ดํƒ์ด๋ž‘ ๋˜‘๊ฐ™๋‹ค. (black box attack์€ ๊ฑ ํผ์ง•์ด๋ž€ ๋‹จ์–ด๋ฅผ ์œ„์—์„œ attack์œผ๋กœ ๋ฐ”๊พธ๋ฉด ๋œ๋‹ค)
 
 

ํผ์ง•์˜ ํŠน์ง•์„ ๋ณผ๊นŒ?

  • protocol/file-format dependant
  • data-type dependant

์ด๋‹ค!!! ์™œ๋ƒํ•˜๋ฉด ! ๊ฒฐ๊ตญ fuzzing์ด๋ผ๋Š” ๊ฒƒ์€ input์— ์–ด๋–ค ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ๋Š” ๊ฒƒ์ธ๋ฐ, ๊ทธ ์ธํ’‹ ์นธ์˜ ํ˜•์‹/ํƒ€์ž…์ด ๋งž๋Š” ๊ฒƒ์„ ๋„ฃ์–ด์•ผ ๊ฒฐ๊ณผ๊ฐ€ ๋Œ์•„๊ฐˆ ๊ฑฐ๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค!!! ๊ทธ๋‹ˆ๊นŒ ๋ฐ์ดํ„ฐ๋ฅผ ํ˜•์‹์— ์ž˜ ๋งž์ถฐ์„œ ๋„ฃ์–ด์ฃผ์ž
 
 

๊ทธ๋Ÿผ ํผ์ง•์„ ์–ด๋–ป๊ฒŒ ํ•˜๋ฉด ํšจ์œจ์ ์ผ๊นŒ?

์ด๋ฏธ ์œ„ํ—˜ํ•˜๋‹ค๊ณ  ํŒ๋‹จ๋˜๋Š”/์˜ˆ์ƒ๋˜๋Š” ์ธํ’‹ ๊ฐ’(=fuzz vector)๋“ค์„ (์•„๋‹ˆ๋ฉด ์ด๋†ˆ๋“ค์˜ ์กฐํ•ฉ์„) ๋จผ์ € ์ธํ’‹๊ฐ’์ด ๋„ฃ์–ด๋ณด๋Š”๊ฑฐ๋‹ค. ๊ตณ์ด ๊ฐ€๋Šฅ์„ฑ๋„ ๋‚ฎ์€ ๊ฐ’์„ ๋„ฃ์œผ๋ฉด ๋น„ํšจ์œจ์ ์ผํ…Œ๋‹ˆ๊นŒ! 

  • for integers: zero, possibly negative or very big numbers 
  • for chars: escaped, interpretable characters / instructions (ex: For SQL Requests, quotes / commandsโ€ฆ)
  • for binary: random ones

 
ํผ์ง•์— ์ข…๋ฅ˜์—๋„ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ข…๋ฅ˜๊ฐ€ ์žˆ๋Š”๋ฐ ์ง€๊ธˆ ๋ฐฐ๊ฐ€ ๋„˜ ์•„ํŒŒ์„œ ์—ฌ๊ธฐ์„œ ๋งˆ๋ฌด๋ฆฌํ•˜๋„๋ก ํ•˜๊ฒ ๋”ฐ...์•ˆ๋‡ฝ...
 
 
Reference
https://ndb796.tistory.com/522

Fuzzing์— ๊ด€ํ•˜์—ฌ ๋„์ ์ธ ๊ธ€

ํ•˜๋‚˜์˜ ํ”„๋กœ๊ทธ๋žจ์˜ ์ทจ์•ฝ์ ์„ ์ฐพ๋Š” ๋ฐฉ๋ฒ•์—๋Š” ๋‹ค์–‘ํ•œ ๊ธฐ๋ฒ•์ด ์žˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ํ”„๋กœ๊ทธ๋žจ์€ ์ž…๋ ฅ(input)์„ ๋ฐ›์•„์„œ ์ถœ๋ ฅ(output)์„ ๋‚ด๋ณด๋‚ด๋Š” ๋ฐฉ์‹์œผ๋กœ ๋™์งํ•˜๋Š”๋ฐ, ํผ์ง•(fuzzing)์ด๋ž€ ์ž๋™์ ์œผ๋กœ ์ž…๋ ฅ์„

ndb796.tistory.com

https://owasp.org/www-community/Fuzzing

Fuzzing | OWASP Foundation

Fuzzing on the main website for The OWASP Foundation. OWASP is a nonprofit foundation that works to improve the security of software.

owasp.org