Skip to content

Security: fixed EOF heredoc delimiter in action.yml enables step output injection #526

@fg0x0

Description

@fg0x0

Summary

action.yml writes the Gemini CLI's LLM response to $GITHUB_OUTPUT using a fixed EOF heredoc delimiter (lines 353-359). If the LLM response contains a bare EOF line, the heredoc closes early and subsequent name=value lines become arbitrary step outputs.

This enables bash injection in any downstream consumer workflow that template-interpolates ${{ steps.gemini_run.outputs.X }} into a run: block.

Root Cause

echo "gemini_response<<EOF" >> "${GITHUB_OUTPUT}"     # fixed delimiter
echo "${RESPONSE}" >> "${GITHUB_OUTPUT}"              # attacker-influenced
echo "EOF" >> "${GITHUB_OUTPUT}"                       # fixed delimiter

Fix

Replace fixed EOF with a random per-invocation delimiter:

_DELIM="ghdelim_$(openssl rand -hex 16)"
echo "gemini_response<<${_DELIM}" >> "${GITHUB_OUTPUT}"
echo "${RESPONSE}" >> "${GITHUB_OUTPUT}"
echo "${_DELIM}" >> "${GITHUB_OUTPUT}"

This follows the canonical pattern from GitHub's official docs.

Impact

  • Present since v0.1.12 (PR Release: v0.1.12 #247, 2025-08-25)
  • Affects both gemini_response and gemini_errors output channels
  • Zero authentication required (public issue triggers the flow)
  • Distinct from GHSA-62f2-6rx8-v262 (TOML template fix) - same repo, different vulnerability

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions