MSbuild inline task using Visual Basic (#1371)

* add visual basic test

* correct comment
This commit is contained in:
Carrie Roberts
2021-01-20 16:26:45 -07:00
committed by GitHub
parent bc705cb7aa
commit 63d1e555d4
2 changed files with 59 additions and 1 deletions
+33 -1
View File
@@ -1,7 +1,7 @@
attack_technique: T1127.001
display_name: 'Trusted Developer Utilities Proxy Execution: MSBuild'
atomic_tests:
- name: MSBuild Bypass Using Inline Tasks
- name: MSBuild Bypass Using Inline Tasks (C#)
auto_generated_guid: 58742c0f-cb01-44cd-a60b-fb26e8871c93
description: |
Executes the code in a project file using msbuild.exe. The default C# project example file (T1127.001.csproj) will simply print "Hello From a Code Fragment" and "Hello From a Class." to the screen.
@@ -33,3 +33,35 @@ atomic_tests:
command: |
#{msbuildpath}\#{msbuildname} #{filename}
name: command_prompt
- name: MSBuild Bypass Using Inline Tasks (VB)
description: |
Executes the code in a project file using msbuild.exe. The default Visual Basic example file (vb.xml) will simply print "Hello from a Visual Basic inline task!" to the screen.
supported_platforms:
- windows
input_arguments:
filename:
description: Location of the project file
type: Path
default: PathToAtomicsFolder\T1127.001\src\vb.xml
msbuildpath:
description: Default location of MSBuild
type: Path
default: C:\Windows\Microsoft.NET\Framework\v4.0.30319
msbuildname:
description: Default name of MSBuild
type: Path
default: msbuild.exe
dependency_executor_name: powershell
dependencies:
- description: |
Project file must exist on disk at specified location (#{filename})
prereq_command: |
if (Test-Path #{filename}) {exit 0} else {exit 1}
get_prereq_command: |
New-Item -Type Directory (split-path #{filename}) -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1127.001/src/vb.xml" -OutFile "#{filename}"
executor:
command: |
#{msbuildpath}\#{msbuildname} #{filename}
name: command_prompt
+26
View File
@@ -0,0 +1,26 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This inline task executes c# code. -->
<!-- C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe vb.xml -->
<!-- Slight modification of an original script by Casey Smith, Twitter: @subTee -->
<!-- License: BSD 3-Clause -->
<Target Name="Hello">
<HelloWorld />
</Target>
<!-- This simple inline task displays "Hello from a Visual Basic inline task!" -->
<UsingTask
TaskName="HelloWorld"
TaskFactory="CodeTaskFactory"
AssemblyFile="C:\Windows\Microsoft.Net\Framework\v4.0.30319\Microsoft.Build.Tasks.v4.0.dll" >
<ParameterGroup />
<Task>
<Reference Include="System.Xml"/>
<Using Namespace="System"/>
<Using Namespace="System.IO"/>
<Code Type="Fragment" Language="vb">
<![CDATA[
System.Console.WriteLine("Hello from a Visual Basic inline task!")
]]>
</Code>
</Task>
</UsingTask>
</Project>