CVE-2021-43287 CVE-2021-43288 CVE-2021-43289 CVE-2021-43290
Autor / Author: Higor Farias — PRIDE Security
⚠️ AVISO LEGAL / LEGAL DISCLAIMER
[PT] Material produzido exclusivamente para fins educacionais e de pesquisa em segurança ofensiva. Utilize somente em ambientes controlados com autorização explícita. O uso indevido é de responsabilidade exclusiva do utilizador.
[EN] Producido exclusivamente con fines educativos y de investigación en seguridad ofensiva autorizada. Utilícelo únicamente en entornos controlados con permiso explícito por escrito. El uso indebido es responsabilidad exclusiva del usuario.
[PT] GoCD es una plataforma de CI/CD mantenida por ThoughtWorks. En versiones anteriores a la 21.3.0, investigadores de SonarSource identificaron una cadena de vulnerabilidades explotable sin ninguna autenticación. Los dos scripts de este repositorio demuestran:
gocd_rce_noauth.py — explotación completa de la cadena hasta RCE (Ejecución Remota de Código), sin credenciales.gocd_urldns.py — detección out-of-band de la deserialización Java mediante la gadget chain URLDNS y callback DNS (requiere credenciales válidas para listar agents registrados).[EN] GoCD is a CI/CD platform maintained by ThoughtWorks. In versions prior to 21.3.0, SonarSource researchers identified a vulnerability chain exploitable with zero authentication. The two scripts in this repository demonstrate:
gocd_rce_noauth.py — full chain exploitation up to RCE (Remote Code Execution), without credentials.gocd_urldns.py — out-of-band detection of Java deserialization via the URLDNS gadget chain and a DNS callback (requires valid credentials to list registered agents).[PT] GoCD ocupa una posición central en la cadena de entrega de software de una organización: orquesta la compilación, las pruebas, la generación de artefactos y los despliegues en producción. Al comprometer el servidor GoCD vía RCE (como lo demuestra gocd_rce_noauth.py), un atacante obtiene control sobre todas las etapas de ese proceso — pudiendo insertar backdoors en binarios, falsificar artefactos o exfiltrar código fuente y credenciales antes incluso de que cualquier producto llegue al usuario final. El escenario es análogo al ataque a SolarWinds (2020), donde el acceso al pipeline de build resultó en la distribución de malware a miles de clientes.
[EN] GoCD occupies a central position in an organization's software delivery chain: it orchestrates builds, tests, artifact generation, and production deployments. By compromising the GoCD server via RCE (as demonstrated by gocd_rce_noauth.py), an attacker gains control over every stage of that process — enabling backdoor insertion into binaries, artifact tampering, or source code and credential exfiltration before any product reaches the end user. The scenario mirrors the SolarWinds attack (2020), where build pipeline access led to malware distribution to thousands of customers.```mermaid
flowchart TD
ATK(["🕵️ Atacante / Attacker\n(não autenticado / unauthenticated)"])
subgraph EXPLOIT ["Exploração / Exploitation"]
E1["CVE-2021-43287\nLeitura do cruise_config\n(tokenGenerationKey + agentAutoRegisterKey)"]
E2["Path Traversal\nLeitura de /etc/go/jetty.xml\ne /proc/self/environ"]
E3["Registro de agente falso\nFake agent registration"]
E4["Desserialização Java\n(AspectJWeaver gadget chains)\nSobrescreve jetty.xml + restart"]
E5["💥 RCE no servidor GoCD\nRCE on GoCD server"]
E1 --> E2 --> E3 --> E4 --> E5
end
subgraph PIPELINE ["Pipeline CI/CD comprometido / Compromised CI/CD Pipeline"]
P1["📦 Build de artefatos\nBinary/artifact build"]
P2["🧪 Execução de testes\nTest execution"]
P3["📤 Publicação de pacotes\nPackage publication\n(npm, PyPI, Docker Hub...)"]
P4["🚀 Deploy em produção\nProduction deployment"]
P1 --> P2 --> P3 --> P4
end
subgraph IMPACT ["Impacto / Impact"]
I1["🔑 Vazamento de credenciais\nCredential leak\n(tokens, SSH keys, API keys)"]
I2["🦠 Backdoor em artefatos\nBackdoor in build artifacts"]
I3["📂 Exfiltração de código-fonte\nSource code exfiltration"]
I4["☠️ Ataque à cadeia de suprimentos\nSupply chain attack\n(usuários finais afetados / end users impacted)"]
I1 & I2 & I3 --> I4
end
ATK --> EXPLOIT
E5 -->|"Controle total do runner\nFull runner control"| PIPELINE
P1 -->|"Artefatos envenenados\nPoisoned artifacts"| I2
P3 -->|"Pacotes maliciosos\nMalicious packages"| I4
P4 -->|"Produção comprometida\nCompromised production"| I4
E5 -->|"Leitura de secrets\nSecrets read"| I1
E5 -->|"Acesso ao repositório\nRepository access"| I3
---
## 3. Vulnerabilidades / Vulnerabilities
| CVE | Tipo / Type | CVSS 3.1 | CWE | Auth |
|-----|-------------|:---:|-----|:---:|
| **CVE-2021-43287** | Divulgación de información / Information Disclosure | **7.5 HIGH** | CWE-200 | ❌ Ninguna / None |
| **CVE-2021-43288** | XSS almacenado / Stored XSS | **6.1 MEDIUM** | CWE-79 | Agent |
| **CVE-2021-43289** | Path Traversal — PUT | **8.1 HIGH** | CWE-22 | Agent |
| **CVE-2021-43290** | Path Traversal — GET | **8.1 HIGH** | CWE-22 | Agent |
### CVE-2021-43287 — Business Continuity: fuga sin autenticación / unauthenticated leak
**[PT]** El endpoint `/go/add-on/business-continuity/api/cruise_config` devuelve el XML completo de configuración del servidor **sin exigir autenticación**. El XML contiene los atributos del elemento `<server>`, incluyendo `agentAutoRegisterKey` y `tokenGenerationKey` — las dos claves necesarias para registrar agentes y firmar peticiones autenticadas. Adicionalmente, el parámetro `pluginName` del endpoint de plugins acepta secuencias de path traversal (`../../../../../../`), permitiendo la lectura de archivos arbitrarios del sistema — como `/proc/self/environ` y `/etc/go/jetty.xml`.
**[EN]** The `/go/add-on/business-continuity/api/cruise_config` endpoint returns the full server configuration XML **without requiring authentication**. The XML contains the `<server>` element attributes, including `agentAutoRegisterKey` and `tokenGenerationKey` — the two keys needed to register agents and sign authenticated requests. Additionally, the `pluginName` parameter of the plugin endpoint accepts path traversal sequences (`../../../../../../`), allowing arbitrary file reads — such as `/proc/self/environ` and `/etc/go/jetty.xml`.