[笔记] 关于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);
}
相关推荐
杨小扩10 小时前
OpenAI Codex CLI 命令行参考笔记
人工智能·笔记
做cv的小昊11 小时前
大语言模型系统:【CMU 11-868】课程学习笔记06——Transformer学习(Transformer)
笔记·学习·语言模型
Vae_Mars13 小时前
华睿MVP:C#脚本的应用一
笔记·c#
_muffinman13 小时前
Java学习笔记-第2章 运算和语句
java·笔记·学习
六元七角八分13 小时前
学习笔记一《JavaScript基础语法》
javascript·笔记·学习
风酥糖14 小时前
在Termux中运行Siyuan笔记服务
android·linux·服务器·笔记
跃龙客14 小时前
C++写文件笔记
c++·笔记
宵时待雨14 小时前
C++笔记归纳11:多态
开发语言·c++·笔记
李昊哲小课15 小时前
NumPy 完整学习笔记
笔记·python·学习·数据分析·numpy
Jasminee15 小时前
SSH 服务攻防实战
笔记·安全