# ps5-payload-dev/elfldr architecture

> Architecture diagram of the GitHub repository ps5-payload-dev/elfldr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ps5-payload-dev/elfldr
- Repository: https://github.com/ps5-payload-dev/elfldr

## Overview

ps5-payload-elfldr is a persistent PS5 payload loader. A jailbroken exploit first loads the entry ELF; it attaches to SceRedisServer to start a bootstrap, which launches a background socket server. Clients send ELF/SELF data or a URI/HTTP request; the server reads and dispatches the payload to the appropriate execution path. The ELF path uses ptrace to map and run code in a target process; the SELF path writes the image to console storage and execs it. README capabilities include URI-based local/HTTP(S) loading and keeping payload crashes isolated. Some lifecycle details are documented but not shown in sampled implementation excerpts.

Main entry points: [`socksrv.c`](https://github.com/ps5-payload-dev/elfldr/blob/master/socksrv.c) (Socket server), [`main.c`](https://github.com/ps5-payload-dev/elfldr/blob/master/main.c) (Entry loader), [`bootstrap.c`](https://github.com/ps5-payload-dev/elfldr/blob/master/bootstrap.c) (Bootstrap launcher), [`elfldr.c`](https://github.com/ps5-payload-dev/elfldr/blob/master/elfldr.c) (ELF execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Bootstrap"]
  node_entry["Entry loader<br/>[main.c]"]
  node_embedded["Embedded assets<br/>[asset.h]"]
  node_bootstrap["Bootstrap launcher<br/>[bootstrap.c]"]
end

subgraph group_ingress["Payload ingress"]
  node_socket["Socket server<br/>[socksrv.c]"]
  node_uri["URI retrieval<br/>[uri.c]"]
  node_elfread["ELF input<br/>[elfldr.c]"]
end

subgraph group_execution["Payload execution"]
  node_selfread["SELF input<br/>[selfldr.c]"]
  node_elfexec["ELF execution<br/>[elfldr.c]"]
  node_selfexec["SELF execution<br/>[selfldr.c]"]
end

subgraph group_platform["PS5 platform"]
  node_ptrace["Ptrace operations<br/>[pt.c]"]
  node_notifier["Console notifications<br/>[notify.c]"]
end

node_exploit(("Jailbroken exploit"))
node_redis["SceRedisServer"]
node_client(("Payload client"))
node_console["PS5 process and storage"]
node_remote(("URI content source"))

node_exploit -->|"loads ELF"| node_entry
node_entry -->|"embeds bootstrap"| node_embedded
node_entry -->|"attaches to"| node_redis
node_entry -->|"attaches via"| node_ptrace
node_entry -->|"executes in target"| node_bootstrap
node_bootstrap -->|"embeds server"| node_embedded
node_bootstrap -->|"spawns"| node_socket
node_socket -->|"accepts payloads"| node_client
node_socket -->|"fetches URI content"| node_uri
node_remote -.->|"provides content"| node_uri
node_socket -->|"reads ELF"| node_elfread
node_socket -->|"reads SELF"| node_selfread
node_socket -->|"dispatches ELF"| node_elfexec
node_socket -->|"dispatches SELF"| node_selfexec
node_elfexec -->|"uses ptrace"| node_ptrace
node_elfexec -->|"loads process image"| node_console
node_selfexec -->|"writes and execs"| node_console
node_entry -->|"notifies"| node_notifier
node_bootstrap -->|"notifies"| node_notifier
node_socket -->|"reports address"| node_notifier

click node_entry "https://github.com/ps5-payload-dev/elfldr/blob/master/main.c"
click node_embedded "https://github.com/ps5-payload-dev/elfldr/blob/master/asset.h"
click node_bootstrap "https://github.com/ps5-payload-dev/elfldr/blob/master/bootstrap.c"
click node_socket "https://github.com/ps5-payload-dev/elfldr/blob/master/socksrv.c"
click node_uri "https://github.com/ps5-payload-dev/elfldr/blob/master/uri.c"
click node_elfread "https://github.com/ps5-payload-dev/elfldr/blob/master/elfldr.c"
click node_selfread "https://github.com/ps5-payload-dev/elfldr/blob/master/selfldr.c"
click node_elfexec "https://github.com/ps5-payload-dev/elfldr/blob/master/elfldr.c"
click node_selfexec "https://github.com/ps5-payload-dev/elfldr/blob/master/selfldr.c"
click node_ptrace "https://github.com/ps5-payload-dev/elfldr/blob/master/pt.c"
click node_notifier "https://github.com/ps5-payload-dev/elfldr/blob/master/notify.c"

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_entry,node_embedded,node_bootstrap,node_client toneBlue
class node_socket,node_uri,node_elfread,node_redis,node_console toneAmber
class node_selfread,node_elfexec,node_selfexec toneMint
class node_ptrace,node_notifier toneRose
class node_exploit,node_remote toneIndigo
```

## Components

### Bootstrap

- [Entry loader](https://github.com/ps5-payload-dev/elfldr/blob/master/main.c): `main.c`
- [Embedded assets](https://github.com/ps5-payload-dev/elfldr/blob/master/asset.h): `asset.h`
- [Bootstrap launcher](https://github.com/ps5-payload-dev/elfldr/blob/master/bootstrap.c): `bootstrap.c`

### Payload ingress

- [Socket server](https://github.com/ps5-payload-dev/elfldr/blob/master/socksrv.c): `socksrv.c`
- [URI retrieval](https://github.com/ps5-payload-dev/elfldr/blob/master/uri.c): `uri.c`
- [ELF input](https://github.com/ps5-payload-dev/elfldr/blob/master/elfldr.c): `elfldr.c`

### Payload execution

- [SELF input](https://github.com/ps5-payload-dev/elfldr/blob/master/selfldr.c): `selfldr.c`
- [ELF execution](https://github.com/ps5-payload-dev/elfldr/blob/master/elfldr.c): `elfldr.c`
- [SELF execution](https://github.com/ps5-payload-dev/elfldr/blob/master/selfldr.c): `selfldr.c`

### PS5 platform

- [Ptrace operations](https://github.com/ps5-payload-dev/elfldr/blob/master/pt.c): `pt.c`
- [Console notifications](https://github.com/ps5-payload-dev/elfldr/blob/master/notify.c): `notify.c`

### Other components

- **Jailbroken exploit**
- **SceRedisServer**
- **Payload client**
- **PS5 process and storage**
- **URI content source**

## Connections

- Jailbroken exploit → Entry loader: loads ELF (evidence: `README.md`)
- Entry loader → Embedded assets: embeds bootstrap (evidence: `main.c`)
- Entry loader → SceRedisServer: attaches to (evidence: `main.c`)
- Entry loader → Ptrace operations: attaches via (evidence: `main.c`)
- Entry loader → Bootstrap launcher: executes in target (evidence: `main.c`)
- Bootstrap launcher → Embedded assets: embeds server (evidence: `bootstrap.c`)
- Bootstrap launcher → Socket server: spawns (evidence: `bootstrap.c`)
- Socket server → Payload client: accepts payloads (evidence: `socksrv.c`)
- Socket server → URI retrieval: fetches URI content (evidence: `socksrv.c`)
- URI content source → URI retrieval: provides content (evidence: `README.md`)
- Socket server → ELF input: reads ELF (evidence: `socksrv.c`)
- Socket server → SELF input: reads SELF (evidence: `socksrv.c`)
- Socket server → ELF execution: dispatches ELF (evidence: `socksrv.c`)
- Socket server → SELF execution: dispatches SELF (evidence: `socksrv.c`)
- ELF execution → Ptrace operations: uses ptrace (evidence: `elfldr.c`)
- ELF execution → PS5 process and storage: loads process image (evidence: `elfldr.c`)
- SELF execution → PS5 process and storage: writes and execs (evidence: `selfldr.c`)
- Entry loader → Console notifications: notifies (evidence: `main.c`)
- Bootstrap launcher → Console notifications: notifies (evidence: `bootstrap.c`)
- Socket server → Console notifications: reports address (evidence: `socksrv.c`)
