# ntfargo/relapse-exploit architecture

> Architecture diagram of the GitHub repository ntfargo/relapse-exploit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ntfargo/relapse-exploit
- Repository: https://github.com/ntfargo/relapse-exploit

## Overview

This repository implements a browser-driven PS5 exploit for firmware 7.00–13.60. The user-facing flow runs the WebKit exploit to obtain an arbitrary read/write primitive, prepares a ROP worker, and invokes the kernel exploit; the documented chain uses kernel read/write to enable privilege and sandbox changes and optionally load payloads. Firmware-specific offset tables support the exploit. Several implementation details are unsampled, so uncertain runtime links are omitted rather than inferred.

Main entry points: [`src/site.js`](https://github.com/ntfargo/relapse-exploit/blob/main/src/site.js) (Browser runner), [`src/relapse_exploit.js`](https://github.com/ntfargo/relapse-exploit/blob/main/src/relapse_exploit.js) (Kernel exploit), [`src/main.js`](https://github.com/ntfargo/relapse-exploit/blob/main/src/main.js) (Exploit coordinator), [`src/utils/mem.js`](https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/mem.js) (Memory access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Browser entry"]
  node_site["Browser runner<br/>[site.js]"]
  node_firmware["Firmware checks<br/>[firmware.js]"]
  node_orchestrator["Exploit coordinator<br/>[main.js]"]
end

subgraph group_primitives["Exploit primitives"]
  node_webkit["WebKit exploit<br/>[webkit.js]"]
  node_memory["Memory access<br/>[mem.js]"]
  node_int64["64-bit values<br/>[int64.js]"]
  node_rop["ROP chains<br/>[rop.js]"]
end

subgraph group_kernel["Kernel stage"]
  node_offsets["Firmware offsets"]
  node_kernelrw["Kernel exploit<br/>[relapse_exploit.js]"]
  node_syscalls["Syscall constants<br/>[syscalls.js]"]
end

subgraph group_payload["Payload delivery"]
  node_kernelpayload["Payload loader<br/>[kexp.js]"]
  node_elflistener(("ELF loader"))
end

node_user(("Console user"))

node_user -->|"opens exploit"| node_site
node_site -->|"starts exploit"| node_webkit
node_site -->|"installs primitive"| node_memory
node_site -->|"runs chain"| node_orchestrator
node_site -.->|"checks support"| node_firmware
node_orchestrator -->|"invokes exploit"| node_kernelrw
node_orchestrator -.->|"prepares worker"| node_rop
node_kernelrw -->|"uses values"| node_int64
node_memory -->|"uses values"| node_int64
node_kernelrw -->|"reads offsets"| node_offsets
node_kernelrw -->|"loads payloads"| node_kernelpayload
node_kernelpayload -->|"starts listener"| node_elflistener

click node_site "https://github.com/ntfargo/relapse-exploit/blob/main/src/site.js"
click node_firmware "https://github.com/ntfargo/relapse-exploit/blob/main/src/firmware.js"
click node_webkit "https://github.com/ntfargo/relapse-exploit/blob/main/src/webkit.js"
click node_memory "https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/mem.js"
click node_int64 "https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/int64.js"
click node_orchestrator "https://github.com/ntfargo/relapse-exploit/blob/main/src/main.js"
click node_rop "https://github.com/ntfargo/relapse-exploit/blob/main/src/rop.js"
click node_offsets "https://github.com/ntfargo/relapse-exploit/tree/main/offsets"
click node_kernelrw "https://github.com/ntfargo/relapse-exploit/blob/main/src/relapse_exploit.js"
click node_syscalls "https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/syscalls.js"
click node_kernelpayload "https://github.com/ntfargo/relapse-exploit/blob/main/src/kexp.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_site,node_firmware,node_orchestrator,node_user toneBlue
class node_webkit,node_memory,node_int64,node_rop toneAmber
class node_offsets,node_kernelrw,node_syscalls toneMint
class node_kernelpayload,node_elflistener toneRose
```

## Components

### Browser entry

- [Browser runner](https://github.com/ntfargo/relapse-exploit/blob/main/src/site.js): `src/site.js`
- [Firmware checks](https://github.com/ntfargo/relapse-exploit/blob/main/src/firmware.js): `src/firmware.js`
- [Exploit coordinator](https://github.com/ntfargo/relapse-exploit/blob/main/src/main.js): `src/main.js`

### Exploit primitives

- [WebKit exploit](https://github.com/ntfargo/relapse-exploit/blob/main/src/webkit.js): `src/webkit.js`
- [Memory access](https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/mem.js): `src/utils/mem.js`
- [64-bit values](https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/int64.js): `src/utils/int64.js`
- [ROP chains](https://github.com/ntfargo/relapse-exploit/blob/main/src/rop.js): `src/rop.js`

### Kernel stage

- [Firmware offsets](https://github.com/ntfargo/relapse-exploit/tree/main/offsets): `offsets`
- [Kernel exploit](https://github.com/ntfargo/relapse-exploit/blob/main/src/relapse_exploit.js): `src/relapse_exploit.js`
- [Syscall constants](https://github.com/ntfargo/relapse-exploit/blob/main/src/utils/syscalls.js): `src/utils/syscalls.js`

### Payload delivery

- [Payload loader](https://github.com/ntfargo/relapse-exploit/blob/main/src/kexp.js): `src/kexp.js`
- **ELF loader**

### Other components

- **Console user**

## Connections

- Console user → Browser runner: opens exploit
- Browser runner → WebKit exploit: starts exploit (evidence: `src/site.js`)
- Browser runner → Memory access: installs primitive (evidence: `src/site.js`)
- Browser runner → Exploit coordinator: runs chain (evidence: `src/site.js`)
- Browser runner → Firmware checks: checks support
- Exploit coordinator → Kernel exploit: invokes exploit (evidence: `src/main.js`)
- Exploit coordinator → ROP chains: prepares worker
- Kernel exploit → 64-bit values: uses values (evidence: `src/relapse_exploit.js`)
- Memory access → 64-bit values: uses values (evidence: `src/utils/mem.js`)
- Kernel exploit → Firmware offsets: reads offsets (evidence: `src/relapse_exploit.js`)
- Kernel exploit → Payload loader: loads payloads (evidence: `src/relapse_exploit.js`)
- Payload loader → ELF loader: starts listener
