Sample Reports

AI / LLM Source-Code Security Audit · Sample

AI / LLM Security Audit Report

RagVault — AI/LLM RAG Framework — SAMPLE

Auditor

SecReport · secreport.site

Engagement

Static Source-Code Security Audit

Date

2026-11-23

Repository

ragvault/ragvault (fictional)

SAMPLE. The project, code and findings below are entirely fictional and do not represent any real client or project. They exist only to demonstrate the format, methodology and depth of a SecReport AI/LLM deliverable.

1. Executive Summary

RagVault is a Python retrieval-augmented-generation (RAG) framework whose document loaders ingest user-supplied URLs and whose model layer loads user-selectable models. The review followed data flow from each public entry point ("ingest this URL", "load this model") to the dangerous sink. Overall posture is adequate with gaps: several loaders correctly route through an SSRF guard, but one loader fetches the raw URL with no host validation, a partial fix on a second loader blocks schemes yet still permits internal-network access, and the model loader hardcodes remote-code execution on load.

SeverityCount
High
2 — F-01, F-03
Medium
1 — F-02
Low / Hardening1

2. Methodology

Read-only static analysis. The loader fleet was mapped, then every URL-fetch and model-load sink was traced back to its public caller. A finding is only reported when a multi-layer Source → Sink chain is proven and the intended protection is shown to be absent or bypassable. Sinks that validate against a closed allowlist before use were eliminated, not reported.

3. Findings

F-01 — Remote loader fetches unvalidated user URL → SSRF + local file read

High
CVSS 8.1 · CWE-918 / CWE-73 · ragvault/loaders/remote.py (fictional)

Root cause. The "load a remote document" API passes its sole user argument straight to urlopen() with no scheme allowlist and no internal-IP blocklist. urlopen's default opener includes a FileHandler, so the fetched content is returned into the RAG index and read back via a normal query.

# Source: public loader API (user controls `url`)
def load_data(self, url):
    req = Request(url, headers={"User-Agent": "..."})
    result = urlopen(req)          # Sink — no scheme/host check
    return [Document(text=result.read())]   # returned to caller

# Attacker inputs:
#   file:///root/.aws/credentials         -> local secret read
#   http://169.254.169.254/latest/meta... -> cloud IAM credentials

Impact. Arbitrary local-file disclosure and server-side requests to internal services / the cloud metadata endpoint, with the response exfiltrated through RAG queries.

Fix. Allow only http/https; resolve the host and reject loopback / private / link-local (169.254/16) addresses; re-validate on every redirect hop. Effort: M.

F-02 — Incomplete fix: scheme allowlist added, internal-IP access still open

Medium
CVSS 6.4 · CWE-918 · ragvault/loaders/sitemap.py (fictional)

Root cause. A sibling loader was partially hardened — it now rejects non-http(s) schemes (so file:// is blocked) — but no host/IP check was added. http://127.0.0.1:<port> and http://169.254.169.254/ still reach the fetcher. The sitemap is attacker-controlled, so its child URLs are fetched too (SSRF amplification).

Why it matters. A partial validator is more dangerous than none — it creates a false sense of safety. The network boundary, not just the scheme, must be enforced. Effort: S.

F-03 — Model loader hardcodes remote-code execution on load

High
CVSS 8.4 · CWE-94 / CWE-502 · ragvault/models/loader.py (fictional)

Root cause. The model-instantiation helper passes trust_remote_code=True as a hardcoded constant, and the public load_model(name) wrapper exposes no parameter to turn it off. When the model name is attacker-influenced, loading executes the model repo's Python at import time → RCE. This overrides the ecosystem's safe opt-in default.

Fix. Default to trust_remote_code=False; expose it as an explicit, documented opt-in; prefer safetensors weights. Effort: S.

4. Remediation Roadmap

PriorityFindingAction
1 (now)F-03Flip trust_remote_code default; expose opt-in
2 (now)F-01Scheme allowlist + internal-IP blocklist on the remote loader
3 (short-term)F-02Apply the same host check to every loader + recursive fetch

5. Positive Observations

The primary web loader already routes through a central SSRF guard; XML parsing uses a hardened parser (no external-entity resolution); and the default weight format is safetensors. The gaps are consistency gaps in siblings that skip the shared guard — not a lack of security awareness.