Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Security] nano-banana-pro follows output symlinks and overwrites files outside the working directory

オープン 初心者向け
#46 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
security

調査の方向性

まず skills/nano-banana-pro/scripts/generate_image.py に着手し、ここで --filename 引数が画像の書き込み前に出力パスへと変換される。解決済みの出力先(os.path.realpath)を作業ディレクトリと比較し、ターゲットがシンボリックリンクの場合、または作業ディレクトリ外へ逸脱する場合はスキップまたは拒否する。この Issue で示された修正案では、既存の出力先に対する明示的な上書きフラグにも言及している。再現手順で検証する:一時ワークスペースにシンボリックリンクを作成し、スクリプトを実行し、ワークスペース外のセンチファイルが変更されていないことを確認する。完了の条件は、シンボリックリンクのケースが明確なエラーで拒否され、通常の出力ファイル名が引き続き機能することである。

索引モデルが issue の本文から書いたものです。

説明

clawsweeper:needs-security-review clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:data-loss impact:security issue-rating: 🦞 diamond lobster P2

Hi, I found a symlink-following issue in the nano-banana-pro skill that can overwrite files outside the working directory.
GitHub: https://github.com/steipete/agent-scripts/tree/main/skills/nano-banana-pro
ClawHub: https://clawhub.ai/steipete/skills/nano-banana-pro

Summary

generate_image.py saves the generated image to the path supplied with --filename without rejecting symlinks or checking that the resolved path stays inside the working directory.

If an untrusted repository contains result.png as a symlink to a file outside the repository, running the skill from that repository with --filename result.png follows the link and overwrites the target with PNG data. This can corrupt or destroy files that the OpenClaw process can write.

Steps to reproduce

  1. Create an isolated test directory:

    mkdir -p /tmp/nbp-test/workspace /tmp/nbp-test/outside
    printf 'SAFE TEST SENTINEL\n' > /tmp/nbp-test/outside/victim.txt
    ln -s ../outside/victim.txt /tmp/nbp-test/workspace/result.png
    
  2. From the workspace, run the skill with a valid Gemini API key available through GEMINI_API_KEY:

    cd /tmp/nbp-test/workspace
    python3 /path/to/nano-banana-pro/scripts/generate_image.py \
      --prompt "A simple blue square on a plain light background." \
      --filename result.png
    
  3. Check the target:

    file /tmp/nbp-test/outside/victim.txt
    

Expected behavior

The script should reject symlink outputs and any resolved output path outside the working directory.

Actual behavior

The script follows result.png and writes the generated PNG to /tmp/nbp-test/outside/victim.txt.

Impact

An attacker who can provide or modify repository contents can place the output symlink in the repository. If a user or agent runs image generation from that repository using the symlink name, files outside the repository may be overwritten or corrupted, subject to the OpenClaw process's file permissions.

Affected versions

Confirmed in nano-banana-pro 1.0.0 and 1.0.1.

Suggested fix

Reject symlink outputs and verify the resolved destination remains within the intended output directory before writing. Consider requiring an explicit overwrite option when the destination already exists.

主要言語
Shell
スター
7.2k
フォーク
617
平均マージ
4日 12時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。