๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • Welcome.
:: BoB 11๊ธฐ ๐Ÿšฉ/Topics

[ vuln ] - [ BoF - Stack Canary, Heap based ]

by EunBird 2022. 7. 15.

=> ์ฃผ์–ด์ง„ ๋ฒ„ํผ๋ณด๋‹ค ๋งŽ์€ ๊ฐ’์„ ์ž…๋ ฅ ๋ฐ›์•„ ์นด๋‚˜๋ฆฌ๋กœ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๋˜๋ฉด ํ”„๋กœ๊ทธ๋žจ์ด ์‹คํ–‰๋˜์ง€ ์•Š๋Š”๋‹ค.

 

[ Stack Canary ]

- ํ•จ์ˆ˜ ์ง„์ž…์‹œ ์Šคํƒ์— SFP(Save Frame Pointer)์™€ return address ์ •๋ณด๋ฅผ ์ €์žฅํ•  ๋•Œ,

- ์ด ์ •๋ณด๋“ค์ด ๊ณต๊ฒฉ์ž์— ์˜ํ•ด ๋ฎ์–ด์”Œ์›Œ์ง€๋Š” ๊ฒƒ์œผ๋กœ๋ถ€ํ„ฐ ๋ณดํ˜ธํ•˜๊ธฐ ์œ„ํ•ด

- ์Šคํƒ ์ƒ์˜ ๋ณ€์ˆ˜๋“ค์˜ ๊ณต๊ฐ„๊ณผ SFP ์‚ฌ์ด์— ํŠน์ •ํ•œ ๊ฐ’์„ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฐ’.

 

- Stack Canary๊ฐ’์˜ ๋ณ€์กฐ ์œ ๋ฌด์— ๋”ฐ๋ผ Buffer Overflow๋ฅผ ํƒ์ง€ํ•˜๊ธฐ ๋•Œ๋ฌธ์—

- ๊ธฐ์กด์˜ ๊ฐ’๊ณผ ๋‹ค๋ฅธ ์œ„ ๊ฒฝ์šฐ bof๊ฐ€ ํƒ์ง€ ๋˜์–ด return address๊ฐ€ ๋ณ€์กฐ๋˜์ง€ ์•Š๊ณ  ์ข…๋ฃŒ๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

=> Stack Cananry์˜ ์กด์žฌ์ด์œ .

 

 

 


Buffer overflow - Heap based

  • Heap์€ ๋™์  ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ์‹œ ์‚ฌ์šฉ๋จ.
  • Stack based buffer overflow์™€ ํ• ๋‹น๋œ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์„ ๋„˜์–ด access/overwriteํ•œ๋‹ค๋Š” ์ ์€ ์œ ์‚ฌ.
    • ๋‹จ, SFP๋‚˜ RET๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์Œ.
  • ์ฃผ๋กœ overwriteํ•  ๋Œ€์ƒ.
    • Virtual Function Table
    • Function Pointer
    • Class Object/Structure Memory
  • Virtual Function Table
    • Class ๋ฉค๋ฒ„ ํ•จ์ˆ˜ ์ค‘, 1๊ฐœ ์ด์ƒ virtual ๋ฉ”์†Œ๋“œ๋ฅผ ํฌํ•จ๋˜๋Š” class ์— ์ƒ์„ฑ.
    • ๋ณดํ†ต `this`์˜ +0 ์˜คํ”„์…‹.
auto *object = new Object();

//object ์˜ ๋ฉ”๋ชจ๋ฆฌ corruption

object → method1();

 

 

728x90

':: BoB 11๊ธฐ ๐Ÿšฉ > Topics' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[ vuln ] - [ Type Confusion, Use After Free ]  (0) 2022.07.15
[ vuln ] - [ Integer overflow ]  (0) 2022.07.15
[ vuln ] - [ Buffer overflow, bof, ]  (0) 2022.07.15
[ vuln ] - [ Time of Check to Time of Use(toctou), Race condition ]  (0) 2022.07.15
[ Cryto ] - AES ์•”ํ˜ธ  (0) 2022.07.13

๋Œ“๊ธ€