Coder Social home page Coder Social logo

0xvpr / vpr-shell-shock Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 417 KB

A C99/C++17 compatible header only library capable of creating position independent shellcode.

License: MIT License

C++ 99.90% Python 0.10%
binary exploit-development pe32 pe32plus shellcode shellcode-development windows header-only header-only-library position-independent-code

vpr-shell-shock's Introduction

Shellshock


Inspired by: Dark VortEx from bruteratel.com


How to use

One way to use the shellshock.h header is to:

  • Create a 'Shellshock' object
  • Resolve functions that you intend to use with the 'load_' member functions
  • Utilize a singular function and make sure that all variables are created
    on the stack

Once something like this is achieved, you can compile the binary to an object
file and dump the .text section out to a whatever you like. That dump should
be position independent.

Quick Example

#include "shellshock/shellshock.h"

typedef int (WINAPI * MessageBoxA_t)(HWND, LPCSTR, LPCSTR, UINT);

extern "C" int payload_cpp(void) {
    auto ss = ss::shellshock();

    // Load target function into a temporary variable.
    char szMessageBoxA[] = "MessageBoxA";
    auto fMessageBoxA = ss.find_user32_func<MessageBoxA_t>(szMessageBoxA);
    
    // Perform function call
    char szTitle[] = "Shellshock";
    char szMessage[] = "Success.";
    fMessageBoxA && fMessageBoxA(nullptr, szMessage, szTitle, 0);

    return 0;
}

If you want the payload to be immediately exported to a file,
you can do the following:

// Payload that will be exported to shellcode
extern "C" auto payload() noexcept -> void { (...) }
// Immediately after the function ends
void stub() {
    return;
}

int main() {
    auto pd = ss::payload_data::build_from_payload(payload, stub);
    pd.extract_to_file("shellcode.bin");
}

Compilation

Compiling this code to an executable should export the code to the specified
file location.

Compiling this code to an object should mean that the payload function of
the .text section is out new position independent executable.

NOTE: Compilation may fail if position-independent-code is not enabled AND/OR if function sections are enabled.

vpr-shell-shock's People

Contributors

0xvpr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

joyboy8848

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.