/

CVE-2025-45691

Severity:

HIGH RISK

(7.5)

Path Traversal / Arbitrary File Read in Exploding Gradients

CVE-2025-45691

Modified

Vulnerability type

Category:

Path Traversal / Arbitrary File Read

CWE:

CWE-22, CWE-918

Impact:

Arbitrary File Read / Sensitive Data Exposure

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

Exploding Gradients RAGAS v0.2.3 to v0.2.14 contains an arbitrary file read vulnerability in the ImageTextPromptValue class, caused by insufficient validation of URLs passed via the retrieved_contexts parameter for multimodal inputs.

An attacker who can influence these URLs may be able to coerce the application into reading local files on the host system and exposing their contents through the RAG pipeline.

Affected context

This issue arises in applications that integrate RAGAS v0.2.3–v0.2.14 and use the ImageTextPromptValue class with multimodal inputs.

The vulnerable condition is present when retrieved_contexts values are accepted from untrusted or partially trusted sources (such as user input, upstream services, or dynamically constructed URLs) and are used without strict normalization and validation.

In such configurations, URL-like inputs may be interpreted in a way that allows access to local filesystem paths or other unintended resources on the host where the application runs.

Exploit preconditions

  • Attack surface: APIs, agents, or workflows that accept or assemble retrieved_contexts for ImageTextPromptValue, particularly where those values are user-controlled or derived from external data.
  • Required access: Ability to submit or influence the retrieved_contexts parameter (directly via an API, indirectly via prompt orchestration, or through upstream data sources).
  • Trigger point: Construction or evaluation of multimodal ImageTextPromptValue instances that dereference or resolve the supplied URLs/paths.
  • Why exploitation is possible: The implementation does not sufficiently validate, canonicalize, or constrain the URL/path inputs, enabling traversal or redirection to local file resources that should not be exposed.

Why this happens

At its core, this is a path traversal / arbitrary file read vulnerability aligned with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

The ImageTextPromptValue logic processes URLs from retrieved_contexts and appears to accept these values without robust checks on scheme, location, or allowed prefixes.

Without enforcing a strict allowlist (e.g., HTTPS-only remote resources, predefined storage backends) and without normalizing and validating resolved paths, attacker-controlled inputs can be interpreted as local file paths or manipulated to escape intended directories.

This insecure pattern—trusting externally supplied locations or URLs as safe resources without restriction—creates a channel to read arbitrary files on the server.

Potential impact

  • Reading sensitive configuration files that may contain credentials, API keys, or connection strings.
  • Access to environment files, logs, or model configuration data that could aid further attacks.
  • Exposure of proprietary model artifacts or prompt templates stored on disk.
  • Disclosure of user-specific or tenant-specific data if stored alongside the application.
  • Indirect facilitation of further compromise by leaking secrets usable in lateral movement.

General mitigation guidance

Effective mitigation focuses on constraining what retrieved_contexts can reference and treating location-like inputs as untrusted:

  • Enforce strict scheme and domain allowlists for URLs used by ImageTextPromptValue (e.g., only HTTPS, only specific trusted hosts or storage buckets).
  • Avoid treating unqualified strings as filesystem paths; when file-based contexts are needed, map them through a controlled abstraction instead of raw paths.
  • Normalize and validate all paths before use, ensuring they resolve within a predefined, restricted directory and rejecting any inputs that traverse outside it.
  • Separate privileges: run the RAG application with a minimally privileged account and restrict filesystem read access to only those directories required for operation.
  • Centralize input validation: ensure that any code constructing retrieved_contexts applies consistent validation, rather than ad‑hoc checks in multiple places.

How teams detect issues like this

Organizations can approach detection by combining code-level analysis and behavioral monitoring:

  • Static analysis / SAST:
  • Flag code that passes user-controlled or external strings into file-opening or URL-fetch APIs without prior validation or normalization.
  • Identify usages of ImageTextPromptValue or similar multimodal components where retrieved_contexts is sourced from request data or unvalidated external inputs.
  • Code review signals:
  • Any logic that dynamically builds URLs or paths for RAG contexts should trigger review for scheme, host, and path constraints.
  • Look for missing allowlists, missing canonicalization, or absence of checks that ensure inputs stay within a safe directory or trusted origin set.
  • Runtime and logging:
  • Instrument file access or URL fetch layers to record unexpected schemes, localhost access patterns, or attempts to access sensitive paths.
  • Correlate anomalous file reads (e.g., /etc/, application secrets, environment files) with specific API calls that provide retrieved_contexts.

Automated review tools or custom linters can be configured to highlight risky patterns such as path-derived from request parameters, especially around the RAG pipeline.

Sources

SourceLink
adithyanak.comadithyanak.com/ragas-v0214-arbitrary-file-read-vulnerability
github.comgithub.com/explodinggradients/ragas/blob/e97886ac976465efb60e5949c5d69baf30cc811d/src/ragas/prompt/multi_modal_prompt.py#L202
github.comgithub.com/explodinggradients/ragas/pull/1559
github.comgithub.com/vibrantlabsai/ragas/pull/1991
access.redhat.comaccess.redhat.com/security/cve/CVE-2025-45691
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2444875
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-45691.json

Frequently asked

questions

Exploitability depends on how the host application uses retrieved_contexts.

If untrusted users can directly or indirectly influence these values, the vulnerability can be broadly exploitable through public or internal APIs that invoke ImageTextPromptValue.

That depends on the application integration.

In some deployments, only authenticated users or internal services can supply retrieved_contexts, while in others, anonymous users may be able to control this input via public endpoints.

The key requirement is the ability to affect the multimodal context URLs.

The most robust fix is to strictly constrain what locations can be accessed: enforce allowlisted URL schemes and hosts, avoid interpreting arbitrary inputs as filesystem paths, and ensure any path-based access is restricted to a clearly defined directory with canonicalization and traversal checks.

Treat any user-sourced or external reference to files, URLs, or other resources as untrusted.

Design RAG and multimodal pipelines so that resource locations are derived from server-side configuration or safe mapping layers, apply centralized validation and normalization, and run components with least-privilege filesystem access to limit damage if validation fails.

Find out what's already
exploitable in your codebase.