Crassus

Crassus

572 Stars

An MCP server implementation

vu-ls
May 30, 2025
572 stars
Category
Red-team
GitHub Stars
572
Project Added On
May 30, 2025
Contributors
2

Crassus Windows privilege escalation discovery tool

Quick start

  1. In Process Monitor, select the Enable Boot Logging option.

"Process Monitor Boot Logging option"

  1. Reboot.

  2. Once you have logged in and Windows has settled, run Process Monitor once again.

  3. When prompted, save the boot log, e.g., to raw.PML.

  4. Reset the default Process Monitor filter using Ctrl-R.

  5. Save this log file, e.g., to boot.PML.

  6. Run Crassus.exe boot.PML.

  7. Investigate any green colored results and the corresponding entries in results.csv.

Table of Contents

Why “Crassus”?

Accenture made a tool called Spartacus, which finds DLL hijacking opportunities on Windows. Using Spartacus as a starting point, we created Crassus to extend Windows privilege escalation finding capabilities beyond simply looking for missing files. The ACLs used by files and directories of privileged processes can find more than just looking for missing files to achieve the goal.

Did you really make yet another privilege escalation discovery tool?

…but with a twist as Crassus is utilizing the SysInternals Process Monitor and is parsing raw PML log files. Typical usage is to generate a boot log using Process Monitor and then parse it with Crassus. It will also automatically generate source code for proxy DLLs with all relevant exports for vulnerable DLLs.

Features

  • Parsing ProcMon PML files natively. The log (PML) parser has been implemented by porting partial functionality to C# from https://github.com/eronnen/procmon-parser/. You can find the format specification here.

  • Crassus will create source code for proxy DLLs for all missing DLLs that were identified. For instance, if an application is vulnerable to DLL Hijacking via version.dll, Crassus will create version.cpp and version.def files for you with all the exports included in it. By default the proxy DLLs will launch calc.exe. Build scripts are included to build the DLLs on Visual Studio or MinGW.

  • For other events of interest, such as creating a process or loading a library, the ability for unprivileged users to modify the file or any parts of the path to the file is investigated.

  • Able to process large PML files and store all events of interest in an output CSV file.

Flowchart

The general gist of how Crassus works can be summarized in this flowchart:

Crassus flowchart

Screenshots

Crassus Execution

Running Crassus

CSV Output

CSV Output

Output Exports

Exports

Export DLL Functions

DLL Functions

Export DLL Ordinals

DLL Ordinals

Getting Crassus.exe

Building with Visual Studio

Crassus was developed as a Visual Studio 2019 project. To build Crassus.exe:

  1. Open Crassus.sln

  2. Press Ctrl+Shift+B on your keyboard

Using precompiled Crassus.exe

If you trust running other people’s code without knowing what it does, Crassus.exe is provided in this repository.

Usage

Execution Flow

  1. In Process Monitor, select the Enable Boot Logging option.

"Process Monitor Boot Logging option"

  1. Reboot.

  2. Once you have logged in and Windows has settled, optionally also run scheduled tasks that may be configured to run with privileges.

  3. Run Process Monitor once again.

  4. When prompted, save the boot log.

  5. Reset the default Process Monitor filter using Ctrl-R.

  6. Save this log file, e.g., to boot.PML. The reason for re-saving the log file is twofold:

    1. Older versions of Process Monitor do not save boot logs as a single file.

    2. Boot logs by default will be unfiltered, which may contain extra noise, such as a local-user DLL hijacking in the launching of of Process Monitor itself.

Command Line Arguments

| Argument | Description |

| ------------------------- | ----------- |
| <PMLFILE> | Location (file) of the existing ProcMon event log file. |
| --verbose | Enable verbose output. |
| --debug | Enable debug output. |

Examples

Parse the Process Monitor boot log saved in boot.PML. All vulnerable paths will be saved as results.csv and all proxy DLL source files in the stubs subdirectory.

C:\tmp> Crassus.exe boot.PML

Proxy DLL Template

Below is the template that is used when generating proxy DLLs., For DLLs that are found by Crassus, the proxy DLL will contain the same export names as specified in %_EXPORTS_%, as well as the same ordinals as specified in the .def file. Crassus will detect whether the DLL needs to be built as a 32-bit library or a 64-bit library by looking at the architecture of the parent process, and tagging the source code in the %_BUILD_AS_% field accordingly.

If the real DLL cannot be found using the Process Monitor log, or if the export name is problematic, the build scripts will fall back to creating a DLL without specified exports.

#pragma once

//%_BUILD_AS%

#include <windows.h>;

extern "C" {

  VOID Payload() {
      // Run your payload here.
      WinExec("calc.exe", 1);
  }

  BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
  {
      switch (fdwReason)
      {
      case DLL_PROCESS_ATTACH:
          Payload();
          break;
      case DLL_THREAD_ATTACH:
          break;
      case DLL_THREAD_DETACH:
          break;
      case DLL_PROCESS_DETACH:
          break;
      }
      return TRUE;
  }


  #ifdef ADD_EXPORTS
  %_EXPORTS_%
  #endif
}

openssl.cnf Template

For applications that unsafely use the OPENSSLDIR variable value, a crafted openssl.cnf file can be placed in the noted location. For this example, the software will load C:\tmp\calc.dll. Be sure to use a 32-bit library to target 32-bit processes, and a 64-bit library to target 64-bit processes.

```openssl_conf = openssl_init
[openssl_init]

This will attempt to load the file c:\tmp\calc.dll as part of OpenSSL initialization

Build scripts should detect whether the calc.dll library needs to be built as 32-bit or 64-bit

/tmp/calc = asdf

# Compiling Proxy DLLs

## Visual Studio

Compilation is possible using the `cl.exe` binary included with Visual Studio. Specifically:

cl.exe /DADD_EXPORTS /D_USRDLL /D_WINDLL .cpp /LD /Fe.dll /link /DEF:.def

To automate the build process, including specifying whether the library should be 64-bit or 32-bit:

1. Open the Visual Studio Developer Command Prompt.

2. Build the DLLs with the `build.bat` script.

3. Rename the compiled file as necessary if the vulnerable file name ends with something other than `.dll`.

**Note:** Due to an unfortunate behavior with `vcvarsall.bat`, which is [definitely not a bug](https://developercommunity.visualstudio.com/t/vcvarsallbat-reports-the-input-line-is-too-long-if/257260#T-N258712), you may encounter trouble attempting to run `build.bat` more than once in the same Visual Studio Developer Command Prompt session. If you encounter an error, simply close the window and launch it again.

## MinGW

If Visual Studio isn't readily available, proxy DLLs can be compiled with [MinGW-w64](https://www.mingw-w64.org/) instead. On an Ubuntu platform for example, MinGW can be installed via the following: `sudo apt install g++-mingw-w64-x86-64-win32 g++-mingw-w64-i686-win32`

Create a 32-bit DLL

i686-w64-mingw32-g++ -c -o .o .cpp -D A

... Content truncated. Click "See More" to view the full README.

Tool Information

Author

vu-ls

Project Added On

May 30, 2025

License

Open Source

Tags

security tool