# ytincodenito/vedr architecture

> Architecture diagram of the GitHub repository ytincodenito/vedr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ytincodenito/vedr
- Repository: https://github.com/ytincodenito/vedr

## Overview

##### Project Type & Purpose
- This project is a security tool used for EDR (Endpoint Detection and Response) evasion challenges. It integrates both user-mode components and kernel-mode components.
- Its purpose is to demonstrate how a minimal EDR can be built (and evaded) by combining a kernel driver, a user-mode agent, and a hooking DLL. The README also highlights a process injection challenge as an evasion practice exercise.

##### Analyzing the File Structure
- Top-Level Directories:
- DllLoader – likely a utility to load/inject a DLL (possibly the hooking DLL) into a target process.
- vAgent – the primary user-mode executable that controls the main functionality. It is run with or without a kernel driver.
- vDriver – contains source for a kernel-mode driver (vDriver.sys) that probably aids in EDR functionality when “kernel” is passed as an argument.
- vhook – contains the DLL (and its supporting files such as logger, framework, and pre-compiled header files) used for code hooking. This is central to the module that will be injected or loaded manually.
- includes, lib – these folders provide dependencies (such as the MinHook library) that are used in the vhook and possibly other projects.
- The presence of a solution file (vEDR.sln) indicates that this is a Visual Studio project with multiple modules and builds.

##### Key Architectural Components & Their Roles
- vAgent (User-Mode Application):
- Acts as the front-end controller.
- Launches in two modes: with and without the kernel driver.
- In “without driver” mode, the DLL (vhook) must be manually injected (or loaded via DllLoader).
- Kernel Driver (vDriver):
- Operates at the kernel level.
- Essential for additional functionality when the ‘kernel’ argument is passed to vAgent.
- Likely interacts with the hooking mechanisms to monitor or manage low-level operations.
- vhook (Hooking DLL):
- Responsible for setting up hooks (via the MinHook library included in the includes folder and lib binaries).
- Implements logging and framework functionalities possibly related to tracking or modifying process behaviors.
- Likely deployed via manual injection or by DllLoader.
- DllLoader:
- Possibly a utility for loading the vhook DLL into the target process, which is essential if not automatically loaded by vAgent.
- External Dependencies:
- MinHook library (lib and includes) plays a critical role in setting up API hooks.
- Related external projects/resources mentioned in the README (like Kernel DLL Injector) offer contextual insight into how DLL injection is performed.

##### Relationships and Interactions
- External interactions (such as loading shellcode for the process injection challenge) should be noted as data or control flows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User-Mode Components"
        vAgent["vAgent (User-Mode Application)"]
        DllLoader["DllLoader (DLL Injection Utility)"]
        vhook["vhook (Hooking DLL)"]
    end

    subgraph "Kernel-Mode Components"
        vDriver["vDriver (Kernel Driver)"]
    end

    subgraph "External/Dependencies"
        target["Notepad.exe (Target Process)"]
        minhook["MinHook Library"]
    end

    vAgent -->|"kernel_mode_comm"| vDriver
    vAgent -->|"initiate_DLL_injection"| DllLoader
    DllLoader -->|"inject_DLL"| vhook
    vhook -->|"apply_hook"| target
    vhook -->|"uses_dependency"| minhook

    click vAgent "https://github.com/ytincodenito/vedr/blob/master/vAgent/vAgent.vcxproj"
    click vAgent "https://github.com/ytincodenito/vedr/blob/master/vAgent/main.cpp"
    click vDriver "https://github.com/ytincodenito/vedr/blob/master/vDriver/vDriver.vcxproj"
    click vDriver "https://github.com/ytincodenito/vedr/blob/master/vDriver/driver.c"
    click vhook "https://github.com/ytincodenito/vedr/blob/master/vhook/vhook.vcxproj"
    click vhook "https://github.com/ytincodenito/vedr/blob/master/vhook/dllmain.cpp"
    click DllLoader "https://github.com/ytincodenito/vedr/blob/master/DllLoader/DllLoader.vcxproj"
    click DllLoader "https://github.com/ytincodenito/vedr/blob/master/DllLoader/main.cpp"
    click minhook "https://github.com/ytincodenito/vedr/blob/master/includes/MinHook.h"
    click minhook "https://github.com/ytincodenito/vedr/tree/master/lib/Debug"
    click minhook "https://github.com/ytincodenito/vedr/tree/master/lib/Release"

    classDef user fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef kernel fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef external fill:#F0F4C3,stroke:#827717,stroke-width:2px;
    classDef dep fill:#FFE082,stroke:#FF8F00,stroke-width:2px;

    class vAgent,vhook,DllLoader user;
    class vDriver kernel;
    class target external;
    class minhook dep;
```
