일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- photon fusion2
- attribute
- animation
- Aegis
- 유니티
- ability task
- 보안
- CTF
- widget
- 게임개발
- local prediction
- Unreal Engine
- unity
- MAC
- Replication
- C++
- UI
- 언리얼 엔진
- rpc
- nanite
- listen server
- stride
- 언리얼엔진
- Multiplay
- gas
- gameplay ability system
- 게임 개발
- gameplay tag
- gameplay effect
- os
Archives
- Today
- Total
Replicated
Heap Overflow with code reuse 본문
Code-Reuse Attack
- 컨트롤 플로우 어택의 서브클래스
- 의도된 컨트롤 흐름을 전복하여 의도되지 않은 실행 경로를 타도록 유발 (엣지 변동)
- 존재하는 코드를 이용해서 악의적인 결과를 냄 (system 같은 함수)
ex.
Return-to-Libc Attacks (Ret2Libc)
Return-Oriented Programming (ROP)
Jump-Oriented Programming (JOP)
/* heap_bof.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct chunk
{
char inp[8];
void (*proc)(char *);
} chunk_t;
void showbuf(char *buf)
{
printf("buf = %s\n", buf);
}
void runsh(char *buf)
{
system("/bin/sh");
printf("buf=%s\n", buf);
}
int main(int argc, char *argv[])
{
chunk_t *next;
next = (chunk_t*)malloc(sizeof(chunk_t));
printf("inp=%p, proc=%p\n", next->inp, &(next->proc));
printf("runsh=%p\n", runsh);
next->proc = showbuf;
next->proc(next->inp);
strcpy(next->inp, argv[1]);
next->proc(next->inp);
printf("Heap buffer done\n");
}

입력으로 아무거나 주고 runsh 체크

쉘에서 직접 실행할 때는 아무 반응없는 쉘이 나와서 gdb 돌렸는데 여기선 오버플로우로 쉘 실행에 성공함
쉘이 두개 뜬 것도 확인 가능
코드 리유즈 어택으로 인해 엣지가 바뀜
=> 함수를 리턴하기 전에 CFG를 체크하면 공격이 일어났는지 확인 가능
방어 기법
system()을 제거하거나 주소 중간에 00 넣기
- 이래도 fork랑 exec 둘 써서 공격 가능함
- 또한, 아예 라이브러리 함수 안쓰고 코드 청크를 결합하여 공격도 가능 (ROP)
ROP 때문에 리턴을 없애니 JOP(jump)가 등장..
'운영체제보안' 카테고리의 다른 글
Ret2Libc - Func's Prologue & Epilogue (0) | 2024.12.05 |
---|---|
Return-to-libc Attacks (Ret2Libc) / 실습 (0) | 2024.12.05 |
Heap Overflow with code injection (0) | 2024.12.05 |
Control Hijacking Attack (0) | 2024.12.05 |
BoF - Countermeasures & 파훼법 (0) | 2024.12.04 |