# decoder-it/krbrelayex-rpc architecture

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

- Interactive diagram: https://gitdiagram.com/decoder-it/krbrelayex-rpc
- Repository: https://github.com/decoder-it/krbrelayex-rpc

## Overview

##### Main Components
- Relay Engine / Core Server:
– This is the central component that listens for incoming ISystemActivator requests (RPC/DCOM) and performs the initial interception of Kerberos AP-REQ tickets.
- Attack Modules:
– There are multiple “attack” submodules, each residing in its own folder under Clients/Attacks. They cover protocols such as HTTP (for ADCS certificate requests), LDAP (for attacks like LAPS and shadow credential updates), SMB (with its extensive SMB library for both client and server functionality), and even RPC-DCOM specific routines.
- Forwarding / Port Forwarder:
– The project contains a dedicated module (as seen by the Misc/PortForwarder) that enables multithreaded port forwarding. This module handles subsequent requests after the initial authentication interception.
- Utility and Helper Libraries:
- User Interfaces / Consoles:
– There are interactive and background SMB consoles (both from “Clients” and within the extensive SMB library folders) that present the relayed sessions to a user.

##### Relationships and Data Flow
- Incoming Connection Flow:
– Start with an external “Victim Client” (depicted as an external actor) sending a Kerberos AP-REQ ticket over RPC/DCOM.
- Relay Process:
– From the Relay Listener, the intercepted ticket is passed to the “Relay Engine” (which could be depicted as the central orchestrator that invokes one or more Attack Modules).
▪ “SMB Attack Module” for SMB credential-based operations (including launching interactive consoles).
▪ “HTTP Attack Module” if the request is destined for ADCS endpoints.
▪ “LDAP Attack Module” for directory related attacks.
▪ “RPC-DCOM Attack Module” for additional RPC/DCOM specific attacks.
- Forwarder Mode:
- Utility Linkages:

##### Architectural Patterns and Principles
- Layered Design:
– The overall architecture is modular. The Relay Engine acts as the central hub coordinating between network listeners, attack modules, and the forwarding mechanisms.
- Multi-threading / Concurrency:
– Note that modules (like the background SMB consoles and port forwarding) are multithreaded. You might incorporate annotations such as “Multi-threaded” near these components.
- Separation of Concerns:
– Clearly distinguish the components handling service interception (e.g., RPC/DCOM Listener) versus those handling specific attacks (the attack modules) and the forwarding process.
- Cross-Platform Compatibility:
– Since the tool is built with .NET 8.0, indicate that the “Core Relay Engine” and helper libraries are designed for cross-platform use.

##### Detail Specific Technologies and Libraries
- That the implementation is in .NET (with .NET 8.0 SDK) for cross-platform support.
- Mention that many components utilize low-level network and cryptographic libraries for SMB, RPC, LDAP processing.
- Extensive SMB library artifacts (with directories like “RPCForSMBLibrary”, “SMBLibrary”, “NTFileStore”, etc.) as underpinning the SMB attack module.

## Diagram (Mermaid)

```mermaid
graph TD
    victim["Victim Client"]:::external
    listener["RPC/DCOM Relay Listener"]:::core
    http["HTTP Attack Module"]:::attack
    ldap["LDAP Attack Module"]:::attack
    rpcdcom["RPC-DCOM Attack Module"]:::attack
    smb["SMB Attack Module"]:::attack
    forwarder["Dynamic Port Forwarder"]:::core
    target["Target Service(s)"]:::external
    console["Console / UI Module"]:::ui
    utilitiesA["General Utilities"]:::util
    utilitiesB["SMB/RPC Libraries"]:::util

    victim -->|"AP-REQ"| listener
    listener -->|"Invoke"| http
    listener -->|"Invoke"| ldap
    listener -->|"Invoke"| rpcdcom
    listener -->|"Invoke"| smb
    listener -->|"Forward"| forwarder
    forwarder -->|"Route"| target
    smb -->|"Console"| console

    listener ---|"Uses"| utilitiesA
    http ---|"Uses"| utilitiesA
    ldap ---|"Uses"| utilitiesA
    rpcdcom ---|"Uses"| utilitiesA
    smb ---|"Uses"| utilitiesA

    smb ---|"Uses"| utilitiesB
    rpcdcom ---|"Uses"| utilitiesB

    click listener "https://github.com/decoder-it/krbrelayex-rpc/blob/RPC-DCOM/KrbRelayEx/Clients/Rpc.cs"
    click http "https://github.com/decoder-it/krbrelayex-rpc/tree/RPC-DCOM/KrbRelayEx/Clients/Attacks/Http"
    click ldap "https://github.com/decoder-it/krbrelayex-rpc/tree/RPC-DCOM/KrbRelayEx/Clients/Attacks/Ldap"
    click rpcdcom "https://github.com/decoder-it/krbrelayex-rpc/blob/RPC-DCOM/KrbRelayEx/Clients/Attacks/RPC-DCOM/RPC-DCOM.cs"
    click smb "https://github.com/decoder-it/krbrelayex-rpc/tree/RPC-DCOM/KrbRelayEx/Clients/Attacks/Smb"
    click forwarder "https://github.com/decoder-it/krbrelayex-rpc/blob/RPC-DCOM/KrbRelayEx/Misc/PortForwarder.cs"
    click utilitiesA "https://github.com/decoder-it/krbrelayex-rpc/tree/RPC-DCOM/KrbRelayEx/Misc"
    click utilitiesB "https://github.com/decoder-it/krbrelayex-rpc/tree/RPC-DCOM/KrbRelayEx/Smb"
    click console "https://github.com/decoder-it/krbrelayex-rpc/blob/RPC-DCOM/KrbRelayEx/Clients/Smb.cs"

    classDef external fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef core fill:#FFD700,stroke:#000,stroke-width:2px
    classDef attack fill:#FFB6C1,stroke:#000,stroke-width:2px
    classDef util fill:#90EE90,stroke:#000,stroke-width:2px
    classDef ui fill:#DDA0DD,stroke:#000,stroke-width:2px
```
