Disclosure
Consul's agent check registration endpoint allowed network requests to arbitrary URLs, enabling access to cloud metadata and potentially remote code execution. An attacker could obtain cloud tokens or execute commands if ACLs were disabled and script checks enabled.
lab.wallarm.com
Published on lab.wallarm.com
Consul is a software first released in 2014 for DNS-based service discovery. It provides distributed key-value storage, segmentation, and configuration.
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 agent check registration endpoint accepts arbitrary URLs and commands without proper access control or validation, and the default configuration disables ACLs and enables script checks.
What the attacker needed
Consul exposed to attacker; ACLsEnabled set to false; EnableLocalScriptChecks true; EnableRemoteScriptChecks true
The fix
The text recommends updating Consul, disabling script checks, ensuring Consul is not exposed, and enabling ACLs.
How it was found
- Send a PUT request to /v1/agent/check/register with a JSON body specifying an HTTP check pointing to the cloud metadata URL.
- The Consul agent makes the request and returns the response, which includes a cloud token.
- Use the token to access cloud APIs, such as listing instances or setting SSH keys.
- Alternatively, send a similar request with a check that specifies a command to execute, leading to arbitrary code execution.
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.
Consul is a tool that helps different parts of a computer system find and talk to each other. A feature that lets you add health checks could be tricked into making requests to sensitive internal addresses, like a cloud provider's secret token service, or even running commands on the server. This only works if certain security settings are turned off.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.