[笔记] 关于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);
}
相关推荐
蓝田生玉12325 分钟前
qwen2.5论文阅读笔记
论文阅读·笔记
xw-busy-code2 小时前
抽象语法书学习笔记
笔记·学习·ast·抽象语法树
小羊羔heihei2 小时前
Python编程实战:12道趣味算法题
笔记·python·学习·其他·算法·学习方法·交友
鸽子一号3 小时前
c#笔记之接口和抽象类
笔记
小羊羔heihei3 小时前
Python列表操作全攻略
经验分享·笔记·python·学习·其他·交友
mo_alo4 小时前
Everything Claude Code 完全指南:给 Claude Code 装上涡轮增压【安装和使用超详细教程!!!】
笔记·embedding·ai编程·claude·ecc
kyq___4 小时前
环路稳定性补偿学习笔记
笔记·学习
CyrusCJA4 小时前
日语零基础每天学习笔记【11-20】
笔记·学习
oi..4 小时前
Flag入门—Flag在返回包中
网络·笔记·测试工具·安全·网络安全