CVE-2021-43287 CVE-2021-43288 CVE-2021-43289 CVE-2021-43290
Auteur / Author: Higor Farias — PRIDE Security
⚠️ AVIS JURIDIQUE / LEGAL DISCLAIMER
[PT] Matériel produit exclusivement à des fins éducatives et de recherche en sécurité offensive. À utiliser uniquement dans des environnements contrôlés avec autorisation explicite. Tout usage abusif relève de la seule responsabilité de l'utilisateur.
[EN] Produced exclusively for educational and authorized offensive security research purposes. Use only in controlled environments with explicit written permission. Misuse is the sole responsibility of the user.
[PT] GoCD est une plateforme de CI/CD maintenue par ThoughtWorks. Dans les versions antérieures à 21.3.0, des chercheurs de SonarSource ont identifié une chaîne de vulnérabilités exploitable sans aucune authentification. Les deux scripts de ce dépôt démontrent :
gocd_rce_noauth.py — exploitation complète de la chaîne jusqu'à RCE (Exécution de Code à Distance), sans identifiants.gocd_urldns.py — détection out-of-band de la désérialisation Java via la gadget chain URLDNS et un callback DNS (nécessite des identifiants valides pour lister les agents enregistrés).[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 occupe une position centrale dans la chaîne de livraison logicielle d'une organisation : il orchestre la compilation, les tests, la génération d'artefacts et les déploiements en production. En compromettant le serveur GoCD via RCE (comme le démontre gocd_rce_noauth.py), un attaquant obtient le contrôle sur toutes les étapes de ce processus — pouvant insérer des backdoors dans les binaires, falsifier des artefacts ou exfiltrer du code source et des identifiants avant même qu'un produit n'atteigne l'utilisateur final. Le scénario est analogue à l'attaque contre SolarWinds (2020), où l'accès au pipeline de build a abouti à la distribution de malware à des milliers de clients.
[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. Vulnérabilités / Vulnerabilities
| CVE | Type | CVSS 3.1 | CWE | Auth |
|-----|-------------|:---:|-----|:---:|
| **CVE-2021-43287** | Divulgation d'informations | **7.5 HIGH** | CWE-200 | ❌ Aucune / None |
| **CVE-2021-43288** | XSS stocké | **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 : fuite sans authentification / unauthenticated leak
**[PT]** O endpoint `/go/add-on/business-continuity/api/cruise_config` devolve o XML completo de configuração do servidor **sem exigir autenticação**. O XML contém os atributos do elemento `<server>`, incluindo `agentAutoRegisterKey` e `tokenGenerationKey` — as duas chaves necessárias para registrar agentes e assinar requisições autenticadas. Adicionalmente, o parâmetro `pluginName` do endpoint de plugins aceita sequências de path traversal (`../../../../../../`), permitindo leitura de arquivos arbitrários do sistema — como `/proc/self/environ` e `/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`.