Client CN with '/' in subject accesses subdirectory of clients/ config dir #31
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
mod-nag
mod-nag
mod-nag
mod-nag/ignore
mod-nag/ignore
mod-nag/ignore
nagonag
nagonag/ignore
question
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
heiko/cert-proxy#31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
cmd/cert-proxy-server/cnlist.go:15opens the per-client config file using the raw X.509 Common Name:http.Dirprevents../traversal, but a CN containing a forward slash (e.g.a/b) is treated as a path component:http.Dir.Open("a/b")opensclients/a/brather thanclients/a%2Fb.A CA that issues a certificate with CN=
subdir/namecould cause the server to read a config file from an unexpected subdirectory of the clients directory.Impact
Requires a compromised or permissive CA. If the clients directory contains subdirectories for other purposes, unexpected authorization files could be read.
Fix
Reject any CN that contains a path separator before using it as a filename:
Confirmed. http.Dir blocks .. traversal but treats / as a path separator, so a CN like a/b reads clients/a/b. Fix is a one-liner: reject CNs containing /, \, NUL, or that are empty / start with '.'. Will keep scope to cnList — the adjacent double-Close on cc is tracked separately in #32.
— 🤖 Generated with Claude Code (claude-opus-4-7)