ChatGPT Desktop Passes Forwarded SSH Keys to Its Remote Coding Agent

Summary
A review of ChatGPT’s macOS app found that it passes through SSH agent sockets when a host’s config enables forwarding, letting its remote Codex agent use loaded keys. The article explains prompt-injection risks and safeguards.
Key points
- The app does not enable SSH agent forwarding itself; it follows the user's SSH configuration.
- When forwarding is enabled, the app links the remote session's SSH_AUTH_SOCK for its background Codex server, and commands run by the agent inherit access to the forwarded agent.
- The remote server can use keys loaded in the user's local agent to authenticate, though the article says the keys cannot be copied out.
- The article warns that prompt injection could influence the text-reading agent while the forwarded identity is available; Codex's default network restrictions and command approval prompts are described as safeguards.
- A report cited in the article says a newer connection can replace the shared socket link when two computers connect to the same server account.
- The article recommends checking the effective ForwardAgent setting, using a separate SSH alias with forwarding disabled, or limiting key use with confirmation, host restrictions, or a narrowly scoped deploy key.
Article Details
- Attack Vectors
- When SSH agent forwarding is enabled in the user's SSH configuration, the ChatGPT desktop app links the forwarded agent socket on the remote server and makes it available to commands run by Codex.
- A coding agent that reads a booby-trapped README or issue could be prompted to follow untrusted instructions and use the forwarded keys while the session is active.
- A user with access to the remote host, including root, may be able to use the forwarded agent to authenticate as the key owner while the connection remains active, although the keys cannot be copied out.
- With ForwardAgent yes under Host *, the forwarded agent may be exposed to every server the user connects to; connections from multiple computers to the same server account can also replace the shared socket link.
- Defensive Notes
- Check the effective setting with `ssh -G <alias> | grep -i forwardagent`; use `ForwardAgent no` for the app's SSH alias and place it before any matching `Host *` block.
- Check whether the forwarded socket link exists on the server with `ls -l ~/.codex/app-server-control/forwarded-ssh-agent.sock`.
- Use `ssh-add -c` to require confirmation for key use, or `ssh-add -h` on OpenSSH 8.9 and later to restrict the hosts for which a key may be used.
- Avoid forwarding personal keys; use a separate server-side key with only the required access, such as a repository-specific GitHub deploy key.
- Codex reportedly runs with network access off by default and asks before commands requiring it, but the article cautions that this confirmation is only protective if the user reviews it.
People
Vendors
Products
ChatGPTIf your SSH setup forwards your agent, the ChatGPT desktop app hands it to the coding agent it runs on your remote machine.CodexCodex, OpenAI’s coding agent, has been part of the ChatGPT desktop app for macOS and Windows since 9 July, according to OpenAI’s changelog.GitHubThat agent can then sign in wherever your keys work, GitHub included.OpenSSHThe app connects with your host alias through OpenSSH, the documentation says.
