> For the complete documentation index, see [llms.txt](https://dmcxblue.gitbook.io/red-team-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dmcxblue.gitbook.io/red-team-notes/execution/trusted-developer-utilities/msbuild.md).

# MSBuild

Let's get some examples here we can add powershell code onto an XML file have msbuild compile it and execute to call a shell back to us this will automate the process to leverage the MSBuild technique to input a powershell payload into an inline-task XML file that can be launched.

{% embed url="<https://gist.github.com/mgeeky>" %}

I continued with the use of this tool for creating shell's using msbuild and converting the file into an XML format perfect use for MSBuild.

![](/files/-LxYEuRrcRRDjZAea7Fr)

Let's copy this onto our victim machine

We can see that we saved the z.xml file onto the machine (This name can be whatever) . From here we will need to move onto the MSBuild directory and load the executable

![z.xml](/files/-LxYNGpFJlOG6VT__o3k)

![MSBuild Path](/files/-LxYNTKIIaDYIutARlpw)

&#x20;Let's use MSBuild to execute our XML File

![](/files/-LxYTPpQFcq0R8XfVOLs)

We can also execute csproj files as MSBuild compiles these as well.

This tool uses techniques  that are already published as stated on the README `This script will generate payloads for basic intrusion detection avoidance. It utilizes publicly demonstrated techniques from several different sources.`
