wargame
-
Dreamhack - [CodeEngn] Malware L07wargame/Dreamhack 2024. 8. 18. 19:49
[LEVEL 1 - [CodeEngn] Malware L07 - reversing, misc] 이 문제도 문제 파일을 다운로드 받으면 pdf 하나가 들어있다. 악성코드의 Flow 일부가 주어지는데, 이전 L06번 문제와 거의 같아 보인다. 문제 설명에 나와있는 것처럼 이 악성코드는 위와 같이 특정 사이트에 접속을 시도하고 있다. 접속이 안될 경우 몇초 단위로 재접속을 하는데, 몇ms 단위로 재접속을 하는지 구해야 한다.pdf 아래 부분을 확대하면 위처럼 96000h ms 만큼 Sleep(쉬었다가) 이후 재접속을 하는 것으로 보인다.96000h의 h는 16진수를 의미하므로 이를 10진수로 바꾸면 614400이다. 즉, 614400 ms 단위로 재접속을 한다. 플래그를 획득했다!
-
Dreamhack - [CodeEngn] Malware L06wargame/Dreamhack 2024. 8. 18. 19:39
[LEVEL 1 - [CodeEngn] Malware L06 - reversing, misc] 문제 파일을 다운로드 받으면 pdf 하나가 들어있다. 위와 같이 악성코드의 전체 Flow가 그래프로 주어진 pdf이다. 시작 부분을 보면 CreateMutexA()가 가장 눈에 띈다. 구글링하면 msdn에 아래와 같이 친절하게 설명이 나온다.매개변수 중 lpMutexAttributes는 SECURITY_ATTRIBUTES 구조체에 대한 포인터이다. 이 매개변수가 NULL이면 자식 프로세스에서 핸들을 상속할 수 없다.bInitialOwner은 이 값이 TRUE 이고 호출자가 뮤텍스를 만든 경우 호출 스레드는 뮤텍스 개체의 초기 소유권을 얻는다. 그렇지 않으면 호출 스레드는 뮤텍스의 소유권을 얻지 못..
-
Dreamhack - Inject ME!!!wargame/Dreamhack 2024. 8. 5. 00:19
[LEVEL 1 - Inject ME!!! - reversing] 문제 설명을 보면, 문제 파일에서 주어진 prob_rev.dll 파일과 함께 있는 TXT 파일에는 조건을 맞춰서 DLL을 로드시키면 플래그를 얻을 수 있다고만 쓰여져 있었다고 한다.문제를 풀고 나서 보니 이 문장 자체가 문제 힌트다. ida로 해당 dll을 열어서 디컴파일하면 위와 같이 DllMain함수를 볼 수 있다. 함수로 들어오면 위와 같이 디컴파일되는데, 모르는 함수들은 검색을 하자. 구글링하면서 대략적으로 이 함수가 전체적으로 무엇을 하는지 주석을 달아 정리해보았다. 밑쪽에 sub_180001060 함수는 자신의 반환값과 v5~v8을 xor연산하고 결과값 중 Text를 메시지박스로 출력하는데, 이것이 곧 플래그값일 ..
-
Dreamhack - Secure Mailwargame/Dreamhack 2024. 8. 4. 23:58
[LEVEL 1 - Secure Mail - reversing] 문제파일을 다운로드 받으면 html 파일이 하나 있는데, 비밀번호 생년월일 6자리를 알아내면 플래그값을 알 수 있는 문제다. 일단 vs code로 열어서 소스코드 내용을 확인해본다. 보니까 생년월일 비번 제출하는 Confirm 버튼에 onclick()으로 0x9a220함수가 있는데 이걸 Ctrl+F로 검색해본다. 위쪽에 이 함수가 사용되는 것을 볼 수 있다. 그런데 이 코드를 다 해석하는 건 비효율적으로 보인다. 브루트포싱이 나을 것 같다. html태그 나오기 바로 전에 script태그 끝나는 부분이 있었는데 여기에 보면 틀릴 때마다 wrong을 alert창으로 띄우는 걸 볼 수 있다. 브루트포싱할 때마다 alert창이 ..
-
Dreamhack - rev-basic-8wargame/Dreamhack 2024. 7. 23. 22:13
[LEVEL 1 - rev-basic-8 - reversing] 1단계 문제 중에서는 rev-basic 시리즈 마지막 문제다. 메인함수 ida로 디컴파일하면 이전 문제들과 동일하게 생겼다. -5가 좀 이상해 보여서 커서 올려놓고 h 눌러서 헥스값으로 바꿔본다. 그러면 0xFB가 나오는데 이건 251이다.rev-basic-4 문제와 개념적으로 조금 비슷한 문제인 것 같다. byte_140003000을 더블클릭해서 어떤 데이터가 들어있는지 확인한다. Hex View탭으로 가서 복사해오기 이전 문제들과 다르게 헷갈리는 부분이 있어서 드림핵 해당 문제 커뮤니티 페이지에 있는 댓글을 참고했고, 위와 같이 코드를 작성하기 위해 짚고 넘어가야 할 것은 아래와 같다. 16진수 바이트로 표현..
-
Dreamhack - rev-basic-6wargame/Dreamhack 2024. 7. 23. 20:19
[LEVEL 1 - rev-basic-6 - reversing] 이 문제도 마찬가지로 입력값이 맞으면 Correct, 틀리면 Wrong을 출력하는 프로그램이 주어진다. 메인함수를 ida로 디컴파일한 모습이다. 이 함수를 참고해서 역으로 입력값이 무엇이 되어야 하는지 계산해야 한다.조건문 안에 있는 문장을 해석해 보면, 결국 아래를 만족하는 a1을 찾아야 한다.byte_140003020[a1] == byte_140003000[i] 먼저 byte_140003000을 들어가면 위와 같은 데이터를 볼 수 있다. 다음으로, byte_140003020을 들어가면 위와 같은 데이터를 볼 수 있다. ida의 Hex View 탭에서 그대로 복사할 수 있다. vs code에 붙여넣은 다음, 열..
-
Dreamhack - simple-operationwargame/Dreamhack 2024. 7. 17. 20:36
[Beginner - simple-operation - reversing] 일단 문제 파일을 다운로드 받으면 chall과 flag 이렇게 두 개의 파일이 있다. chall 파일을 ida로 열면 위와 같이 main()을 디컴파일 할 수 있다.여기서 알 수 있는 것은 랜덤값과 사용자의 입력값을 xor연산한 후, 이것을 거꾸로 한 것이 a0b4c1d7이 나와야 flag를 알 수 있다는 것이다.그리고 주의할 것은 입력값이 "%d"가 있어서 10진수라는 것이다. 결론적으로 xor한 값이 7d1c4b0a여야 하는 것이다.랜덤값 ^ 입력값 = 7d1c4b0a면, 입력값 = 랜덤값 ^ 7d1c4b0a도 성립하기 때문에 위와 같이 입력해야 하는 값을 구하는 코드를 짠다. 이제 우분투에서 nc로 문제 환경에 ..
-
Dreamhack - rev-basic-4wargame/Dreamhack 2024. 7. 17. 19:14
[LEVEL 1 - rev-basic-4 - reversing] 이전 문제와 동일하게 입력값을 검증해 맞으면 correct, 틀리면 wrong을 출력하는 프로그램이 주어진다. 똑같이 IDA로 열고 main() 디컴파일 했고, 이번엔 시프트연산을 하는 함수가 있어서 위와 같이 함수명을 변경했다. 시프트 연산을 하는 해당 함수를 들어가보면 위와 같고, 여기서 16을 곱하는 건 4비트 왼쪽 시프트 연산을 하는 것과 같다. 마찬가지로 byte_140003000을 들어가보면 위와 같이 나온다. 이걸 이용해 코드를 짜면 된다. 배열에 넣은 후, 4비트 왼쪽 시프트 연산으로 바꿔주고, 16진수의 바이트(8비트)만 사용하도록 % (16 * 16)을 해주었다. 이는 & 0xFF와 같다. C언어 소..