Git Product home page Git Product logo

comrunner's Introduction

COMRunner

A simple COM server which provides a component to run shellcode. Also includes a Windows JScript file to load the COM server and create the object with registration-free activation. This PoC COM server provides an object with a method that takes in base64 encoded shellcode and a method to run the shellcode.

For a more exhaustive background, see the blog post here: https://adapt-and-attack.com/2020/05/12/building-a-com-server-for-initial-execution/

Contents

COM Client (JScript) to activate the object and run shellcode

  • script.js

COM Class definition and C++ implementation:

  • COMRunner\object.cpp
  • COMRunner\object.h

IDL Object Definition:

  • COMRunner\TestClass.idl

Generated files from midl.exe compilation:

  • COMRunner\TestClass.h
  • COMRunner\TestClass.tlb
  • COMRunner\TestClass_i.c
  • COMRunner\TestClass_p.c
  • COMRunner\dlldata.c

Resource Embedding:

  • COMRunner\resource.rc specifying resources to embed
  • COMRunner\resource.res generated file from rc COMRunner\resource.rc, file is pulled in to embed TLB at compile time

Other:

  • COMRunner\dllmain.cpp has typical dllmain functions and DllGetClassObject implementation
  • COMRunner\Helpers.h includes some helper functions
  • COMRunner\Source.def defines exported functions

Changing the Object

As described later in the blog post, which is probably the best way to understand if this is new to you, the COM object's structure is identified in the TestClass.idl file. If you want to add another method or take an additional input, you will want to follow these general steps. These may not be the only way, so feel free to stray away as well.

  1. Update the TestClass.idl with your desired changes
  2. Regenerate files with midl.exe TestClass.idl
  3. The new TLB needs to be embedded. Run rc resource.rc to generated a new resource.res
  4. Update object.h class to ensure it implements your new interface defined in TestClass.idl
  5. Update object.cpp to change/add/remove your object's method's code

Thanks

comrunner's People

Contributors

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