UAC Apex Framework
AEF v4.0 Β· C++17 Β· Windows 10/11 Β· CMake 3.20+
Enterprise-grade Adaptive Elevation Framework β context-aware UAC bypass orchestration with pre-flight risk scoring, retry/fallback logic, EDR detection, and automated artifact cleanup.
Overview
UAC Apex Framework (AEF) is a modular, enterprise-grade UAC bypass orchestration engine written in C++17. It provides:
- Context-aware technique selection β automatically scores and ranks bypass methods based on the live environment
- Pre-flight risk assessment β detects EDR, sandboxes, debuggers, and UAC level before executing
- Resilient execution β retry with exponential backoff, fallback chains, and emergency shutdown
- Clean architecture β interfaces, registries, and dependency injection for easy extension
Architecture
main() [CLI]
βββ ExecutionOrchestrator
βββ PreFlightAnalysis
β βββ EnvironmentAwarenessModule β OS, UAC, EDR, VM, Sandbox, Debugger
β βββ RiskAssessmentFramework β Weighted detection/execution/evasion score
βββ DecisionEngine β Technique scoring and ranking
β βββ TechniqueRegistry β IElevationTechnique[]
βββ ExecutionPhase β Retry + fallback
βββ ObservationPhase β Telemetry anomaly detection
βββ CleanupPhase β Artifact removal
Project Structure
uac-apex-framework/
βββ CMakeLists.txt
βββ include/
β βββ core/
β β βββ execution_orchestrator.h # Lifecycle + exception hierarchy
β β βββ decision_engine.h # AdaptiveDecisionEngine
β β βββ environment_module.h # WindowsEnvironmentModule
β β βββ risk_assessment.h # DefaultRiskAssessor
β βββ techniques/
β βββ technique_interface.h # IElevationTechnique + TechniqueRegistry
β βββ fodhelper.h # ms-settings registry hijack
βββ src/
β βββ main.cpp # CLI entry point
β βββ core/
β β βββ execution_orchestrator.cpp
β β βββ decision_engine.cpp
β β βββ environment_module.cpp
β β βββ risk_assessment.cpp
β βββ techniques/
β βββ fodhelper.cpp
βββ tests/
βββ test_orchestrator.cpp # GoogleTest + GoogleMock
Core Components
ExecutionOrchestrator
The central lifecycle manager β coordinates all phases: pre-flight β execution β observation β cleanup.
| Feature | Detail |
|---|---|
| Retry logic | Configurable max retries with exponential backoff |
| Fallback | Degrades to SAFE_MODE when all techniques fail |
| Emergency shutdown | Wipes all artifacts on critical exception |
| Thread-safe | Execution runs in dedicated thread with timeout |
EnvironmentAwarenessModule
Detects the live execution environment before any bypass is attempted.
| Detection | Method |
|---|---|
| UAC status + level | Registry ConsentPromptBehaviorAdmin |
| Admin / System token | CheckTokenMembership, integrity level |
| EDR presence | Process snapshot against known EDR process list |
| AMSI | LoadLibrary("amsi.dll") + AmsiInitialize probe |
| VM detection | VMware/VBox files + processes |
| Sandbox detection | Disk size heuristic + sandbox directories |
| Debugger detection | PEB BeingDebugged + IsDebuggerPresent + process list |
RiskAssessmentFramework
Weighted score across three risk dimensions:
| Dimension | Weight | Factors |
|---|---|---|
| Detection risk | 40% | EDR, AV, AMSI, monitoring level |
| Execution risk | 35% | UAC level, token privileges, stealth mode |
| Evasion risk | 25% | Debugger, sandbox, VM indicators |
Score < 70 = proceed Β· Score β₯ 70 = abort
DecisionEngine
AdaptiveDecisionEngine scores each registered technique:
score = (reliability Γ 40) + (stealth Γ 35)
+ preferred_bonus (if in preferred list)
- EDR_penalty (if EDR detected)
- monitoring_penalty (if highly monitored)
Implemented Techniques
fodhelper β ms-settings Registry Hijack
| Property | Value |
|---|---|
| Method | HKCU\Software\Classes\ms-settings\Shell\Open\command |
| Target | fodhelper.exe (Feature On-Demand Helper) |
| Works on | Windows 10 build β₯ 10240, Windows 11 |
| Requirements | Medium integrity, UAC enabled, not already elevated |
| Stealth score | 65/100 |
| Reliability | 75/100 |
| Cleanup | Full registry tree deletion after execution |
// Execution flow
write_payload(cmd) // HKCU ms-settings default + DelegateExecute
launch_fodhelper() // CreateProcess(fodhelper.exe, SW_HIDE)
Sleep(1500) // Wait for elevated spawn
delete_payload() // RegDeleteTree + parent key cleanup
Build Instructions
# Clone
git clone https://github.com/vulnquest58/uac-apex-framework.git
cd uac-apex-framework
# Configure (Release)
cmake -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
# Build
cmake --build build --config Release
# Output: build\Release\aef.exe
# Build with tests
cmake -B build -DBUILD_TESTS=ON
cmake --build build --config Debug
ctest --test-dir build -C Debug -V
Requirements: Visual Studio 2022 (C++ workload), CMake β₯ 3.20, Windows SDK 10.0+
CLI Usage
# Elevate cmd.exe
.\aef.exe cmd.exe
# Dry-run: analysis only
.\aef.exe --dry-run powershell.exe
# Stealth mode + cleanup + preferred technique
.\aef.exe -t fodhelper -s -c cmd.exe /k whoami
# Custom timeout and retries
.\aef.exe -T 15000 -r 5 cmd.exe
# Block a technique
.\aef.exe -x fodhelper powershell.exe
| Flag | Description |
|---|---|
-t <name> |
Preferred technique |
-x <name> |
Block technique |
-s |
Stealth mode (reduces logging + noise) |
-c |
Cleanup artifacts after execution |
-r <n> |
Max retries (default: 3) |
-T <ms> |
Timeout per attempt (default: 30000) |
--dry-run |
Pre-flight analysis only β no execution |
Adding a New Technique
// 1. Inherit IElevationTechnique
class CmstpTechnique : public IElevationTechnique {
public:
bool can_execute(const ExecutionContext& ctx) const override;
ExecutionResult execute(const ExecutionContext& ctx) override;
void cleanup() override;
std::string name() const override { return "cmstp"; }
std::string version() const override { return "1.0.0"; }
std::string description() const override { return "INF file via cmstp.exe"; }
int stealth_score() const override { return 55; }
int reliability_score() const override { return 70; }
std::vector<std::string> requirements() const override {
return { "Windows 10+", "cmstp.exe present" };
}
};
// 2. Register before execution
TechniqueRegistry::instance().register_technique(
std::make_unique<CmstpTechnique>());
Mitigation
| Attack Vector | Recommended Defense |
|---|---|
| ms-settings class hijack | Block HKCU\Software\Classes via AppLocker / WDAC |
| fodhelper auto-elevation | UAC set to βAlways notifyβ (level 5) |
| Registry-based COM extension | Monitor HKCU class writes via Sysmon Event ID 13 |
| Unexpected process lineage | Detect fodhelper β arbitrary child processes in EDR |
References
- UACME β Comprehensive UAC bypass collection
- LOLBAS β fodhelper
- Windows Internals β Token & UAC