capt-meelo / ntcreateuserprocess Goto Github PK
View Code? Open in Web Editor NEWMinimal PoC developed as discuss in https://captmeelo.com/redteam/maldev/2022/05/10/ntcreateuserprocess.html
Minimal PoC developed as discuss in https://captmeelo.com/redteam/maldev/2022/05/10/ntcreateuserprocess.html
hello,
sorry if I open an issue for discussion.
I am studying NtCreateUserProcess for practice, work and personal study.Thanks to your contribution I was able to understand a few things and I thank you for your article and code.
After banging my head for two days, however, I was unable to do one thing:
I would like to start a terminal application within the same console but instead it always opens a new window.
An example to try is if I run "powershell", I would like it to run in the same context as the execution console.
With your experience, do you have something in mind where I could look?
First I'd like to thank you for your great article! It was really interesting and inspiring to read and follow.
Next, I'd like to report kind of an interesting behaviour, maybe helpful for anyone who comes with a same problem.
I've tried to launch different programs and noticed that it's impossible to start any EXE from outside System32
folder. E.g. you can't launch \\??\\C:\\Windows\\notepad.exe
, NtCreateUserProcess
returns STATUS_OBJECT_PATH_INVALID
. Interestingly, on Wine the same executable works and launches notepad successfully, so I think it has to do something with very deep NT internal stuff.
This project is very cool,But my attempt to start a process with arguments failed,Even though I didn't succeed after reading your blog posts
int main()
{
// Path to the image file from which the process will be created
UNICODE_STRING NtImagePath;
RtlInitUnicodeString(&NtImagePath, (PWSTR)L"\\??\\C:\\Windows\\System32\\cmd.exe");
// Create the process parameters
PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL;
UNICODE_STRING us;
RtlInitUnicodeString(&ProcessParameters->CommandLine, (PWSTR)L"\C:\\Windows\\System32\\cmd.exe /c calc.exe");
RtlCreateProcessParametersEx(&ProcessParameters, &NtImagePath, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, RTL_USER_PROCESS_PARAMETERS_NORMALIZED);
// Initialize the PS_CREATE_INFO structure
PS_CREATE_INFO CreateInfo = { 0 };
CreateInfo.Size = sizeof(CreateInfo);
CreateInfo.State = PsCreateInitialState;
// Initialize the PS_ATTRIBUTE_LIST structure
PPS_ATTRIBUTE_LIST AttributeList = (PS_ATTRIBUTE_LIST*)RtlAllocateHeap(RtlProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PS_ATTRIBUTE));
AttributeList->TotalLength = sizeof(PS_ATTRIBUTE_LIST) - sizeof(PS_ATTRIBUTE);
AttributeList->Attributes[0].Attribute = PS_ATTRIBUTE_IMAGE_NAME;
AttributeList->Attributes[0].Size = NtImagePath.Length;
AttributeList->Attributes[0].Value = (ULONG_PTR)NtImagePath.Buffer;
// Create the process
HANDLE hProcess, hThread = NULL;
NtCreateUserProcess(&hProcess, &hThread, PROCESS_ALL_ACCESS, THREAD_ALL_ACCESS, NULL, NULL, NULL, NULL, ProcessParameters, &CreateInfo, AttributeList);
// Clean up
RtlFreeHeap(RtlProcessHeap(), 0, AttributeList);
RtlDestroyProcessParameters(ProcessParameters);
}
According to the article, you only need to set the CommandLine field of ProcessParameters as a parameter, but I failed. Could you please help me? Thank you very much!
Hello!
CreateProcess don't work, write "invalid parameter". Can you give me .exe for debug?? Windows 10 x64
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.