[笔记] 关于CreateProcessWithLogonW函数创建进程

函数介绍

https://learn.microsoft.com/zh-cn/windows/win32/api/winbase/nf-winbase-createprocesswithlogonw

cpp 复制代码
BOOL CreateProcessWithLogonW(
  [in]                LPCWSTR               lpUsername,
  [in, optional]      LPCWSTR               lpDomain,
  [in]                LPCWSTR               lpPassword,
  [in]                DWORD                 dwLogonFlags,
  [in, optional]      LPCWSTR               lpApplicationName,
  [in, out, optional] LPWSTR                lpCommandLine,
  [in]                DWORD                 dwCreationFlags,
  [in, optional]      LPVOID                lpEnvironment,
  [in, optional]      LPCWSTR               lpCurrentDirectory,
  [in]                LPSTARTUPINFOW        lpStartupInfo,
  [out]               LPPROCESS_INFORMATION lpProcessInformation
);

几种使用方法

使用存在的账号信息创建进程

使用空网络账号信息创建进程

所以即使账号信息实际不存在也可以创建进程,只是无权访问网络资源

cpp 复制代码
if (!CreateProcessWithLogonW(L"MalseclogonUser", L"MalseclogonDomain", L"MalseclogonPwd", LOGON_NETCREDENTIALS_ONLY, NULL, cmdline, 0, NULL, NULL, &startInfo, &procInfo)) {
	printf("CreateProcessWithLogonW() failed with error code %d \n", GetLastError());
} else {
	// the returned handles in procInfo are wrong and duped into the spoofed parent process, so we can't close handles or wait for process end.
	printf("Spoofed process %S created correctly as child of PID %d using CreateProcessWithLogonW()!", cmdline, pid);
}
相关推荐
JeffDingAI8 分钟前
【Datawhale学习笔记】动手学RNN及LSTM
笔记·rnn·学习
风之子npu1 小时前
CPU基础知识(1)
笔记
JeffDingAI1 小时前
【Datawhale学习笔记】预训练模型实战
笔记·学习
来生硬件工程师1 小时前
【PCB设计笔记】PCB布局时,如何快速互换器件位置?(Altium Designer 25)
笔记
ljt27249606611 小时前
Flutter笔记--ValueNotifier
笔记·flutter
阿豪只会阿巴1 小时前
项目心得——发布者和订阅者问题解决思路
linux·开发语言·笔记·python·ubuntu·ros2
Hello_Embed2 小时前
RS485 双串口通信 + LCD 实时显示(中断版)
c语言·笔记·单片机·学习·操作系统·嵌入式
宵时待雨3 小时前
数据结构(初阶)笔记归纳4:单链表的实现
c语言·开发语言·数据结构·笔记·算法
航Hang*3 小时前
第3章:复习篇——第4节:创建、管理视图与索引---题库
网络·数据库·笔记·sql·学习·mysql·期末
JeffDingAI3 小时前
【Datawhale学习笔记】NLP 概述
笔记·学习·自然语言处理