CTF - Black Tuesday
해당 문제는 Github의 MemLabs의 Black Tuesday 문제에 대한 풀이입니다.
1. Challenge description
We received this memory dump from our client recently. Someone accessed his system when he was not there and he found some rather strange files being accessed. Find those files and they might be useful. I quote his exact statement,
The names were not readable. They were composed of alphabets and numbers but I wasn't able to make out what exactly it was.
Also, he noticed his most loved application that he always used crashed every time he ran it. Was it a virus?
Note-1: This challenge is composed of 3 flags. If you think 2nd flag is the end, it isn't!! :P
Note-2: There was a small mistake when making this challenge. If you find any string which has the string "L4B_3_D0n3!!" in it, please change it to "L4B_5_D0n3!!" and then proceed.
Note-3: You'll get the stage 2 flag only when you have the stage 1 flag.
2. 풀이
해당 문제는 volatility를 통해 분서을 해야 하므로 해당 이미지의 정보를 확인한다.
명령어: .\volatility_2.6_win64_standalone\volatility_2.6_win64_standalone.exe -f .\MemLabs-Lab5\MemoryDump_Lab5.raw imageinfo
imageinfo에서는 많은 Profile을 제안해준다. 하지만 크게 생각할 것 없이 가장 처음 것을 사용해준다.
일단 실행된 프로세스를 확인하기 위해 pslist plugin을 사용해보자
명령어: .\volatility_2.6_win64_standalone\volatility_2.6_win64_standalone.exe -f .\MemLabs-Lab5\MemoryDump_Lab5.raw --profile=Win7SP1x64 pslist > pslsit.log
여기에 있는 프로세스들이 가장 의심스러워보인다. 먼저 지난번에 사용해봤던 WinRAR.exe를 가장 먼저 의심했다.
그래서 filescan을 통해 .rar 확장자로 끝나는 것을 검색하니 아래와 같이 하나가 나왔다.
명령어: .\volatility_2.6_win64_standalone\volatility_2.6_win64_standalone.exe -f .\MemLabs-Lab5\MemoryDump_Lab5.raw --profile=Win7SP1x64 filescan > filescan.log
이것을 추출하여 WinRAR.exe에 넣어보자
명령어: .\volatility_2.6_win64_standalone\volatility_2.6_win64_standalone.exe -f .\MemLabs-Lab5\MemoryDump_Lab5.raw --profile=Win7SP1x64 dumpfiles -Q 0x000000003eed56f0 -D .\memlabs\
이것은 Stage2에 대한 것 같다. 그럼 다시 Stage1을 풀어야 한다.
후에 이것저것 다 시도해보고 꼼꼼하게 다 살펴봤지만 답이 안나오다가 이전 글에서 iehistory iehistory plugin을 사용해서 풀어야 했었기에 최종적으로 시도를 해봤다.
명령어: .\volatility_2.6_win64_standalone\volatility_2.6_win64_standalone.exe -f .\MemLabs-Lab5\MemoryDump_Lab5.raw --profile=Win7SP1x64 iehistory > iehistory.txt
뭔가 엄청 base64로 디코딩 하고싶게 생긴 애가 있다. 이것을 디코딩 해보자.
stage1 flag가 나왔다.
이것을 아까 WinRAR에서의 패스워드란에 넣어보자.
이제 마지막 flag만 남았다. 뭔가 계속 살펴보다가 pslist에 notepad.exe가 계속 걸렸다.
이제 마지막 flag를 풀어야 했다.
마지막 flag는 몇시간동안 고민하고 삽질해도 답이 나오지 않아 write up을 볼 수 밖에 없었다.
procdump를 사용해서 notetpad를 추출하고
답은 ida tool을 사용하는 방법이였다.
명령어: .\volatility_2.6_win64_standalone\volatility_2.6_win64_standalone.exe -f .\MemLabs-Lab5\MemoryDump_Lab5.raw --profile=Win7SP1x64 procdump -p 2724 -D .\memlabs\
flag: bi0s{M3m_l4B5_OVeR_!}
ida 사용까지 생각을 하나도 못했기 때문에 좀 아쉽긴 하지만 ida를 사용해서 풀어야하는 문제도 있구나라고 깨달은 문제여서 끝까지 못풀었어도 만족한 문제