# occamsec/cve-2023-2825 architecture

> Architecture diagram of the GitHub repository occamsec/cve-2023-2825, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/occamsec/cve-2023-2825
- Repository: https://github.com/occamsec/cve-2023-2825

## Overview

##### Project Type and Purpose
- This is a small, single-script proof-of-concept (PoC) tool written in Python.
- Its sole purpose is to demonstrate CVE-2023-2825 (an unauthenticated path-traversal file-read vulnerability in GitLab CE/EE 16.0.0).
- It automates: login → group creation → project creation → file upload → exploit (arbitrary file read).

##### High-Level Analysis of File Structure
- Top Level
– README.md: describes vulnerability and PoC workflow
– poc.py: the Python script implementing the logic
– DISCLAIMER.txt: legal notice
- No subdirectories or configuration files—everything is in one script.
- External dependencies (implied): Python standard library + “requests” (or similar HTTP client).

##### Key Components to Model
a. POC Client (poc.py)
- Modules/Logical Layers inside the script:
- CLI / Orchestrator
- Auth module (POST /session)
- GroupCreation module (POST /groups)
- ProjectCreation module (POST /projects)
- FileUpload module (POST /:repo/upload)
- Exploit module (GET path-traversal URL)
- HTTP client library (e.g. requests)
b. External System: GitLab Server
- Nginx (front-end proxy)
- Rails app (GitLab Rails)
- Database (PostgreSQL)
- File storage (uploads directory on disk)
c. Network / HTTP Layer
- TLS/HTTP between POC and GitLab

##### Relationships and Interactions
- The POC script initiates an HTTPS connection to GitLab.
- Sequence:
1) Authenticate → session cookie/token
2) Create nested groups (x11)
3) Create project under nested groups
4) Upload benign file → returns upload URL
5) Exploit via GET with encoded “../” steps → GitLab Rails decodes and serves arbitrary file from disk
- Each step issues an HTTP request; responses drive the next step.

##### Architectural Patterns & Principles
- Single-process, linear orchestration (pipeline)
- Clear separation of concerns: each stage in PoC is a logical module
- Stateless interactions: every HTTP call has all needed context
- External system integration via REST API

##### Detailed Steps
– Auth
– GroupCreation
– ProjectCreation
– FileUpload
– Exploit
– Nginx (proxy)
– GitLab Rails App
4. Rails reading from the Uploads Dir when serving the exploit GET.
5. “N+1 group nesting → path-traversal depth” requirement near the GroupCreation module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "PoC Client (poc.py)"
        Auth["Auth Module"]:::poc
        GRP["GroupCreation Module"]:::poc
        PRJ["ProjectCreation Module"]:::poc
        UP["FileUpload Module"]:::poc
        EXP["Exploit Module"]:::poc
    end

    subgraph "Documentation"
        README["README.md"]:::docs
        DISCLAIMER["DISCLAIMER.txt"]:::docs
    end

    NET["Internet\n(HTTPS)"]:::network

    subgraph "GitLab Server"
        NGX["Nginx Proxy"]:::proxy
        RLS["GitLab Rails App"]:::app
        DB[(PostgreSQL DB)]:::storage
        FS[(Uploads Directory)]:::storage
    end

    Auth -->|"1: POST /session"| NET
    GRP -->|"2: POST /groups"| NET
    PRJ -->|"3: POST /projects"| NET
    UP  -->|"4: POST /:repo/upload"| NET
    EXP -->|"5: GET /:repo/uploads/.../..%2f..%2f/etc/passwd"| NET

    NET --> NGX
    NGX --> RLS
    RLS -->|"writes group/project"| DB
    RLS -->|"stores file"| FS
    RLS -->|"reads file (exploit)"| FS

    click Auth "https://github.com/occamsec/cve-2023-2825/blob/main/poc.py"
    click GRP "https://github.com/occamsec/cve-2023-2825/blob/main/poc.py"
    click PRJ "https://github.com/occamsec/cve-2023-2825/blob/main/poc.py"
    click UP "https://github.com/occamsec/cve-2023-2825/blob/main/poc.py"
    click EXP "https://github.com/occamsec/cve-2023-2825/blob/main/poc.py"
    click README "https://github.com/occamsec/cve-2023-2825/blob/main/README.md"
    click DISCLAIMER "https://github.com/occamsec/cve-2023-2825/blob/main/DISCLAIMER.txt"

    classDef poc fill:#AEDFF7,stroke:#036B99,color:#000;
    classDef network fill:#F2F2F2,stroke:#999,color:#000,stroke-dasharray: 5 5;
    classDef proxy fill:#FFD59E,stroke:#E67E22,color:#000;
    classDef app fill:#FFF2A8,stroke:#D4AC0D,color:#000;
    classDef storage fill:#D6F5D6,stroke:#27AE60,color:#000;
    classDef docs fill:#E8E8E8,stroke:#666,color:#000,stroke-dasharray: 2 2;
```
