T01 · Skill Instruction Hijacking
- Location
scripts/dub.py:441- Finding
Untrusted ASR transcript is embedded in an Agent instruction document
- Content
View full analysis
Vulnerability Details
File Location:
scripts/dub.py, lines 441–484
Vulnerability Type: Prompt injection through externally derived transcript content
Risk Level: MediumRelevant code:
python def stage_prepare(video, work, asr_window=6.0, ref_start=2.0, ref_dur=10.0): work.mkdir(parents=True, exist_ok=True) segs_dir = work / "dub_asr" segs_dir.mkdir(exist_ok=True) duration = get_video_duration(video) log(f"[dub:prepare] video {duration:.1f}s") audio_wav = work / "dub_source.wav" _ffmpeg_extract_wav(video, audio_wav) windows = _asr_windows(audio_wav, segs_dir, duration, asr_window) if not windows: raise SystemExit("[dub] no speech transcribed") log(f"[dub:prepare] {len(windows)} ASR windows") rs, rd = _ref_window(duration, ref_start, ref_dur) _cut_wav(audio_wav, work / "dub_reference.wav", rs, rd) (work / "dub_transcript.json").write_text( json.dumps({"video": str(video), "duration": duration, "windows": windows}, ensure_ascii=False, indent=2), encoding="utf-8") (work / "dub_brief.md").write_text(_brief_md(windows, duration), encoding="utf-8") print(json.dumps({"status": "dub_prepared", "windows": len(windows), "brief": str(work / "dub_brief.md")}, ensure_ascii=False)) def _brief_md(windows, duration): lines = [ "# 配音翻译任务(dub)", "", f"视频时长 {duration:.1f}s。下面是英文原声的分窗转写(时间戳偏粗,仅作锚点)。", "把它**忠实翻译并配音**,写入 `dub_script.json`——核心是**和原视频节奏一致**,不是做解说、" "也不是做精简版。", "", "要点:", "1. 逐句忠实翻译,原声说什么就配什么;**不要删内容、不要合并、不要自作主张去掉开场 hook**;" "原声重复,配音也跟着重复。", "2. 每句放在它在原声里被说出的时间,`start`/`end` 取那句话的起止——这样配音才跟着原声节奏走" "(该停顿处自然留白)。", f"3. 译文忠实精简,能在自己的 `start`→`end` 区间内用正常语速说完(目标约 {DUB_TARGET_CPS:g} 字/秒;" f"达到 {DUB_FAST_SPEECH_CPS:g} 字/秒 lint 会警告,渲染时可能被大幅加速或截断)。", ...[truncated 3473 chars]- Remediation
View remediation
Remediation Suggestions
- Keep Agent instructions and untrusted transcript data in separate files. Supply the transcript through a structured JSON input rather than embedding it in an instruction-bearing Markdown document.
- Add an explicit higher-priority instruction outside the transcript stating that all transcript fields are untrusted quoted content and that any commands found within them must be ignored.
- Constrain the Agent stage to one operation: reading approved transcript fields and producing a schema-validated
dub_script.json. - Apply an allowlist to the generated output schema and reject additional fields, tool directives, URLs, or unrelated content before any subsequent processing.
- If a human-readable Markdown brief is retained, render transcript values as clearly delimited quoted data and escape Markdown control syntax. Escaping is defense in depth and should not replace instruction/data separation.
- Run the translation stage with least-privilege tooling: restrict filesystem access to the work directory and disable unnecessary network, shell, credential, and memory-writing capabilities.
- Preserve the existing timing lint, but add a workflow-level gate that verifies the Agent produced only the requested translation artifact before proceeding to voice cloning.
