Coder Social home page Coder Social logo

x0reaxeax / silentwrite Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 2.0 10 KB

PoC arbitrary WPM without a process handle

License: MIT License

C 100.00%
detection-evasion edr-evasion popcalc redteam remote-write shellcode shellcode-execute windows wpm x86-64 av-evasion edr-bypass injection shellcode-injection shellcode-injector

silentwrite's Introduction

SilentWrite - Arbitrary WPM via Get/SetConsoleTitle()

Description

The idea behind this IPC / write-primitive is utilizing the SetConsoleTitleA() API to expose binary data between two processes.
This function does not need a handle to the remote process, instead, it only requires a Process ID. While the memory can't really be written directly via this API function alone, execution-altering API functions can be utilized to redirect the execution to GetConsoleTitleA(), which fetches the data from console title to an arbitrary memory location passed as argument. In this PoC, GetThreadContext() & SetThreadContext() are used to alter the execution.

The injection is performed by 3 consecutive combinations of "Write/Exec"s:

  1. Write a pointer to a jmp $ loop located inside the target process.
  2. Write a pointer to the payload, and return to the jmp $ loop.
  3. Write the actual payload, which RSP will be pointing and returning to, thanks to the pointer written in the previous step.

The result is execution of a "PopCalc" shellcode.

Perquisite summary

  1. Address of a 0xeb, 0xfe (jmp $) loop. The PoC utilizes a static address from kernelbase.dll.
  2. A big enough RWX memory region to replace the stack with (1MB will do). In this PoC, the memory is allocated via VirtualAllocEx(), but the handle to the target process is dropped immediately after.
  3. (THREAD_SET_CONTEXT | THREAD_GET_CONTEXT | THREAD_SUSPEND_RESUME) access rights to the thread which execution will be altered.
  4. The target process needs to be executed from CMD.EXE. Windows Terminal doesn't correctly fetch binary data from console title.

Preview

Preview

Credits

PopCalc shellcode by Bobby Cooke (boku).



This project is licensed under the MIT license. Copyrights are respective of each contributor listed at the beginning of each definition file.

Written with StackEdit.

silentwrite's People

Contributors

x0reaxeax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

freeide axax002

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.