포렌식/CTF
OtterCTF 2018 Recovery
CHIqueen
2018. 12. 14. 16:48
Rick got to have his files recovered! What is the random password used to encrypt the files?
랜섬웨어에서 password관련 함수들을 찾아보면
CreatePassword()와 SendPassword(), startAction()이 있습니다.
public string CreatePassword(int length)
{
StringBuilder stringBuilder = new StringBuilder();
Random random = new Random();
while (0 < length--)
{
stringBuilder.Append("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890*!=&?&/"[random.Next("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890*!=&?&/".Length)]);
}
return stringBuilder.ToString();
}
public void SendPassword(string password)
{
string text = string.Concat(new string[]
{
this.computerName,
"-",
this.userName,
" ",
password
});
}
public void startAction()
{
string password = this.CreatePassword(15);
string str = "\\Desktop\\";
string location = this.userDir + this.userName + str;
this.SendPassword(password);
this.encryptDirectory(location, password);
this.messageCreator();
}
SendPassword함수에서 password를 얻을 수 있는 힌트를 제공해 줍니다.
computerName과 userName 을 알아내면 되는데
이는 1번과 2번 에서 얻었습니다. Rick, WIN-LO6FAF3DTFE
* 블로그에 적지는 않았지만 1번에서 mimikatz를 돌리면 비밀번호도 나오지만 사용자 유저의 이름도 같이 나옵니다.
따라서 우리는 WIN-LO6FAF3DTFE-Rick을 메모리에서 grep으로 찾으면 됩니다.
$ vol.py -f OtterCTF.vmem --profile=Win7SP1x64 memdump -p 3720 -D ./
Volatility Foundation Volatility Framework 2.6
************************************************************************
Writing vmware-tray.ex [ 3720] to 3720.dmp
$ strings -el 3720.dmp | grep WIN-LO6FAF3DTFE-Rick
WIN-LO6FAF3DTFE-Rick aDOBofVYUNVnmp7
* -el의 의미
* .NET에서는 UTF-16 인코딩(UnicodeEncoding 클래스로 표시)을 사용하여 문자와 문자열을 나타냅니다.
* https://docs.microsoft.com/ko-kr/dotnet/standard/base-types/character-encoding
CTF{aDOBofVYUNVnmp7}