how to make a dll that will start calc when injected into a process
by solitaryElite - Friday September 29, 2023 at 03:41 PM
#1
hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.
Reply
#2
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

Don't know about C#, but you can check this out. It's in C++, it's very trivial but gets the job done. Try porting it to C# to have fun.

https://cocomelonc.github.io/tutorial/20...ion-7.html
Crypt files/Crypt files .NET [x64/x86] Native x86 WinDef Bypass - 0/26:
https://breachforums.hn/Thread-MALWARE-C...26-Avcheck


Reply
#3
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory
This forum account is currently banned. Ban Length: (Permanent)
Ban Reason: Scamming | Last IP: 172.7.7.248 | https://breachforums.hn/Forum-Ban-Appeals if you feel this is incorrect.
Reply
#4
(10-01-2023, 05:43 AM)succumb Wrote:
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory


Exactly. Tools like dnSpy undresses the code with no effort.
Crypt files/Crypt files .NET [x64/x86] Native x86 WinDef Bypass - 0/26:
https://breachforums.hn/Thread-MALWARE-C...26-Avcheck


Reply
#5
(10-01-2023, 05:43 AM)succumb Wrote:
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory

so in short , and am too tired to explain now but do your research, everything u said is wrong and/or outdated ideas.
Reply
#6
(10-23-2023, 01:51 AM)Vapulame Wrote:
(10-01-2023, 05:43 AM)succumb Wrote:
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory

so in short , and am too tired to explain now but do your research, everything u said is wrong and/or outdated ideas.

You said everything I said is wrong, yet these are the true basics of PE injection.
With this being said, there are various methods for PE injection, some of which are more basic than others.
Process Hallowing consists of creating the targeted process in a suspended state and then following up with injection.
ATOM Bombing is another method used for process injection.
UserApcInject() can also be utilized.

a code injection technique that leverages Native APIs NtCreateSection, NtMapViewOfSection and RtlCreateUserThread.


Section is a memory block that is shared between processes and can be created with NtCreateSection API
Before a process can read/write to that block of memory, it has to map a view of the said section, which can be done with NtMapViewOfSection
Multiple processes can read from and write to the section through the mapped views.

High level overview of the technique:
Create a new memory section with RWX protection.
Map a view of the previously created section to the local malicious process with RW protection.
Map a view of the previously created section to a remote target process with RX protection.
Note that by mapping the views with RW (locally) and RX (in the target process) we do not need to allocate memory pages with RWX, which may be frowned upon by some EDRs.
Fill the view mapped in the local process with shellcode. By definition, the mapped view in the target process will get filled with the same shellcode
Create a remote thread in the target process and point it to the mapped view in the target process to trigger the shellcode

Best Regards, skid.
This forum account is currently banned. Ban Length: (Permanent)
Ban Reason: Scamming | Last IP: 172.7.7.248 | https://breachforums.hn/Forum-Ban-Appeals if you feel this is incorrect.
Reply
#7
(10-01-2023, 05:43 AM)succumb Wrote:
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory

Not necessarily... but you sort of got the point across. <3
This forum account is currently banned. Ban Length: (Permanent)
Ban Reason: File an appeal
Reply
#8
This is exactly what you're looking for: https://github.com/CuckooEXE/PopCalc
Reply
#9
(10-25-2023, 02:08 AM)succumb Wrote:
(10-23-2023, 01:51 AM)Vapulame Wrote:
(10-01-2023, 05:43 AM)succumb Wrote:
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory

so in short , and am too tired to explain now but do your research, everything u said is wrong and/or outdated ideas.

You said everything I said is wrong, yet these are the true basics of PE injection.
With this being said, there are various methods for PE injection, some of which are more basic than others.
Process Hallowing consists of creating the targeted process in a suspended state and then following up with injection.
ATOM Bombing is another method used for process injection.
UserApcInject() can also be utilized.

a code injection technique that leverages Native APIs NtCreateSection, NtMapViewOfSection and RtlCreateUserThread.


Section is a memory block that is shared between processes and can be created with NtCreateSection API
Before a process can read/write to that block of memory, it has to map a view of the said section, which can be done with NtMapViewOfSection
Multiple processes can read from and write to the section through the mapped views.

High level overview of the technique:
Create a new memory section with RWX protection.
Map a view of the previously created section to the local malicious process with RW protection.
Map a view of the previously created section to a remote target process with RX protection.
Note that by mapping the views with RW (locally) and RX (in the target process) we do not need to allocate memory pages with RWX, which may be frowned upon by some EDRs.
Fill the view mapped in the local process with shellcode. By definition, the mapped view in the target process will get filled with the same shellcode
Create a remote thread in the target process and point it to the mapped view in the target process to trigger the shellcode

Best Regards, skid.

so i'll explain why i said you're ideas are either outdated and or wrong, and instead of taking the opportunity to search on your own what could be that you're missing, u decided to get hurt and paste in the most chat gpt like explanation of the oldest and most detected injection technique and end it with "best regards, skid" xDDDD lol , ok since u won't do your research , one of the things you're missing is u can litearlly invoke unmanaged code from managed code , so u can call those APIs from c# as if it's in C/C++, while u said "there's no way to call these APIs", another wrong thing u said "c# is bad for malware in general" all am gonna say is BRUUUH  xDD , also " this is because of the dependencies that it requires to run cross-platform. " this is what i was referring to as out dated , plz do ur own research i don't even have time for this .net does compile natively , and am not eeeeeven gonna get into dount and shellcode that will load the CLR which will run .net assemblies, take it in a good way u might learn smthing new am not trying to insult u ffs i just wanted to point out that some ideas are soo outdated and u might learn smthing new if u put those ideas aside

peace out , your friendly skid from the hood xDD
Reply
#10
(01-21-2024, 09:34 PM)Vapulame Wrote:
(10-25-2023, 02:08 AM)succumb Wrote:
(10-23-2023, 01:51 AM)Vapulame Wrote:
(10-01-2023, 05:43 AM)succumb Wrote:
(09-29-2023, 03:41 PM)solitaryElite Wrote: hey,
hopefully I'm allowed to ask questions here

does anyone have an idea of how to make a simple DLL (class library) in C# that will run calculator or run any shell command when injected into any process.

In malware development specifically C# is not a native language; Meaning that there are no way to natively make system calls.
The entire .NET framework in general is bad to write malware in, this is because of the dependencies that it requires to run cross-platform.
What you're looking for is simple PE injection, which can be down with a few simple calls in a native language like C or C++.
...
OpenProcess()
VirtualAllocEx()
WriteProcessMemory()

https://learn.microsoft.com/en-us/window...cessmemory

so in short , and am too tired to explain now but do your research, everything u said is wrong and/or outdated ideas.

You said everything I said is wrong, yet these are the true basics of PE injection.
With this being said, there are various methods for PE injection, some of which are more basic than others.
Process Hallowing consists of creating the targeted process in a suspended state and then following up with injection.
ATOM Bombing is another method used for process injection.
UserApcInject() can also be utilized.

a code injection technique that leverages Native APIs NtCreateSection, NtMapViewOfSection and RtlCreateUserThread.


Section is a memory block that is shared between processes and can be created with NtCreateSection API
Before a process can read/write to that block of memory, it has to map a view of the said section, which can be done with NtMapViewOfSection
Multiple processes can read from and write to the section through the mapped views.

High level overview of the technique:
Create a new memory section with RWX protection.
Map a view of the previously created section to the local malicious process with RW protection.
Map a view of the previously created section to a remote target process with RX protection.
Note that by mapping the views with RW (locally) and RX (in the target process) we do not need to allocate memory pages with RWX, which may be frowned upon by some EDRs.
Fill the view mapped in the local process with shellcode. By definition, the mapped view in the target process will get filled with the same shellcode
Create a remote thread in the target process and point it to the mapped view in the target process to trigger the shellcode

Best Regards, skid.

so i'll explain why i said you're ideas are either outdated and or wrong, and instead of taking the opportunity to search on your own what could be that you're missing, u decided to get hurt and paste in the most chat gpt like explanation of the oldest and most detected injection technique and end it with "best regards, skid" xDDDD lol , ok since u won't do your research , one of the things you're missing is u can litearlly invoke unmanaged code from managed code , so u can call those APIs from c# as if it's in C/C++, while u said "there's no way to call these APIs", another wrong thing u said "c# is bad for malware in general" all am gonna say is BRUUUH  xDD , also " this is because of the dependencies that it requires to run cross-platform. " this is what i was referring to as out dated , plz do ur own research i don't even have time for this .net does compile natively , and am not eeeeeven gonna get into dount and shellcode that will load the CLR which will run .net assemblies, take it in a good way u might learn smthing new am not trying to insult u ffs i just wanted to point out that some ideas are soo outdated and u might learn smthing new if u put those ideas aside

peace out , your friendly skid from the hood xDD

Well said.
This forum account is currently banned. Ban Length: (Permanent)
Ban Reason: File an appeal
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make a Trojan FUD? xyzuser 11 6,093 02-15-2025, 08:26 AM
Last Post: 1malware
  I don't where to start in malware development Qdam 1 532 12-28-2024, 06:05 AM
Last Post: JigglyPute
  What are some good ways to make money with a botnet uraniumeater 1 598 06-01-2024, 11:12 PM
Last Post: adjective
  Bypassing Firewall Through Process Injection - Downloader newpenaldo12 1 1,220 01-24-2024, 04:40 PM
Last Post: klamydia123

Forum Jump:


 Users browsing this thread: