RMH Studios — Security Audit Findings¶
Date: February 22, 2026
Scope: RMH codebase (Next.js API routes, file handling, auth, rate limiting, RMH Code, Slice It!, game saves).
Intent: List security vulnerabilities and server-crash risks with minimal reproduction steps. No fixes applied.
1. Server crash / DoS¶
1.1 Slice It! stream — malformed Range header¶
Location: app/api/slice-it/songs/stream/[id]/route.ts
Issue: The handler parses the Range header without validating it. Invalid or hostile values produce NaN or negative chunksize and are passed to createReadStream and Content-Length. This can cause an uncaught exception (server error/crash) or undefined behavior.
Minimal reproduction:
Choose any valid song ID (e.g. from
GET /api/slice-it/songs).Request:
GET /api/slice-it/songs/stream/<SONG_ID> HTTP/1.1 Range: bytes=-
Alternatively try:
Range: bytes=10-5(end < start), orRange: bytes=999999999-999999999(beyond file size).
Observed risk: 500 response or process crash when start/end are NaN or when createReadStream receives invalid options.
1.2 Temple of Joy save — unbounded request body¶
Location: app/api/temple-of-joy/save/route.ts
Issue: No Content-Length or body size check. The route calls req.json() and stores saveData (JSON) in the database. A very large POST body can exhaust server memory during JSON parsing or bloat the database.
Minimal reproduction:
Log in and obtain a valid session (cookie or token).
POST to
/api/temple-of-joy/savewith a JSON body wheresaveDatais a huge object (e.g. multi‑MB).curl -X POST https://<host>/api/temple-of-joy/save \ -H "Content-Type: application/json" \ -H "Cookie: <session_cookie>" \ -d '{"saveData": {"x": "'$(python3 -c "print('A'*10_000_000)")'"}}'
Observed risk: High memory usage, possible OOM or slow/stuck request; large JSON stored in DB.
1.3 RMH Code — unbounded file content (PUT and POST)¶
Location:
app/api/rmh-code/projects/[projectId]/files/[fileId]/route.ts(PUT)app/api/rmh-code/projects/[projectId]/files/route.ts(POST)
Issue: Request body is parsed with req.json() and content is accepted as a string with no maximum length. Storing or processing very large content can cause high memory use, large DB rows (CodeFile.content is @db.Text), and in the GitHub push flow, large base64 payloads.
Minimal reproduction:
Log in, create or open a project, get
projectIdand (for PUT)fileId.PUT (update file):
curl -X PUT "https://<host>/api/rmh-code/projects/<projectId>/files/<fileId>" \ -H "Content-Type: application/json" \ -H "Cookie: <session_cookie>" \ -d '{"content": "'$(python3 -c "print('x'*50_000_000)")'"}'
POST (create file): same idea with
{"name":"x.txt","path":"x.txt","content":"<very long string>"}.
Observed risk: Memory exhaustion during JSON parse or DB write; possible request timeouts or server instability.
1.4 Slice It! patch-analysis — unbounded analysisData¶
Location: app/api/slice-it/songs/[id]/patch-analysis/route.ts
Issue: Authenticated users can send arbitrary analysisData in the JSON body with no size limit. It is stored in Song.analysisData (JSON column). Large payloads can bloat the DB and increase memory use.
Minimal reproduction:
Log in and get a song ID whose
analysisDatais null or empty (e.g. newly uploaded).POST a very large
analysisData:curl -X POST "https://<host>/api/slice-it/songs/<SONG_ID>/patch-analysis" \ -H "Content-Type: application/json" \ -H "Cookie: <session_cookie>" \ -d '{"analysisData": {"huge": "'$(python3 -c "print('A'*5_000_000)")'"}}'
Observed risk: Large JSON stored in DB; higher memory/CPU for parsing and storage.
1.5 Slice It! score — unbounded modifiers¶
Location: app/api/slice-it/score/route.ts
Issue: The modifiers field from the request body is stored as-is in SongLeaderboard.modifiers (JSON). No size or shape validation. A client can send a very large object.
Minimal reproduction:
Log in and submit a score with a huge
modifiersobject:curl -X POST "https://<host>/api/slice-it/score" \ -H "Content-Type: application/json" \ -H "Cookie: <session_cookie>" \ -d '{"username":"testuser","score":1000,"modifiers":'$(python3 -c "import json; print(json.dumps({'x':'A'*1_000_000}))"}'}'
Observed risk: DB bloat and increased memory/CPU per submission.
3. Rate limiting and abuse¶
3.1 Rate limiter keyed by client-supplied IP¶
Location: lib/rate-limit.ts — getClientIp() used by all rate-limited API routes.
Issue: The IP is taken from x-forwarded-for (first value) or x-real-ip. If the app is behind a proxy that does not overwrite these headers, an attacker can set X-Forwarded-For to arbitrary values and bypass or dilute per-IP limits by rotating “IPs.”
Minimal reproduction:
Send many requests that would normally be rate-limited (e.g. Slice It! upload or score POST).
Vary the header on each request:
X-Forwarded-For: 1.2.3.1 ... next request ... X-Forwarded-For: 1.2.3.2 ...
If the server trusts this header, each value is treated as a different client and limits may not apply.
Observed risk: Rate limits bypass; easier DoS or abuse (e.g. many uploads or score submissions).
3.2 Webhook server default secret¶
Location: webhook-server.js
Issue: SECRET = process.env.WEBHOOK_SECRET || 'change-me'. If WEBHOOK_SECRET is not set (e.g. misconfiguration), the server uses a fixed default. The server binds to 127.0.0.1, so only local callers can reach it; if the webhook is ever exposed or the secret is reused elsewhere, the default is weak.
Minimal reproduction:
Deploy or run the webhook server without setting
WEBHOOK_SECRET.Compute
HMAC-SHA256('change-me', body)and send:POST /webhook HTTP/1.1 X-Hub-Signature-256: sha256=<computed_hex>
(from localhost). Request is accepted.
Observed risk: Low if the server is only ever called from a trusted local process; medium if env is ever missing in a less trusted environment.
4. Summary table¶
# |
Category |
Issue |
Location(s) |
Crash / high impact? |
|---|---|---|---|---|
1.1 |
Server crash/DoS |
Stream |
|
Yes (500/crash) |
1.2 |
Server crash/DoS |
Temple of Joy save body unbounded |
|
Yes (memory/DB) |
1.3 |
Server crash/DoS |
RMH Code file content unbounded |
|
Yes (memory/DB) |
1.4 |
DoS / storage |
Patch-analysis |
|
Storage/memory |
1.5 |
DoS / storage |
Score |
|
Storage/memory |
2.1 |
IDOR |
Patch-analysis does not check song ownership |
|
Integrity |
3.1 |
Rate limit bypass |
IP from |
|
Abuse/DoS |
3.2 |
Weak default |
Webhook secret defaults to |
|
Depends on deployment |
5. Notes¶
No raw SQL was found; Prisma is used throughout. No SQL injection identified in app code.
Slice It! upload/stream/cover/delete use path canonicalization (
resolvePathUnder) and magic-byte validation; path traversal and arbitrary file types are mitigated.Signal Forge save already enforces a 500 KB request body limit in the current codebase.
Comments (Slice It!) have a 2000-character limit and rate limiting in the current code.
This document does not include fixes; it only lists problems and minimal steps to reproduce them.