本文へ移動
English version →
中 4.4

Path traversal via stored raw docpath allows a manager to write/read files outside storage/documents

GHSA-3f4c-xj8r-h4cr SecPulse初出

概要

Summary

AnythingLLM validates a document path at ingest using a normalized copy of the input, but
persists the original (un-normalized) string as the document's docpath. Background jobs and
document helpers later re-resolve that stored raw docpath against storage/documents **withou...

原文の説明 取得元が公開している説明をそのまま載せています (多くは英語)。

Summary

AnythingLLM validates a document path at ingest using a normalized copy of the input, but
persists the original (un-normalized) string as the document's docpath. Background jobs and
document helpers later re-resolve that stored raw docpath against storage/documents without
any containment (isWithin) check
. As a result, a user with the manager (or admin) role can
cause the server to write a document-JSON file to a chosen path outside storage/documents,
overwriting existing writable files on the host, and can cause reads outside the directory as well.

Details (root cause)

Verified against source at commit 65f83f3e47192843ded1228acdff86b00106c0cc (v1.16.1-era master):

  1. server/models/documents.js addDocuments() validates via fileData(path) (which normalizes
    and enforces isWithin) at line 109, but then stores the raw path into docpath at
    line 124 (docpath: path). The native embedder worker
    server/jobs/embedding-worker.js:94 stores the raw filePath the same way.
  2. server/jobs/sync-watched-documents.js:149 passes the stored raw document.docpath into
    updateSourceDocument(...).
  3. server/jobs/helpers/index.js updateSourceDocument() does
    path.resolve(documentsPath, docPath) (line 24) and fs.writeFileSync(...) (line 25)
    with no isWithin check (function body lines 23–28).
  4. The read sink server/utils/DocumentManager/index.js:38
    (`path.resolve(this.documentSto…

出典: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV

参照URL

当サイトでは、アクセス解析と広告の効果測定のために Cookie を使います。株式会社Game のサイト共通の設定です。 詳しく