GoCD Multiple Vulnerabilities
GoCD leaked the master encryption key for secret variables to every agent, allowed an agent to impersonate any other agent, and deserialized untrusted Java objects leading to remote code execution. An attacker who compromised an agent or its network traffic could decrypt secrets, access other agents' work, and execute code on the server.
Published on pulsesecurity.co.nz
Multiple vulnerabilities were discovered within GoCD. These issues allowed for retrieval of the master secret key from a compromised agent, impersonation of arbitrary agents and remote code execution through deserialization.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server included sensitive objects in serialized responses to agents, failed to bind the authenticated agent identity to the requested agent ID, and deserialized untrusted Java objects without validation.
Impact
An attacker with agent-level access could decrypt all secret variables, access other agents' work (including credentials), and execute arbitrary code on the GoCD server; the report notes that the token generation key issue remains unfixed.
What the attacker needed
Compromised agent or network traffic; or ability to register a new agent; or auto-registration token
The fix
The vulnerabilities were fixed in GoCD v20.11.0-12419, but the missing encryption for the agent token generation key was left as-is.
How it was found
- Compromise an existing GoCD agent or its network traffic, or register a new agent (possibly using an auto-registration token).
- Send a request for work to the GoCD server's remoting endpoint.
- Receive a serialized response that includes a GoCipher object containing the master encryption key.
- Extract the key from the serialized response and use it to decrypt secret variables.
- For agent impersonation, supply a different agent UUID in the serialized object to obtain work intended for that agent.
- For remote code execution, send a crafted serialized object to the remoting endpoint to trigger deserialization and execute arbitrary code.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
GoCD is a tool that automates building and releasing software. It uses small helper programs called agents to run jobs. The report found that these agents were given too much trust: they could see a secret key, pretend to be other agents, and send malicious data that the server would execute. This means someone who took over one agent could steal secrets and run their own code on the main server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.