/

CVE-2026-91940

Severity:

HIGH RISK

(7.5)

Arbitrary File Write (CWE-22) in crawl4ai PDF Strategy

CVE-2026-91940

Awaiting Analysis

Vulnerability type

Category:

Path Traversal and Arbitrary File Write

CWE:

CWE-22

Impact:

Arbitrary File Write

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal flaw in crawl4ai's PDF content scraping strategy allows untrusted configuration to control where image data is saved. If an attacker can submit crafted configuration bodies, the service may write attacker-controlled bytes to directories accessible to its account.

Affected context

The vulnerability occurs in deployments using crawl4ai's PDFContentScrapingStrategy when untrusted configuration fields reach the image-saving logic without sufficient validation. Risk depends on whether external users can submit configuration bodies and which directories the service account can access.

Exploit preconditions

  • Attack surface: Configuration submission to the PDF content scraping workflow
  • Required access: Ability to provide or influence a request configuration body
  • Trigger point: Processing of the image_save_dir field by the PDF scraping strategy
  • Why exploitation is possible: The _filter_untrusted_fields function does not adequately constrain attacker-controlled paths, allowing file output to escape the intended storage location

Why this happens

The underlying bug is insufficient validation and confinement of a filesystem path derived from untrusted input. When a user-controlled image_save_dir value is accepted without canonicalization, allowlisting, or containment checks, the application may resolve it to an unintended directory and write generated or attacker-influenced content there. This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').

Potential impact

  • Attacker-controlled bytes may be written to sensitive or operational directories
  • Existing files could be overwritten where service permissions allow
  • Application behavior or configuration may be altered
  • Malicious content could be placed where another component later executes or serves it
  • Confidentiality, integrity, or availability may be affected

General mitigation guidance

Mitigation generally focuses on reducing trust in user-supplied paths and enforcing a filesystem boundary.

Common defensive patterns include:

  • Use a fixed, service-controlled output directory rather than accepting arbitrary paths
  • Canonicalize paths and verify that resolved targets remain beneath an approved directory
  • Apply strict allowlists for permitted path formats and reject traversal elements or unexpected separators
  • Separate user-generated files from executable, configuration, and sensitive data locations
  • Run the service with the minimum filesystem permissions required for its workflow
  • Use isolated storage and restrictive filesystem policies where practical

How teams detect issues like this

Detection can include static analysis for filesystem APIs receiving values from request bodies or configuration objects, particularly when path joining occurs without canonicalization and containment checks. Code review should examine configuration filtering, output-directory enforcement, symlink handling, and overwrite behavior. Runtime monitoring and policy enforcement can alert on writes outside approved application directories, unusual path components, or service-account access to sensitive locations. Automated security review tools may help identify these data flows.

Sources

SourceLink
github.comgithub.com/unclecode/crawl4ai/security/advisories/GHSA-xpp7-j28w-2gvx
vulncheck.comvulncheck.com/advisories/crawl4ai-before-0.9.3-arbitrary-file-write-via-pdfcontentscrapingstrategy

Frequently asked

questions

It may be remotely exploitable when an exposed application endpoint allows an attacker to submit or influence PDF scraping configuration bodies. Exploitability depends on deployment exposure and request authorization controls.

The attacker generally needs access to a configuration submission path or another mechanism that causes the service to process a crafted image_save_dir value.

Do not use user-provided paths directly. Prefer a fixed output directory and enforce canonical-path containment beneath that directory before any write occurs.

Treat all filesystem paths from requests or configuration as untrusted, apply allowlists and canonicalization, monitor unexpected writes, and run the service with narrowly scoped filesystem privileges.

Find out what's already
exploitable in your codebase.