# hackerhouse-opensource/envschtasksuacbypass architecture

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

- Interactive diagram: https://gitdiagram.com/hackerhouse-opensource/envschtasksuacbypass
- Repository: https://github.com/hackerhouse-opensource/envschtasksuacbypass

## Overview

##### Main Components
- Exploit Executable: Represent the compiled binary (both x86 and x64 versions) that implements the bypass.
- Exploit Logic Module: The core C++ code (EnvSchtasksUACBypass.cpp) that contains the logic for modifying the environment variable, invoking schtasks.exe, and interacting with Windows system components.
- Resource Files: Include the resource file (EnvSchtasksUACBypass.rc) and header (resource.h) that might define UI elements or additional data required by the application.
- Windows System Components: Include external Windows components such as:
- schtasks.exe – The task scheduler utility used to trigger the DiskCleanup elevated task.
- DiskCleanup Elevated Task – The pre-existing elevated task exploited in this bypass.
- svchost.exe – Windows service host used to run a privileged shell.
- Windows Registry – Specifically, the part that is manipulated (User SID registry and %WINDIR%).
- Environment Variables: The component that communicates the bypass method via environment variable modifications.

##### Relationships and Interactions
- The code module then sets or manipulates environment variables.
- Next, the executable invokes schtasks.exe to run the DiskCleanup task with altered parameters.
- This action causes svchost.exe to start a privileged shell.
- Concurrently, registry modifications are executed (altering the %WINDIR% location), reinforcing the bypass.

##### Important Architectural Patterns or Principles
- Windows API/Service Interaction: Emphasize the interaction with native Windows services and the registry, which are core to the exploit’s operation.

##### Relevant Technologies and Frameworks
- Visual Studio C++ (for building the binaries, as suggested by the .sln, .vcxproj, and related files).
- Windows System APIs and Command-Line Utilities (schTasks, DiskCleanup task, registry operations).
- The distinction between x86 and x64 builds can also be annotated, noting that the binary is built for multiple architectures.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Resources Subgraph
    subgraph "Build & Resources"
        proj["Visual Studio Project"]:::resource
        resrc["Resource File (.rc)"]:::resource
        reshdr["Resource Header"]:::resource
        buildconf["Build Configuration"]:::resource
    end

    %% Exploit Chain
    proj --> exec["Exploit Executable (x86/x64)"]:::exploit
    resrc --> exec
    reshdr --> exec
    buildconf --> exec

    exec --> logic["Exploit Logic Module"]:::exploit

    logic --> env["Environment Variables Setup"]:::external
    logic --> regmod["Registry Modification"]:::external
    logic --> task["Invoke schtasks.exe"]:::external

    task --> scht["schtasks.exe"]:::system
    scht --> cleanup["DiskCleanup Elevated Task"]:::system
    cleanup --> svchost["svchost.exe (Privileged Shell)"]:::system

    regmod --> registry["Windows Registry"]:::system

    %% Click Events
    click exec "https://github.com/hackerhouse-opensource/envschtasksuacbypass/blob/main/EnvSchtasksUACBypass/EnvSchtasksUACBypass.cpp"
    click logic "https://github.com/hackerhouse-opensource/envschtasksuacbypass/blob/main/EnvSchtasksUACBypass/EnvSchtasksUACBypass.cpp"
    click resrc "https://github.com/hackerhouse-opensource/envschtasksuacbypass/blob/main/EnvSchtasksUACBypass/EnvSchtasksUACBypass.rc"
    click reshdr "https://github.com/hackerhouse-opensource/envschtasksuacbypass/blob/main/EnvSchtasksUACBypass/resource.h"
    click proj "https://github.com/hackerhouse-opensource/envschtasksuacbypass/blob/main/EnvSchtasksUACBypass/EnvSchtasksUACBypass.vcxproj"
    click buildconf "https://github.com/hackerhouse-opensource/envschtasksuacbypass/blob/main/EnvSchtasksUACBypass/EnvSchtasksUACBypass.vcxproj.filters"

    %% Styles
    classDef resource fill:#ffffcc,stroke:#ffaa00,stroke-width:2px;
    classDef exploit fill:#ffcccc,stroke:#ff0000,stroke-width:2px;
    classDef external fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef system fill:#ccffcc,stroke:#00aa00,stroke-width:2px;
```
