GithubHelp home page GithubHelp logo

hartl3y94 / sandboxdefender Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blackhatethicalhacking/sandboxdefender

0.0 0.0 0.0 238 KB

C# code to Sandbox Defender (and most probably other AV/EDRs).

C# 100.00%

sandboxdefender's Introduction

Sandbox Defender

Sandboxing Defender (and probably other AV/EDRs) using Security Token manipulation.

If you do use any of the code in these repositories keep it legal!

Introduction

This code was written after reading Sandboxing Antimalware Products for Fun and Profit by Elastic Security Research. I am a little bit late to the party it would seem, the article was made public on the 02/02/22 (3 days ago as of writing), and Martin Ingesens' TokenStomp was posted 04/02/22. MUST code faster!

Anyway, writing this code was fun.

The technique is very simple:

  • Enable the SeDubgPrivilege in our process security token.
  • Get a handle to Defender using PROCESS_QUERY_LIMITED_INFORMATION.
  • Get a handle to the Defender token using TOKEN_ALL_ACCESS.
  • Disable all privileges in the token using SetPrivilege
  • Set the Defender token Integrity level to Untrusted.
  • Do bad things... legally of course!

The main part of the code is here

Example

Execution of the code is shown below (then executing mimikatz after defender is sandboxed):

.\SandboxDefender.exe
[+] Getting a token handle for this process.
[+] Token handle: 0x2EC
[+] Enabling SeDebugPrivilege.
[+] SeDebugPrivilege enabled.
[+] Defender PID: 5212
[+] Getting a process handle for Defender.
[+] Process handle: 0x2F0
[+] Getting a token handle for the Defender process.
[+] Token handle: 0x2F4
[+] Will disable Defender privileges.
[+] Will set Defender Integrity to Untrusted.
[+] Done... Have a nice day!

.\mimikatz.exe

  .#####.   mimikatz 2.2.0 (x64) #19041 Aug 10 2021 17:19:53
 .## ^ ##.  "A La Vie, A L'Amour" - (oe.eo)
 ## / \ ##  /*** Benjamin DELPY `gentilkiwi` ( [email protected] )
 ## \ / ##       > https://blog.gentilkiwi.com/mimikatz
 '## v ##'       Vincent LE TOUX             ( [email protected] )
  '#####'        > https://pingcastle.com / https://mysmartlogon.com ***/

mimikatz #

Nice Pictures

This is Defender before the sandboxing (in Process Hacker):

pre

This is Defender afetr the sandboxing (in Process Hacker):

pre

sandboxdefender's People

Contributors

plackyhacker 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.