microcks / microcks/microcks-cli
SSRF via Unvalidated import-url Artifact URLs
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 52
- Forks
- 68
- Ø Merge
- 6 Std. 54 Min.
- Gemergte PRs (30 T.)
- 10
Beschreibung
### Describe the bug
There is a SSRF vulnerability due to unvalidated `import-url` artifact URLs. The `import-url` command accepts arbitrary URLs (e.g., `https://`, `http://`) and passes them directly to the `DownloadArtifact` method. This function sends the URL as a form field (`url`) up to the Microcks API endpoint `/api/artifact/download`. The Microcks server then fetches the URL without sufficient validation, lacking an allowlist, private-IP-range blocking, or scheme restriction.
### Expected behavior
The provided URL should be strictly validated before being fetched by the Microcks server. The validation should deny access to private/internal IP ranges (e.g., `169.254.169.254`, `localhost`, `10.x.x.x`), restrict schemes to only allowed protocols, or enforce an explicit allowlist to prevent arbitrary internal network access.
### Actual behavior
The URL is accepted and processed without validation. When the server fetches the provided URL, an attacker can coerce the server to interact with internal networks. The `secret` field (for repository authentication) may also be passed along, meaning the server could be tricked into sending stored credentials to attacker-controlled external endpoints.
### How to Reproduce?
1. Authenticate with the Microcks CLI (e.g., `microcks login ...`).
2. Run the `import-url` command with a payload targeting an internal network resource or cloud metadata endpoint, such as:
```sh
microcks import-url http://169.254.169.254/latest/meta-data/
```
Or to access an internal service:
```sh
microcks import-url http://localhost:8080/api/admin/
```
3. The CLI passes the URL to the server, and the Microcks server fetches it, acting as an SSRF proxy to the internal resource.
### Microcks version or git rev
master
### Install method (`docker-compose`, `helm chart`, `operator`, `docker-desktop extension`,...)
Any deployment where an attacker has CLI or API access to perform a URL import. Highly critical on Cloud environments.
### Additional information
**Code References:**
- `cmd/importURL.go`: The URL from arguments is handled and directly passed to `DownloadArtifact`.
- `pkg/connectors/microcks_client.go`: `DownloadArtifact` embeds the `url` and `secret` unsanitized in the `POST` form data submitted to the server endpoint.
**Real-World Impact:**
In a shared Microcks instance or CI pipeline, any user with `import-url` capabilities can pivot to internal network resources. In cloud deployments, this opens the door to leaking IAM credentials, probing internal networks, and extracting sensitive API responses.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit cmd/importURL.go und pkg/connectors/microcks_client.go und verfolge anschließend, wie die URL und das Secret den Endpunkt /api/artifact/download erreichen. Kläre, wo die Validierung hingehört, und teste die erforderlichen Schemaeinschränkungen sowie die Blockierung privater oder interner Adressen; abgeschlossen ist die Aufgabe, wenn beliebige interne Abrufe und die Weiterleitung von Zugangsdaten verhindert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- go
- Bereich
- api, cli, security
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100