A Study on .NET Framework for Red Team –
Part I
@ 若渴 2019.10.20
<ajblane0612@gmail.com>
AjMaChInE
Reference
[0] 2019, IronPython… OMFG Introducing BYOI
Payloads (Bring Your Own Interpreter)
[1] 2019, Common Language Runtime Hook for
Persistence
[2] 2019, .NET Manifesto
[3] 2019, Executing C# Assemblies from Jscript and
wscript with DotNetToJscript
[4] 2017, .NET HIJACKING to DEFEND POWERSHELL
[5] 2014, .NET Framework Rootkits
WSH – Window Script Host
DLR – Dynamic Language Runtime
CLR – Common Language Runtime
BYOI – Bring Your Own Interpreter
ADM – Application Domain Manager
MSIL – Microsoft Intermediate Language
[0]
[1]
[1]
BYOI – Bring Your Own Interpreter
[0]
[0]
[0]
WSH File Smuggling
Executing C# Assemblies from Jscript and
wscript with DotNetToJscript [3]
● WSH (Window Script Host)
● Embedded lanuage & binding, like .NET
● Jscript -> .NET
● File smuggling
● Jscript
– data (own assembly) -> save file -> load
file -> execution
Can it be used to reach file smuggling?
[2]
Persistence
CLR Profiler Dynamic DLL Hook Injection
Specifying the CLR environment
Defining the CLR Profiler
[4]
ModuleLoadFinished CLR Profiler for
Hooking
[4]
Common Language Runtime Hook for
Persistence [1] – Step 0
Common Language Runtime Hook for
Persistence [1] – Step 1
Common Language Runtime Hook for
Persistence [1] – Step 2
Common Language Runtime Hook for
Persistence [1] – Step 3
Common Language Runtime Hook for
Persistence [1] – Step 4
Common Language Runtime Hook for
Persistence [1] – Result
How to Influence/Encourage Any .NET Application in System32
to Load Arbitrary Assembly [2]
[2]
[2]
.NET-Spolit [5]
[5]
[Microsoft Docs]
Futher Study
● 2018, .NET Instrumentation via MSIL bytecode injection
● 2018, Offensive Retooling in donet for Red Team
● med0x2e/GadgetToJScript

A Study on .NET Framework for Red Team - Part I