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的博客 468

Windows 远程控制之 PsExec

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

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

横向远程命令执行——PSEXEC

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

SheXinK’s Blog 1166

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

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

测试开发小记 5899

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

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

PixelLoom的博客 1198

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

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

weixin_42599558的博客 2041

横向渗透之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 以及一些常见的用法和注意事项。

孙大圣的博客 4745

AST实战:解密Akamai混淆JS代码的完整流程

本文详细解析了如何使用AST技术解密Akamai混淆的JS代码,包括定位关键代码、AST解混淆实战步骤及常见问题解决方案。通过实际案例演示了从混淆代码到清晰逻辑的完整处理流程,并提供了工具推荐和法律合规建议,帮助开发者有效应对反爬虫技术。

weixin_33725722的博客 326

保姆级教程:彻底清理Win11更新缓存并解除外设,一次搞定0xc1900101更新错误

本文提供了一套完整的Win11更新报错0xc1900101解决方案,涵盖软件环境净化和硬件设备隔离。通过终止干扰进程、重置更新组件、清理临时文件以及断开外设等步骤,有效提升更新成功率。特别强调外设驱动兼容性对解决0xc1900101错误的关键作用。

weixin_33483304的博客 423

psexec实现控制多台电脑的cmd

psexec实现控制多台电脑的cmd

lilien的博客 1352

HFSS 3D Layout一键导入PCB,高效搞定微带线损耗仿真

在高速PCB设计中,信号完整性与电磁仿真是确保链路质量的关键环节。传统的HFSS手动建模流程繁琐且极易出错,尤其面对微带线、带状线等高频结构时,叠层参数、铜箔粗糙度等细节难以精准还原,导致仿真结果与实测偏差较大。HFSS 3D Layout模块提供了从EDA工具直接导入PCB文件的能力,完整保留走线、过孔、叠层及材料属性,结合精确的介质损耗模型与端口设置,大幅缩短建模时间并提升仿真精度。该技术广泛应用于DDR、SerDes等高速数字链路的设计验证,以及SI/PI工程师对PCB损耗性能的快速评估。本文从导入操

weixin_29191081的博客 264

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

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

m0_57836225的博客 2644

具身智能数据采集的工程化指南:从时间同步到质量校验

具身智能的模型训练离不开高质量的多模态轨迹数据,而数据采集并非简单的传感器记录。真实场景中,相机图像、机械臂关节状态与力觉信息必须在时间轴上精确对齐,标定的漂移和格式混乱会让看似正常的数据无法用于训练。时间同步与标定一致性,是决定数据质量的核心技术环节。在机器人抓取、操作等工程应用中,一套包含多传感器同步、轻量记录脚本、自动化质量校验与版本管理的数据采集流程,能大幅降低数据生产的失败率。本文从工程视角拆解具身数据采集中的典型问题,并给出可落地的流程设计与校验方法,帮助团队构建可持续迭代的高质量数据集。

weixin_30603633的博客 511

AI 边缘计算控制器GEAC91

AI 边缘计算控制器GEAC91是AI边缘计算控制器是一款基于 NVIDIA Jetson AGX Xavier处理 器、面向智能边缘计算应用场景的解决方案。

weixin_45905610的博客 1210

如何使用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的博客 2839

keras tensorflow 的lstm的新冠疫情感染人数预测 附完整代码数据 可直接运行

keras tensorflow 的lstm的新冠疫情感染人数预测 附完整代码数据 可直接运行

853

PsExec的使用

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

weixin_45007073的博客 9512

05 Transformer 到底解决了什么问题

Transformer 是现代大语言模型的底层骨架。本文不推公式,而是从 CNN、RNN/LSTM 的瓶颈讲起,解释 Transformer 如何通过自注意力同时解决长距离依赖和并行训练问题,并说明它为什么能支撑 GPT、BERT 和现代大模型的规模化。

老于的笔记的专栏 254

基于Simulink的单级式光伏并网系统MPPT控制仿真

本文基于Simulink平台,详细介绍了单级式光伏并网系统的MPPT控制仿真实现。主要内容包括:1)阐述MPPT作为光伏系统"智能大脑"的核心作用;2)解析单级式系统架构及扰动观察法(P&O)算法原理;3)以10kW户用系统为例,分步骤演示建模过程,包括光伏阵列搭建、P&O控制器实现(含MATLAB代码)、并网控制设计等;4)通过仿真验证系统在光照突变下的动态响应性能,MPPT效率达98.3%。文章还提出了变步长P&O等优化方向,为光伏系统仿真与控制提供实用指导。

xiaoheshang_123的博客 113

Psexec使用方式

Psexec使用方式

bring_coco的博客 5531

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

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

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

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

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

内网横移之PsExec

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

Canterlot的博客 1879

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

上一篇: 使用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、付费专栏及课程。

余额充值
⌂ 换网址