art-template's sub-template resolution logic (src/compile/adapter/resolve-filename.js), used by...
概要
art-template's sub-template resolution logic (src/compile/adapter/resolve-filename.js), used by...
原文の説明
取得元が公開している説明をそのまま載せています (多くは英語)。
art-template's sub-template resolution logic (src/compile/adapter/resolve-filename.js), used by both the include() and extend() template directives, resolves the target file path via path.resolve(root, filename) with no check afterward that the result remains inside root. Because path.resolve() discards root entirely when filename is an absolute path, and does not block '../' traversal sequences, and the resolved path is passed directly to fs.readFileSync() in loader.js with its contents compiled and rendered, an application that lets a sub-template name be influenced by external input (e.g. a query parameter passed into {{include page}}) allows an attacker to read arbitrary files on disk that the Node process can access.
出典: NIST National Vulnerability Database NVD GitHub Advisory
AI要約
外部の AI が作成した要約です。誤りを含むことがあります。重要な判断の前に、下の原文と参照URLを確認してください。
art-templateのサブテンプレート解決ロジックにおける問題で、絶対パスを処理するときにディレクトリ外へのファイルアクセスが可能です。攻撃者は、外部入力を利用して任意のファイルを読み取ることができます。
art-templateのサブテンプレート解決ロジックで、絶対パス処理時にディレクトリ外アクセスが可能な問題。
src/compile/adapter/resolve-filename.jsとloader.jsファイル。
攻撃者は任意のファイルを読み取ることができるため、高いリスクです。
ディレクトリ外へのアクセスをチェックし、防ぐコードを追加する必要があります。
入力をサニタイズし、絶対パスを禁止することで一時的な対策を行う。
テンプレート名が外部入力から影響を受けている個所を確認し、パスが予期しないディレクトリに解決されないか確認する。
参照URL
- web github.com
- web nvd.nist.gov
- web github.com