llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · github.com/seaweedfs/seaweedfs

GHSA-47FC-CJ9R-GHPM

aws:SourceIp policy condition is spoofable via X-Forwarded-For/X-Real-Ip behind any private-looking peer

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
9.1
Crítica
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición11 dDesde la divulgación, 9 nov 2026, 2:48 p. m.
Detección10 dDesde la divulgación hasta su ingreso al índice
Decisión estimadaAtender
Priorizar en el próximo ciclo de cambios
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, automatizable e impacto técnico total. No hay versión corregida: aplique mitigaciones.
Pide el café grande y agenda el parche.Inventaria, prioriza y ponle fecha. Esta semana.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
9 nov 26
20 nov 26
21 nov 26
9 nov 26
12 nov 26
15 nov 26
18 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-47FC-CJ9R-GHPM divulgada · CVSS 9.1 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Summary

SeaweedFS's S3 gateway supports the `aws:SourceIp` bucket-policy and IAM-policy condition key for restricting access by client IP. Two independent implementations resolve this value: `weed/s3api/policy_engine/engine.go`'s `extractSourceIP` (bucket policies) and `weed/s3api/s3_iam_middleware.go`'s `extractSourceIP` (IAM role/session policies). Both trust `X-Forwarded-For`/`X-Real-Ip` whenever the connecting TCP peer's address looks private or loopback, with no admin-configured trusted-proxy allowlist. Any deployment where the gateway sits behind an in-cluster ingress, load balancer, or sidecar on the same private network, the default topology for containerized/Kubernetes deployments, treats every such connection as a trusted proxy hop and adopts the client-supplied header value as the resolved source IP.

Real AWS S3 evaluates `aws:SourceIp` from the requester's connecting IP, not a header. Both call sites here diverge from that guarantee, letting a caller who can reach the gateway (directly, or from another workload on the same private network segment) spoof any source IP and bypass an IP-restricted `Allow`/`Deny` statement.

Details

`weed/s3api/policy_engine/engine.go`, `extractSourceIP` (pre-fix): if `isPrivateIP(remoteIP)` (loopback, link-local, or RFC1918), it scanned `X-Forwarded-For` right-to-left for the first public-looking entry and returned it, falling back to `X-Real-Ip`. `weed/s3api/s3_iam_middleware.go` had a second, independent `extractSourceIP` with the same private-peer gate, taking the left-most `X-Forwarded-For` entry (client-prependable) or `X-Real-IP` directly.

Both feed a security decision. The bucket-policy path: `ExtractConditionValuesFromRequest` sets `values["aws:SourceIp"]`, consumed by `PolicyEngine.EvaluatePolicy`. The IAM path: `extractRequestContext` sets `context["aws:SourceIp"]`, consumed by `IsPrincipalActionExplicitlyDenied` (`weed/s3api/auth_credentials.go`) for role/session policy conditions.

The private-peer check is not a trusted-proxy allowlist; it accepts any connection whose address happens to fall in RFC1918/loopback/link-local ranges. In a typical Kubernetes deployment the S3 gateway's pod IP, and every other pod's IP, is private, so the check cannot distinguish the cluster's own ingress from an attacker-controlled pod on the same network, or from a caller who reaches the gateway's ClusterIP/NodePort directly and skips the ingress entirely.

Proof of Concept

Against `weed/s3api/policy_engine/engine.go` (pre-fix), a bucket policy denying access outside `10.0.0.0/8`:

func TestExtractSourceIP_BypassesIPRestrictionPolicy(t *testing.T) {
	engine := NewPolicyEngine()
	policyJSON := `{
		"Version": "2012-10-17",
		"Statement": [
			{"Effect": "Allow", "Principal": "*", "Action": ["s3:GetObject"],
			 "Resource": "arn:aws:s3:::secret-bucket/*"},
			{"Effect": "Deny", "Principal": "*", "Action": ["s3:GetObject"],
			 "Resource": "arn:aws:s3:::secret-bucket/*",
			 "Condition": {"NotIpAddress": {"aws:SourceIp": ["10.0.0.0/8"]}}}
		]
	}`
	engine.SetBucketPolicy("secret-bucket", policyJSON)

	r := httptest.NewRequest(http.MethodGet, "/secret-bucket/secret-key", nil)
	r.RemoteAddr = "10.0.0.5:54321"           // e.g. an in-cluster ingress
	r.Header.Set("X-Forwarded-For", "203.0.113.99") // outside 10.0.0.0/8

	result := engine.EvaluatePolicy("secret-bucket", &PolicyEvaluationArgs{
		Action: "s3:GetObject", Resource: "arn:aws:s3:::secret-bucket/secret-key",
		Principal: "*", Conditions: ExtractConditionValuesFromRequest(r),
	})
	// pre-fix: result == PolicyResultAllow (bug); expected PolicyResultDeny
}

Result before the fix:

--- FAIL: TestExtractSourceIP_BypassesIPRestrictionPolicy (0.00s)
    BUG: request outside the trusted 10.0.0.0/8 range was allowed by spoofing X-Forwarded-For

The IAM-policy path (`weed/s3api/s3_iam_middleware.go`) has the identical bypass; the existing `TestIPBasedPolicyEnforcement` test already covered the code path and, before the fix, asserted the spoofable behavior as correct (RemoteAddr fixed at `127.0.0.1`, source IP taken from `X-Forwarded-For`).

Impact

Any operator relying on `aws:SourceIp` to restrict a bucket or IAM policy to a trusted network range gets no enforcement of that restriction once the gateway sits behind anything on a private network, the default for containerized deployments. An attacker who can reach the gateway, directly or from another workload sharing the private network, spoofs `X-Forwarded-For`/`X-Real-Ip` to satisfy the condition and reach whatever the policy would otherwise gate: read or write access to a bucket, or an IAM role/session action restricted to an office or VPC CIDR.

Affected: `github.com/seaweedfs/seaweedfs`, confirmed on commit `213f4c5d5c8ae866298b4a36e18e27fb0a903214` (current `master`).

Fix

`extractSourceIP` in both `weed/s3api/policy_engine/engine.go` and `weed/s3api/s3_iam_middleware.go` now always returns the direct TCP peer address (`r.RemoteAddr`), matching AWS's own `aws:SourceIp` semantics. The header-trust branch and the now-unused `isPrivateIP` helpers/private-CIDR tables were removed from both files.

-func extractSourceIP(r *http.Request) string {
-	...
-	if isPrivateIP(remoteIP) {
-		if xff := r.Header.Get("X-Forwarded-For"); xff != "" {
-			// scan for a public-looking entry and trust it
-			...
-		}
-		if xRealIP := ...; xRealIP != "" {
-			return xRealIP
-		}
-	}
-	return remoteIP.String()
-}
+func extractSourceIP(r *http.Request) string {
+	// aws:SourceIp is always the direct TCP peer; there is no trusted-proxy
+	// allowlist to tell a real proxy hop from the caller apart.
+	...
+	return remoteIP.String()
+}

Three pre-existing tests had encoded the spoofable behavior as its expectation and were updated to assert the fixed behavior instead: `TestExtractConditionValuesFromRequestSourceIPPrecedence` (`policy_engine/engine_test.go`), `TestRequestContextExtraction` and `TestIPBasedPolicyEnforcement` (`s3_jwt_auth_test.go`). New regression tests were added: `TestExtractSourceIP_IgnoresForwardedHeaders` and `TestExtractSourceIP_EnforcesIPRestrictionPolicy` (`policy_engine`), `TestUserInlinePolicySourceIpCondition_IgnoresForwardedHeaders` (`s3api`). `go test ./weed/s3api/...` passes across every package after the change.

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

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA: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

Rangos afectados

Afectada Corregida
github.com/seaweedfs/seaweedfs≤ 4.46
4.46
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Gogithub.com/seaweedfs/seaweedfs
Sin parche — — —
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/seaweedfs/seaweedfs/security/advisories/GHSA-47fc-cj9r-ghpm

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