GithubHelp home page GithubHelp logo

kaimi- / debugamsi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mzhmo/debugamsi

0.0 0.0 0.0 48.16 MB

DebugAmsi is another way to bypass AMSI through the Windows process debugger mechanism.

C++ 100.00%

debugamsi's Introduction

DebugAmsi

TL;DR

Just run the file from Release and get access to powershell without AMSI!

POC.mp4

How It Works

One day I've discovered an interesting function DebugActiveProcess which allows us to become a debugger for a process. Full-fledged debugging will be available if our process has the SeDebug privilege or the ability to call OpenProcess() with the PROCESS_ALL_ACCESS mask.

Once our process becomes a debugger, it can handle the LOAD_DLL_DEBUG_EVENT event, which is generated by the Windows system when any DLL is loaded into the process address space.

Thus, we can start powershell.exe, then become a debugger for it and intercept an attempt to load amsi.dll . And then patch it at the moment of loading.

The problem is that we may miss the point of loading amsi.dll into the powershell.exe process, so in my code, the process starts in a suspended state (at that point, it will only have ntdll.dll in its address space). Then installs the debugger and resumes the main thread of the process, which causes powershell.exe to resume and load the necessary libraries. изображение

изображение

After generating the LOAD_DLL_DEBUG_EVENT event, I find amsi.dll and parsing its EAT to find the AmsiOpenSession and AmsiScanBuffer functions. изображение

EAT parsing is done by reading the memory of the amsi.dll library loaded in powershell.exe . This is done so as not to load amsi.dll into our own process. изображение

After that, a simple patch is applied that renders AMSI useless. This results in a running powershell.exe process with amsi disabled. Also added hiding strings by encrypting them at compile time using XOR with a dynamic key (macroc h() for ASCII and hW() for Unicode)

debugamsi's People

Contributors

kaimi- avatar mzhmo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.