GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [SECURITY] "opencode upgrade" fetches a remote script and pipes it to bash with no integrity verification (curl|bash) · Issue #42434 · anomalyco/opencode

[SECURITY] "opencode upgrade" fetches a remote script and pipes it to bash with no integrity verification (curl|bash) #42434

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[SECURITY] "opencode upgrade" fetches a remote script and pipes it to bash with no integrity verification (curl|bash)#42434
Copy link
Assignees
jlongster

Description

@shafqatevo
shafqatevo
opened on Aug 13, 2026
Issue body actions

[SECURITY] opencode upgrade fetches a remote script and pipes it to bash with no integrity verification (curl|bash pattern)

Description

Description

  • Severity: Medium (supply-chain / TOCTOU, full user privileges once action is confirmed)
  • Affected: curl-based installs (installation/index.ts:139-159, present at baef5cd43b and current dev)
  • Related: fix(opencode): validate upgrade requests #42022 (server-side request validation only; does not address the client fetch-and-exec)

Plugins

None required

OpenCode version

Observed in source at commits baef5cd43b and 743f6410f2, current dev branch (code-verified; see References below)

Steps to reproduce

  1. Run opencode upgrade on a curl-based install (upgrade method resolves to `curl`).
  2. Observe GET https://opencode.ai/install → response body piped to bash stdin, extendEnv: true, no checksum verification (packages/opencode/src/installation/index.ts:139-159).
  3. Replace the endpoint content (local DNS/poisoned response) → script executes as the user with full privileges, no user review.

Screenshot and/or share link

N/A — verified against source (details and file:line references below).

Operating System

All (cross-platform; verified on macOS Darwin)


Details

The curl-install upgrade path does exactly the pattern the industry has been moving away from: GET https://opencode.ai/install and pipe the response body straight into a new bash process, with zero integrity verification.

const upgradeCurl = Effect.fnUntraced(function* (target: string) {
  const response = yield* httpOk.execute(HttpClientRequest.get("https://opencode.ai/install"))
  const body = yield* response.text
  const bodyBytes = new TextEncoder().encode(body)
  const proc = ChildProcess.make("bash", [], {
    stdin: Stream.make(bodyBytes),
    env: { VERSION: target },
    extendEnv: true,
  })
  ...

Impact

  1. TOCTOU: the script is fetched and executed as one opaque unit — the bytes the user might have seen in a previous run (or that were served when a previous install happened) are not the bytes that run now. No hash is pinned, computed, or checked.
  2. Full privileges: the script runs as the invoking user with extendEnv: true, i.e. it inherits the shell environment (credentials, ~/.config, SSH agent, etc.).
  3. Single-gate security: the only control between "user said upgrade" and "arbitrary remote code executes" is the prompt. Any compromise of the install endpoint, a CDN/edge compromise, or a poisoned response is unbounded code execution with no user review of what actually runs.
  4. VERSION is passed as an env var but never constrains the executed script to that version — the script itself decides what to install.

Suggested fix

  • Prefer installing from release artifacts (binary archives with published checksums) over executing a remote script.
  • If the script must stay: pin its content hash in the client, verify sha256 of the fetched body before spawn, and refuse on mismatch.
  • At minimum, fetch → render the script for review / print its hash → require explicit confirmation before execution, and never extendEnv secrets into it.

Plugins

None required

OpenCode version

Observed in source at commits baef5cd43b and 743f6410f2, current dev branch (code-verified; file:line references in Details).

Screenshot and/or share link

N/A — verified against source (details and file:line references below).

Operating System

All (cross-platform; verified on macOS Darwin).

Steps to reproduce

  1. Run opencode upgrade on a curl-based install (upgrade method resolves to curl).
  2. Observe GET https://opencode.ai/install → response body piped to bash stdin with extendEnv: true and no checksum verification (packages/opencode/src/installation/index.ts:139-159).
  3. Serve modified content for the endpoint (e.g. local DNS/poisoned response) → script executes as the user with full privileges; the user never reviewed the executed bytes.

Details

Activity

  1. github-actions
    assigned
    jlongster
    on Aug 13, 2026
  2. github-actions commented on Aug 13, 2026

    @github-actions
    github-actionsBot
    on Aug 13, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This issue does not use one of the three required issue templates (Bug Report, Feature Request, or Question). Please re-submit using the appropriate template — the Bug Report template would be the best fit for this security concern.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. github-actions
    added
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Aug 13, 2026
  4. shafqatevo commented on Aug 13, 2026

    @shafqatevo
    shafqatevo
    on Aug 13, 2026
    Author
    More actions

    Compliance addressed: the issue body has been edited to follow the Bug Report template — sections Description, Plugins, OpenCode version, Steps to reproduce, Screenshot and/or share link, and Operating System are all present (details and file:line references preserved under "Details"). Since the duplicate/compliance check runs on edited events, this should clear the compliance flag; if not, happy to re-file via the GitHub UI template.

  5. github-actions
    removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Aug 13, 2026
  6. github-actions commented on Aug 13, 2026

    @github-actions
    github-actionsBot
    on Aug 13, 2026 – with GitHub Actions
    Contributor
    More actions

    Thank you for updating the issue! It now follows the Bug Report template with all required fields filled in and substantive content. The needs:compliance label has been removed.

  7. github-actions commented on Oct 14, 2026

    @github-actions
    github-actionsBot
    on Oct 14, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  8. github-actions
    closed this as not plannedon Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @jlongster
    jlongster

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.