System Hacking - apple pie

2023. 7. 1. 14:41·Wargame/H4C
728x90
반응형

1. intro

2. code 및 분석

2.1.  code

unsigned __int64 vuln()
{
  char buf[56]; // [rsp+0h] [rbp-40h] BYREF
  unsigned __int64 v2; // [rsp+38h] [rbp-8h]

  v2 = __readfsqword(0x28u);
  printf("0x%llx\n\n", initialize);
  puts("I like apple pie! Do you like apple pie??");
  read(0, buf, 0x200uLL);
  printf("Input : %s\n", buf);
  if ( strncmp(buf, "Yes", 3uLL) )
  {
    puts("JUSY SAY 'Yes'!!!");
    exit(0);
  }
  puts("That's right! :)");
  puts("Okay. I'll give you a chance!");
  read(0, buf, 0x200uLL);
  return __readfsqword(0x28u) ^ v2;
}

2.2. 분석

main 함수는 별다른 역할은 하지 않고 vuln 함수를 실행해준다.

이 함수는 위와 같으며, bof가 발생한다.

 

3. 취약점 확인 및 공격 준비

3.1. 취약점

buffer overflow +ROP

3.2. 공격 준비

제목에서도 볼 수 있듯 PIE가 걸려있는 문제이다.

다만 보호기법을 보니 RELRO는 걸려있지 않다.

[*] '/home/wyv3rn/h4c/apple_pie'
    Arch:     amd64-64-little
    RELRO:    No RELRO
    Stack:    Canary found
    NX:       NX enabled
    PIE:      PIE enabled

앞의 bof 문제와 크게 다르지 않게 문제를 풀 수 있다.

728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Wargame > H4C' 카테고리의 다른 글

System Hacking - Simple_VM  (0) 2023.07.01
System Hacking - Notepad  (0) 2023.07.01
System Hacking - format_pistol  (0) 2023.07.01
System Hacking - bof  (0) 2023.07.01
System Hacking - Qualification  (0) 2023.07.01
'Wargame/H4C' 카테고리의 다른 글
  • System Hacking - Notepad
  • System Hacking - format_pistol
  • System Hacking - bof
  • System Hacking - Qualification
wyv3rn
wyv3rn
아저씨의 흔한 취미. wyv3rn#1249
  • wyv3rn
    think storage
    wyv3rn
  • 전체
    오늘
    어제
    • 분류 전체보기 (502)
      • To do list (7)
        • Doing (1)
        • Complete (6)
      • Diary (35)
      • Tips & theory (73)
      • Kernel Exploit (27)
        • Theory (15)
        • Exercise (5)
      • File Structure (6)
      • Wargame (313)
        • pwn.college (34)
        • Dreamhack (148)
        • pwnable.kr (15)
        • Lord of Sqlinjection (3)
        • Cryptohack (20)
        • Root me (27)
        • CodeEngn (4)
        • Exploit Education (22)
        • ROP Emporium (8)
        • H4C (10)
        • Hackerchool (22)
      • CTF (41)
        • Solved (39)
        • Unsolved (2)
      • Script (0)
      • RubiyaLap (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

    • PWN wargame 모음 (및 느낀점)
    • 비공개 글들에 대해.
    • 뭐라도 하나 얻어가시길...
  • 인기 글

  • 태그

    Me
    phoenix
    pwntools
    BOF
    docker
    hackerschool
    pwnable.kr
    heap
    x64
    _IO_FILE
    root
    rop
    libc
    ROOT ME
    32bit
    RTL
    lob
    FSB
    tcache
    64bit
    dreamhack
    Format String Bug
    x86
    la ctf
    cryptohack
    Buffer Overflow
    vtable
    CANARY
    root-me
    exploit education
  • 최근 댓글

  • 최근 글

  • 250x250
    반응형
  • hELLO· Designed By정상우.v4.10.3
wyv3rn
System Hacking - apple pie
상단으로

티스토리툴바