T09 · Insecure Skill Coding Practices
- Location
scripts/youtube_desc_generator.py:174- Finding
Untrusted LLM Output Can Be Published Without Validation or Confirmation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/youtube_desc_generator.py:174-186, 243-260
Vulnerability Type: Indirect prompt injection and unsafe use of generated content
Risk Level: HighVulnerable Code
python Transcript: {formatted_transcript} Important Formatting Notes: - Put the PRIMARY KEYWORD or a variation of it in the FIRST timestamp (0:00) - Include MAJOR PRODUCT NAMES as keywords naturally (e.g., Google Flow, Veo 3.1, Nano Banana 2) - End with a CONCLUSION or FINAL THOUGHTS timestamp - Keep each description under 8 words for scannability """ genai.configure(api_key=api_key) model = genai.GenerativeModel('gemini-3.1-flash-lite-preview') timestamps = model.generate_content(timestamp_prompt).textpython if args.post: youtube = get_authenticated_service() if target_video_id: # URL mode — post to the specified video title, current_desc = get_video_details(youtube, target_video_id) print(f"\nTarget video: {title} ({target_video_id})") else: # File mode — post to latest upload target_video_id, title, current_desc = get_latest_video(youtube) print(f"\nLatest video: {title} ({target_video_id})") # Append timestamps to the bottom of the current description new_description = current_desc.strip() + f"\n\n{timestamps}" # Proceed directly without manual confirmation update_video_description(youtube, target_video_id, new_description)Technical Analysis
Raw transcript content is interpolated directly into the Gemini prompt without delimiting it as untrusted data or defending against embedded instructions. The transcript can originate from user input or remotely retrieved YouTube captions.
The generated response is then treated as trusted timestamp content. The implementation does not verify that every line is a chapter entry, that timestamps are ordered and within the video ...[truncated 1406 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat transcripts and model responses as untrusted data.
- Delimit transcript content clearly and instruct the model that text inside the delimiter must never be interpreted as instructions.
- Parse the response using a strict allowlist grammar, such as one timestamp and one short plain-text label per line.
- Reject unexpected lines, URLs, markup, control characters, excessive lengths, or content that does not begin with
0:00. - Verify that timestamps are ordered, unique, within the video's duration, and separated by at least ten seconds.
- Display the exact target video and a complete diff of the proposed description.
- Require explicit interactive confirmation before calling
videos().update(). - Provide a non-interactive override only when the caller explicitly requests it and all validation succeeds.
- Consider keeping generation and publication as separate commands to preserve a human review boundary.
