300 likes | 916 Views
Reverse Engineering. PART1 숭실대학교 최소영 , 김충희. Reverse Engineering. What is Reverse Engineering? Intel Architecture Calling Convention. What is Reverse Engineering?. Reverse Engineering. Game Hack. CD-Key. EDITER. Maintenance. Security. Imformation.
E N D
Reverse Engineering PART1 숭실대학교 최소영, 김충희
Reverse Engineering • What is Reverse Engineering? • Intel Architecture • Calling Convention
Reverse Engineering Game Hack CD-Key EDITER Maintenance Security Imformation
What Does It Need For Reverse Engineering? • Intel Architecture & Basic • Register • Virtual Memory • Calling Convention • ELF • Compositionof ASM Table • GDB, OBJDUMP, Itrace, strace
Intel Architecture 가용 메모리 영역 확인 최근 사용되는 시스템의 CPU는 64bit씩 처리할 수 있으므로 메모리 영역은 0~264-1의 범위를 갖는다. Kernel 적재
Intel Architecture 명령어:기계어코드 논리주소 사용
Intel Architecture 지역변수 • What does Data Segment have? • Data Structure • Data Module • Dynamic Generation Data • Sharing Data • What does Stack Segment have? • Handler • Task • Program • Buffer 전역 변수 Physical address = Logical address + Offset 0x80010000(offset) + 0x00000100(logical a.d) = 0x80010100(physical a.d)
Register 32-bit register for accumulator EAX's lower half 16-bit register AX's upper half 8-bit register AX's lower half 8-bit register
Register • EFLAGS Register • EFLAGS : 32-bit register for flags • Instruction Pointer • EIP: 32-bit register for instruction pointer • Segment Register • CS : 16-bit register for code segment • SS : 16-bit register for stack segment • DS : 16-bit register for data segment • ES, FS, GS : additional 16-bit segment register
The Basic of Calling Convention What does it need for materialization of calling function? Place where could save return value after function execution Place where function’s information could be save Pointer which has function’s location Place where could get the parameter which need for function execution Function name which can get the value
The Basic of Calling Convention Stack structure Last in-first out callee caller
What is calling convention exactly? 함수 호출 규약(function calling convention) : 함수 호출을 위해서 밟는 절차 서로 다른 컴파일러 및 언어에 대한 상호 작용성↑ 빌드(Build)된 실행 파일의 재사용성 ↑
Calling Convention _cdecl : 전통적인 C스타일의 호출규약 인자를 오른쪽에서 왼쪽으로 Stack에 저장 (뒤에 것부터 먼저 넣음) 받을 때는 Register를 통해 Return값을 받음 호출한 함수가 Stack을 해제
Calling Convention _stdcall : API함수에 적용된 호출규약 (파스칼식 호출) 일반적으로 API식 _cdecl로 여겨짐 호출 받은 함수가 스택을 해제 가변 파라미터 사용시 _cdcl과 같은 형식의 호출 사용
Calling Convention _fastcall: _stdcall을 빠른 속도로 개선 Register Calling Convention Windows NT/200X 커널 모드 드라이버에서는 더 이상 사용하지 않음 (Register는 CPU에 종속적이기 때문