wargame
-
Dreamhack - rev-basic-3wargame/Dreamhack 2024. 7. 17. 18:49
[LEVEL 1 - rev-basic-3 - reversing] 이전 문제와 비슷하게 사용자의 입력값을 검증해서 맞으면 correct를, 틀리면 wrong을 출력하는 프로그램이 주어진다. IDA로 main() 디컴파일해서 함수 들어가보면 위와 같이 vfprintf 함수가 쓰인 걸 볼 수 있다. 그리고 또 다른 함수에서는 _acrt_iob_func()가 0번 스트림(stdin 파일 스트림)을 가져오는 걸 알 수 있다. 그리고 이 입력받은 a1을 처리하는 함수에 들어가보면 xor 연산을 하고 있는 부분을 볼 수 있다. byte_140003000을 들어가면 위와 같이 나온다. 이걸 이용해서 역연산하여 사용자 입력값이 무엇이어야 하는지 알아낼 수 있다. main()에 있는 함수명을 위처럼..
-
Dreamhack - pathtraversalwargame/Dreamhack 2024. 5. 28. 21:19
[Beginner - pathtraversal - web] 먼저 문제 환경에 접속한 후 문제파일도 다운로드한다.플래그값은 /api/flag에 있다고 문제 설명에 나와 있다. 유저가 guest랑 admin이 있는 걸 볼 수 있다. 위 코드를 보고 /api나 /api/flag를 입력하면 역시나 unauthorized가 떠서 플래그값을 볼 수 없다.그리고 /get_info에서 /api/user/일 때 상위 디렉토리로 한번 이동해서 /api/flag 경로를 가야하니까 ..flag를 입력해봤는데, 마찬가지로 플래그값을 볼 수 없다. 그래서 일단 BurpSuite을 켜서 프록시 탭의 intercept에서 open browser로 문제 환경에 접속하고, intercept를 on으로 킨다. 그다음 ..
-
Dreamhack - rev-basic-2wargame/Dreamhack 2024. 5. 27. 14:51
[LEVEL 1 - rev-basic-2 - reversing] 이 문제도 입력값이 맞으면 Correct를, 틀리면 Wrong을 출력한다. 일단 x64dbg에서 테스트겸 "exercise"를 입력하고 중단점 필요한 곳에 걸고 f8로 따라가다보면 Correct와 Wrong을 출력하는 부분이 위와 같이 나온다.아무거나 친 것이기 때문에 Wrong부분으로 점프하는 걸 볼 수가 있는데, Correct일 경우 call하는 함수를 더블클릭해 들어가본다. 클릭되어 있는 저 부분을 우클릭해서 덤프에서 따라가기를 누르면 아래에 플래그값이 그대로 나온다. 플래그값을 알았으니, 맞는지 확인하기 위해 새로 실행해서 정답을 입력해주고 f7로 하나씩 실행시켜보면 위와 같이 문자 하나하나 비교하는 걸 볼 수 ..
-
Dreamhack - rev-basic-1wargame/Dreamhack 2024. 5. 21. 21:28
[Beginner - rev-basic-1 - reversing] rev-basic-0 문제를 풀었으면 이 문제는 바로 풀 수 있다.똑같이 입력값을 검증해서 맞으면 Correct, 틀리면 Wrong을 출력하고, 플래그는 Correct가 출력되는 입력값이다. 바로 x64dbg로 문제파일에 있던 실행파일을 열어본다.입력은 일단 아무것도 모르니까 test로 입력한다.그런데 마찬가지로 f7로 얼마 실행시키지 않았는데 정답이 문자 하나씩 다 나오고 있다. 계속 이렇게 내리면 정답이 이어서 보인다. 계속 내리고 여기까지 쭉 내리면 정답이 다 나온다.대소문자 잘 구분해서 모두 연결한 문자열을 입력하면 Correct가 출력된다. 플래그를 획득했다!
-
Dreamhack - rev-basic-0wargame/Dreamhack 2024. 5. 21. 21:20
[Beginner - rev-basic-0 - reversing] 입력값 검증해서 correct가 출력되는 입력값이 플래그값이다. x64dbg로 문제파일 안에 들어있던 실행 파일 열어보면 위와 같은 화면이 나온다.f9 두번 누른 뒤 f7로 한단계씩 실행하다가 입력하라고 뜨면 일단 아무거나 1004를 입력한다.그러다가 위 사진처럼 답으로 추정되는 게 바로 나온다. 처음부터 다시 실행시켜서 정답으로 추정되는 문자열을 입력하고 살펴본다.정확히 일치하는지 입력받은 문자열의 문자 하나하나를 다 비교하는 것을 볼 수 있다. 검증 후 출력할 Correct와 Wrong 문자열도 보인다. Correct가 실행 창에 제대로 떴는지도 확인해보자. 플래그를 획득했다!
-
Dreamhack - ROT128wargame/Dreamhack 2024. 5. 14. 21:54
[Beginner - ROT128 - crypto] 문제 파일을 다운로드 받으면 rot128.py와 encfile이 들어있다. 제공된 코드는 위와 같이 flag.png를 암호화하여 encfile로 저장하는 내용을 담고 있다.따라서 주어진 encfile을 복호화해 flag 파일 내용을 알아낸 뒤, flag.png에서 플래그를 획득하면 되는 문제다. 위와 같이 encfile을 복호화한 이진 데이터를 flag.png에 쓰는 코드를 작성하면 된다.코드를 실행하면 flag.png가 생성되고 열어보면 플래그값이 나와 있다. 플래그를 획득했다!
-
-
Dreamhack - Enc-JPGwargame/Dreamhack 2024. 5. 8. 00:09
[LEVEL 3 - Enc - JPG - reversing, forensics] 문제 파일을 다운로드 받으면 Enc라는 파일 하나와 flag.jpg 파일 하나가 있다. 파일 이름은 flag.jpg인데 HxD로 열어보면 손상된 걸 알 수 있다. 파일을 HxD로 열어보면 MZ을 보아 실행파일인 걸로 추측할 수 있다.따라서 .exe로 확장자를 변환해준다. 이렇게 실행파일로 바뀌고, flag.jpg이 조금 보이게 되었다. 그럼 이렇게 다시 jpg 헤더 시그니처로 바뀐 걸 볼 수 있다. jpg의 푸터 시그니처인 FF D9를 검색하면 두 개가 나오는데 첫 번째꺼를 지우고 저장한다. 그러면 위와 같이 첫 번째 플래그값을 얻을 수 있다. 두 번째로 있던 푸터 시그니처..