정보보안 SUA - [정보보안공부] 6주차 과제 - 런타임 API Hooking 수행

2021. 3. 11. 00:23·리버싱/리버싱 걸음마
728x90
반응형

타겟 프로그램의 소스코드와 바이너리가 주어집니다.
실행 중인 타겟 프로세스의 API를 후킹하는 것이 목적이며, 타겟 프로세스의 메모리를 변조하기 위해 5주차에 학습한 방법을 사용합니다.

 

- [필수 1] 디버거/디스어셈블러를 사용하여 타겟 프로그램을 분석합니다. (x64dbg 추천)
- [필수 2] 실행 중인 타겟 프로세스의 메모리를 변조하는 프로그램을 작성하여 숨겨진 메시지 박스를 표시합니다. (콘솔 프로그램도 무관. 과제 5 참고)
- [선택 1] MessageBoxW 함수를 후킹하여 해당 함수가 호출될 때마다 로그를 출력합니다. (Link 1, 2)
- [선택 2] MessageBoxW 함수를 후킹하여 함수 호출에 사용된 인자를 변경합니다. (Link 3)
- [선택 3] 클래스의 멤버 함수를 후킹합니다. (Link 4, 5)

 

Link 1 - 5바이트 인라인 후킹, 7바이트 핫패칭: m.blog.naver.com/ryong0906/220615617530

 

29 API 후킹

Win32 API 호출을 중간에서 가로채서 제어권을 얻어내는 것. *후킹 방법 1. IAT(Import Address ...

blog.naver.com

Link 2 - WinAPI에 대한 7바이트 핫패칭 개념 설명: 

devblogs.microsoft.com/oldnewthing/20110921-00/?p=9583

 

Why do Windows functions all begin with a pointless MOV EDI, EDI instruction? | The Old New Thing

If you look at the disassembly of functions inside Windows DLLs, you’ll find that they begin with the seemingly pointless instruction MOV EDI, EDI. This instruction copies a register to itself and updates no flags; it is completely meaningless. So why is

devblogs.microsoft.com

 

Link 3 - 훅 함수 정의 시 주의사항: 

stackoverflow.com/questions/54852191/hooking-windows-api-function-crashes-application

 

Hooking Windows API function crashes application

I'm making a DLL that hooks specific Windows API functions with Microsoft Detours, in order to perform some analysis. The DLL is added to a third party's game's import table, in order to have the D...

stackoverflow.com

Link 4 - 멤버 함수 후킹 (__fastcall 사용): 

guidedhacking.com/threads/thiscall-member-function-hooking.4036/

 

Tutorial - Thiscall (member function) hooking

Generally every member function is a thiscall: https://en.wikipedia.org/wiki/X86_calling_conventions#thiscall To recognize thiscall, you should note the first argument will always be the this pointer (pushed to stack last - first in last out rule), pointin

guidedhacking.com

Link 5 - 멤버 함수 후킹 (__fastcall 미사용): 

stackoverflow.com/questions/21636482/hooking-thiscall-without-using-fastcall

 

Hooking __thiscall without using __fastcall

Say you need to hook/detour a function that is the __thiscall type on x86 Windows and in order to do that, you need to pass a void* to the shim function. Yes this is technically "horrible abuse" of...

stackoverflow.com

참고 : disasm.pro/

 

Online Assembler and Disassembler

Online Assembler and Disassembler supporting multiple architectures. Assemble and disassemble x86/64, ARM, MIPS, PowerPC and Sparc

disasm.pro

 

[필수1] 디버거/디스어셈블러를 사용하여 타겟 프로그램을 분석합니다. (x64dbg 추천)

 

타겟 프로그램 기능:

x32dbg 분석 (main함수 같다?)

SUCCESS 와 Hidden message! 메세지가 숨겨져있다. 

근데 Hidden message가 출력되려면 위에서  5: Quit에서 5를 눌러도 프로그램이 종료되지 않게 해야한다.

 

따라서 파란색 화살표 처럼 402d66에서 402d71로 넘어갈 수 있게 수정해줘야한다.

[필수2] 

잘 모르겠다. 추후 수정하겠습니다.

728x90
반응형

'리버싱 > 리버싱 걸음마' 카테고리의 다른 글

정보보안 SUA - [정보보안공부] 7주차 과제 - DLL Injection 수행  (0) 2021.03.17
정보보안 SUA - [정보보안공부] 5주차 과제 - Hooking의 기초  (0) 2021.03.03
정보보안 SUA - [정보보안공부] 4주차 과제 - Windows 데스크톱 앱 개발  (0) 2021.02.26
정보보안 SUA - [정보보안공부] 3주차 과제 - 리버싱 로드 맵 및 PE로더  (0) 2021.02.24
정보보안 SUA - [정보보안공부] 2주차 과제 - Windows 데스크톱 앱 개C/C++ 언어의 다양한 개념들이 x86 어셈블리 언어로 변환 결과물  (0) 2021.02.05
'리버싱/리버싱 걸음마' 카테고리의 다른 글
  • 정보보안 SUA - [정보보안공부] 7주차 과제 - DLL Injection 수행
  • 정보보안 SUA - [정보보안공부] 5주차 과제 - Hooking의 기초
  • 정보보안 SUA - [정보보안공부] 4주차 과제 - Windows 데스크톱 앱 개발
  • 정보보안 SUA - [정보보안공부] 3주차 과제 - 리버싱 로드 맵 및 PE로더
Royal!
Royal!
Bachelor of Arts. Bachelor of Science in Engineering. Master of Science in Engineering (In Progress). Job Title: Infrastructure & Security & Cloud Engineer. Etc: Mentor at Fourth Industrial Revolution Center.
  • Royal!
    Security
    Royal!
  • 전체
    오늘
    어제
    • 분류 전체보기
      • 운영체제
      • 네트워크
      • 클라우드
      • 서버
      • Container
      • 프로그래밍
        • Python_혼자 끄적끄적
        • Python_AI(영상처리)
        • 빅데이터
        • C_정보올림피아드 Language_Coder
        • C_QnA
      • 자격증
        • 정보보안기사
        • 정보처리기사
        • ADsP
        • CPPG
        • 보안법률
        • NCA~NCP
        • AWS Certified Solutions Arc..
      • 리버싱
        • 리버싱 걸음마
      • Wargame & CTF
        • Hackerschool FTZ
      • 기타 교육
        • KISA 정보보호제품실습군
        • 빅데이터_분석실무
        • 시큐어코딩진단전문교육(호남정보보호센터)
        • SW테스트 전문가 과정(ISTQB CTFL자격)
        • 정보보호 컨설팅 전문가 양성과정
      • 기타
        • 면접일지
        • 기타
        • 인턴활동
        • 논문 요약
      • K-Shield Jr
        • 악성코드분석
        • 침해사고분석
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    심스와핑
    sim cloning
    l3 dsr ftp
    유십침 유출
    이심 유출
    nca 덤프
    네이버클라우드 dump
    ncp dump
    it대학원
    정보보호 일반대학원
    skt유심해킹
    ncp 덤프
    ict대학원
    nca dump
    네전따 세미나
    네이버클라우드 덤프
    ai를 활용한 보안
    it야간대학원
    인프라기술세미나
    네이버클라우드 ftp 설정
    nce덤프
    유심 해킹
    nce dump
    it주말대학원
    sim swaping
    정보보호 전문대학원
    심클로닝
    gpu design
    ml보안
    skt 유심 유출
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
Royal!
정보보안 SUA - [정보보안공부] 6주차 과제 - 런타임 API Hooking 수행
상단으로

티스토리툴바