PsExec Internals

横向移动检测之远程执行(一)PsExec 横向移动——PsExec远程执行分析及溯源 阅读详情

Abstract: This is a short reversing review of one interesting tool from Mark Russinovich (www.sysinternals.com). Here is a short description from utility homepage: "Utilities like Telnet and remote control programs like Symantec's PC Anywhere let you execute programs on remote systems, but they can be a pain to set up and require that you install client software on the remote systems that you wish to access. PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems." You may read this and download the utility from the following link: http://www.sysinternals.com/ntw2k/freeware/psexec.shtml . Actually, I had requests before from System Administrators regarding possibility to start programs on remote system without installing any additional software on it. That's why this tool appeared to be very interesting for me. Regretfully, Mark did not give any tips of how this utility works, so one pretty Sunday (the weather was pretty awful outside) I've fired up IDA and looked inside this tool.

"All genius appear simple..."

First of all I've found that psexec.exe contains embedded binary resource PSEXESVC, that is actually a PE-executable, more exact it's a Win32 service. Some initial reversing of PSEXESVC discovered that this is a server part of utility responsible for starting processes and redirecting I/O to/from client system. However, lets start from very beginning and describe what psexec.exe do in sequence.

As it expected first things utility do is checking host operating system and parameters validity, an example if the application to copy and execute exists on the host system. I think here is no need to describe this part in details, any programmer working over console application do the same things (again and again in endless loop...).

After parameters validated psexec obtains pointer and size of PSEXESVC resource:

HRSRC hSvc = FindResource (NULL, "PSEXESVC", "BINRES" );
   if ( !hSvc ) return 0; 
HGLOBAL hGbDesc = LoadResource (NULL, hSvc); 
DWORD dwSvcSize = SizeofResource (NULL, hSvc); 
PBYTE pPsExeSvc = LockResource (hGbDesc); 

Then creates file in "//RemoteSystemName/ADMIN$/System32" named PSEXESVC.EXE and saves resource into it. If there is no existing session with permissions to access RemoteAdmin(ADMIN$) share it tries to establish new session using username and password specified in command line via call to WNetAddConnection2 as following:

DWORD
   PsExecRemoteLogon (
   LPCSTR lpComputerName,
   LPCSTR lpUserName,
   LPCSTR lpPassword
   )
   {
	char szFullPath [_MAX_PATH];
	NETRESOURCE NetResource;
	sprintf (szFullPath, "////%s//IPC___FCKpd___1quot;);
	// Initialize NetResource structure, omitted here
	...
	return (NO_ERROR == 
		WNetAddConnection2 (
			&NetResource, 
			lpPassword, 
			lpUserName, 
			0)
		);
   } 

If no error happen we have PSEXESVC.EXE in //SystemRoot/System32 folder on remote system. Note, if the executable to start remotely must be copied to the remote system, it will be also placed into that folder. After this psexec.exe install and start PSEXESVC service using SCM API (OpenSCManager, CreateService, StartService). Full description of these calls in source would take pretty much place, and I don't see much need to do this.

After start PSEXESVC creates named pipe "psexecsvc", and start reading messages from it. For this moment we have server part installed and started on remote system, ready to accept command messages. All other work is typical for client/server applications (for better understanding of writing server applications I strongly recommend Jeffrey Richter, Jason D.Clark "Programming Server-Side Applications for MS Windows 2000"). So psexec.exe copies executable to start to remote system if necessary, opens psexecsvc pipe on remote host (CreateFile), fill in message structure with necessary parameters (command line arguments, username&password if specified and etc...) and sends it into //RemoteSytem/pipe/psexecsvc (TransactNamedPipe API call).

On receiving this message PSEXESVC creates three named pipes instances "psexecsvc-app_name-app_instance-stdin", "psexecsvc-app_name-app_instance-stdout", "psexecsvc-app_name-app_instance-stderr". As you may suspect psexec.exe connects to each of these pipes and creates separate threads to work with each one. Using console functions (GetStdHandle, ReadConsole, WriteConsole and etc..) standard I/O streams (input, output, error) redirected to/from remote system through previously mentioned named pipes.

On exiting application psexec.exe stops and uninstall PSEXESVC service, removes it's binary from remote host and removes console executable if it was copied.

As a result you have telnet like application with extensive use of Windows NT/2000 features, it can be effectively used by system administrators for common administration tasks. The only hole (mentioned on utility homepage) is security: "If you omit a username the remote process runs in the same account from which you execute PsExec, but because the remote process is impersonating it will not have access to network resources on the remote system. When you specify a username the remote process executes in the account specified, and will have access to any network resources the account has access to. Note that the password is transmitted in clear text to the remote system". As you can see this tool is dangerous to use for remote administration via Internet or sometimes even in corporate network (as dangerous as telnet an example). One of the possible extension for this tool would be securing communication of psexec and psexesvc with encryption. However, in combination with IPSEC (if IP used as transport for CIFS) it can be successfully used even today.

横向渗透之PsExec工具使用 psexec(微软官方工具)可以躲避检测无视杀毒软件,直接system权限 PsExec是一个轻量级的telnet替代品,它允许您在其他系统上执行进程, 并为控制台应用程序提供完整的交互性,而无需手动安装客户端软件。 PsExec的基本原理是: 通过管道在远程目标机器上创建一个psexec服务, 并在本地磁盘中生成一个名为PSEXESVC的二进制文件, 然后通过psexec服务运行命令,运行结束后删除任务。 利用条件 445端口开放, 知道目标账号密码 PsExec下载地址 优点:可以躲避检测无视杀毒软件 阅读详情

相关推荐

Windows AD域渗透实战全流程与蓝队防护指南:从攻击链到纵深防御

Active Directory(AD)作为企业内网的核心身份认证与资源管理服务,其安全性至关重要。理解其背后的Kerberos、NTLM、LDAP等协议原理,是构建有效攻防能力的基础。从攻击者视角看,AD域渗透遵循标准的杀伤链,涵盖信息收集、权限提升、横向移动及持久化等环节,其中**mimikatz**、**BloodHound**等工具常被用于凭据提取与攻击路径分析。而从防御者视角,则需要基于对攻击技术的深刻理解,部署日志监控、强化组策略、实施最小权限原则,并利用EDR等工具构建检测与响应能力。本文通过

dgoh41514的博客 467

Windows 远程控制之 PsExec

PsExec 是一种轻量级 telnet 替代品,可让你在其他系统上执行进程,并为控制台应用程序提供完整交互性,而无需手动安装客户端软件。PsExec 最强大的用途包括在远程系统上启动交互式命令提示符,以及 IpConfig 等远程启用工具,否则无法显示有关远程系统的信息。远程打开 cmd 命令。

一直被模仿,从未被超越 6339

横向远程命令执行——PSEXEC

横向远程命令执行——PSEXEC1、 测试环境2、 PSEXEC命令执行2.1 psexec.exe   PsExec 是一个轻型的 telnet 替代工具,它使您无需手动安装客户端软件即可执行其他系统上的进程,并且可以获得与控制台应用程序相当的完全交互性。PsExec 最强大的功能之一是在远程系统和远程支持工具(如 IpConfig)中启动交互式命令提示窗口,以便显示无法通过其他方式显示的有关远...

SheXinK’s Blog 1164

Windows远程执行进程工具psexec和wmiexec介绍

在自动化测试或者自动化工具开发中,通常需要向其它电脑或者服务器发送指令,比如Windows发送命令到Linux服务器开启某个服务进程,或者读取状态信息,我们可以使用ssh协议实现。如果Windows主机需要发送命令到局域网内的其它Windows电脑要如何实现呢?在网络安全中称为横向移动的内网渗透方法可实现远程执行命令,横向移动工具有很多,本文介绍psexec和wmiexec这两个工具如何实现远程执行进程。

测试开发小记 5896

psexec工具探析:一窥编程之道

psexec工具的强大之处在于其能够通过网络连接到远程计算机,并在其中运行指定的程序。本文将深入浅出地剖析psexec工具的使用,并辅以相关源代码,旨在帮助读者更好地理解和应用该工具。参数,我们可以将本地计算机上的程序复制到远程计算机,并在其中运行。参数,psexec工具允许将远程程序的输出结果导出到本地计算机。除了基本的命令行执行功能外,psexec工具还提供了一些高级用法,以满足更复杂的管理需求。此命令将远程计算机连接后,在其中启动一个命令行窗口,并执行指定路径下的批处理脚本。

PixelLoom的博客 1197

PsExec工具:Windows系统管理的强大远程执行工具

PsExec是一款由微软Sysinternals提供的强大工具,它允许IT专业人员通过网络远程执行程序和命令。其小巧、易用的特性使它成为系统管理员和网络工程师在处理多台计算机时的首选工具。PsExec支持Windows环境,并且不需要额外安装,仅需复制到目标机器即可运行。它的设计初衷是简化IT管理和故障排除的过程,但使用时需要谨慎,因为不当操作可能会对系统安全构成威胁。在本章中,我们将介绍PsExec的基础知识,并通过实际案例向读者展示它的基本功能和操作方法。

weixin_42599558的博客 2024

横向渗透之PSExec、SMBExec和WMIExec的使用及特征

支持单向、双向通信。攻击者通过PSEXEC连接到远程机器并通过命名管道执行命令,命名管道是通过一个随机命名的二进制文件创建的,这个文件被写入到远程机器上的ADMIN$共享,最后通过SVCManager用来创建服务。建立连接之后,我们执行notepad.exe,可以发现它卡在这了,这因为我们在等待远程机器的输入,然而它永远不会输入。首先我们通过PSEXEC去横向的时候,这里上传了一个文件名字叫SBxFixsS.exe的文件,也就是说将这个文件写入到了远程机器的ADMIN$共享中,我们可以查看一下共享目录。

weixin_65550121的博客 3691

psexec

可以实现用system用户登陆系统的工具,用法:结束explorer进程后,在cmd中执行:PsExec -i -s -d explorer

使用PsExec工具

PsExec 是 Sysinternals 工具套件中的一部分,它可以让你在网络中的其他计算机上执行命令。使用 PsExec,管理员可以执行脚本、应用程序或其他命令,而无需手动在目标计算机上登录。下面详细介绍如何使用 PsExec 以及一些常见的用法和注意事项。

孙大圣的博客 4711

语言随机效应模型_线性混合效应模型 VS 方差分析

线性混合效应模型相比方差分析具有很多优点。为了让大家更直观的了解,我们来做一下两者的对比。基于模拟的方法,生成了以下数据dat_sim:这种数据格式是长格式,也就是从实验软件导出来的那种数据格式。这种数据格式可以直接使用线性混合效应模型进行分析。该实验设计是被试内项目间的单因素两水平设计。category是自变量,两个水平分别是outgroup和ingroup,outgroup比ingr...

weixin_31960565的博客 2688

华硕天选3 win11+ubuntu20.04双硬盘双系统配置(包括ubuntu重启后无法成功进入、没有wifi图标的设置)

1、制作系统盘 2、分区 3、重启电脑按F2

baidu_38431960的博客 1万+

psexec实现控制多台电脑的cmd

psexec实现控制多台电脑的cmd

lilien的博客 1351

用Arduino和FS-i6X遥控器,从零开始打造你的第一只仿生扑翼蝴蝶(附完整代码解析)

本文详细介绍了如何利用Arduino和FS-i6X遥控器从零开始制作仿生扑翼蝴蝶,包括硬件准备、电路连接、代码解析和调试技巧。通过完整的代码示例和参数说明,帮助读者快速掌握仿生机器人的制作要点,实现蝴蝶的自然飞行效果。

weixin_28727975的博客 309

内网横向移动:smbexec、psexec、wmiexec、sharpRDP 深度解析

内网横向移动旨在利用已获取的权限,在内部网络中从一台主机移动到另一台主机,以获取更多资源和权限。这一过程通常基于已有的漏洞利用、账号密码获取等操作,借助各种工具和技术实现。其重要性在于突破初始入侵点的限制,进一步深入目标网络,挖掘敏感信息、控制更多主机,从而对整个内网安全构成严重威胁。smbexec、psexec、wmiexec、sharpRDP 等工具在内网横向移动中发挥着重要作用,但同时也给内网安全带来了巨大挑战。及时更新系统和软件。

m0_57836225的博客 2640

OpenCV实战(1)——OpenCV与图像处理基础

OpenCV 是一个跨平台计算机视觉和机器学习库,实现了图像处理和计算机视觉方面的很多通用算法。本节将介绍 OpenCV 的基础知识,以及如何编译运行 OpenCV 程序,并介绍如何完成最基本的图像处理任务——读取、显示和保存图像。除此之外,鼠标事件和图形绘制也是 OpenCV 计算机视觉项目中常用的基本功能,本节介绍了如何使用这两个重要的 OpenCV 功能。

盼小辉丶的博客 12万+

YOLOv11改进 | Neck篇 | 双向特征金字塔网络BiFPN助力YOLOv11有效涨点

本文给大家带来的改进机制是BiFPN双向特征金字塔网络,其是一种特征融合层的结构,也就是我们本文改进YOLOv11模型中的Neck部分,它的主要思想是通过多层级的特征金字塔和双向信息传递来提高精度。本文给大家带来的结构可以让大家自行调节网络结构大小,同时能够达到一定的轻量化效果,为什么发BiFPN呢因为它算是YOLO系列改进中的常青树了,大家可以借鉴它的双向特征思想来创新自己的Neck结构本文的BiFPN通过yaml文件配置可以让大家自行调配其结构。

Snu77的博客 9101

如何使用Psexec工具运行命令并获取Shell远程Windows系统?

Windows operating system provides different ways to manage remote systems. Telnet, RDP, VNC are some of them. But these options are generally bound to a graphical user interface. If we prefer a comman...

cunjiu9486的博客 2835

手把手教你学PCIE(10.5)--PCIE故障排除方法的分步排查法介绍

通过以上分步排查法,你可以系统地诊断和解决 PCIe 设备的故障。每个步骤都有助于逐步缩小问题范围,最终找到并解决问题。

MHD0815的博客 1873

PsExec的使用

PsExec前言攻击过程使用psexec的注意事项Metasploit中的psexec模块 前言 PsExec是SysInternals套件中的一款强大的软件。攻击者通过命令行环境与目标机器进行连接,甚至控制目标机器,而不需要通过远程桌面协议(RDP)进行图形化控制,降低了恶意操作被管理员发现的可能性。 PsExec的基本原理是:通过管道在远程目标机器上创建一个psexec服务,并在本地磁盘中生成一个名为PSEXESVC的二进制文件,然后通过psexec服务运行命令,运行结束后删除任务。 攻击过程 首先我们

weixin_45007073的博客 9492

BLDC&PMSM电机控制器硬件设计工程(八)72V 10kW电机控制器原理图工程及库文件

电机控制器基本需求:接口类型;MCU平台;通信接口;供电;信号采集;信号输出;功率;EMC或者认证需求。

小幽余生不加糖 373

鸿蒙开发实战项目(九十二):HUAWEI Health血压测量

是华为开发的用于运动健康领域的一个开放平台, 三方APP可以借助HUAWEI Health开放平台提供的。

斌擎科技 1133

Psexec使用方式

Psexec使用方式

bring_coco的博客 5530

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

内网环境横向移动——利用psexec

如果是工作组环境,则必须使用administrator用户连接(因为要在目标主机上面创建并启动服务),使用其他账号(包括管理员组中的非administrator用户)登录都会提示访问拒绝访问。如果不使用该参数,会获得一个连接所用用户权限的shell。的使用不需要对方主机开方3389端口,只需要对方开启admin$共享 (该共享默认开启)。如果是域环境,即可用普通域用户连接也可以用域管理员用户连接。是在2008及以上的系统才有,在2008及以上的系统使用原生。的,那么在这种情况下我们就只能使用msf的。

星星我啊,已经很努力在学习了, 有人一起学习吗?Ziansec-1 2394

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

内网横移之PsExec

本文介绍了PsExec的运行原理,执行命令的工作过程,以及相关工具基本用法

Canterlot的博客 1879

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

上一篇: 使用VMWare+SoftICE的方法总结
下一篇: FWB information and questions
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值