Skip to content

Commit

Permalink
Backport server: Don't follow redirects when checking peer urls.
Browse files Browse the repository at this point in the history
It's possible that etcd server may run into SSRF situation when adding a new member. If users provide a malicious peer URL, the existing etcd members may be redirected to other unexpected internal URL when getting the new member's version.

Signed-off-by: James Blair <[email protected]>
  • Loading branch information
jmhbnz committed Nov 27, 2023
1 parent 0e64a6d commit 9e21048
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/etcdserver/cluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,9 @@ func isCompatibleWithVers(lg *zap.Logger, vers map[string]*version.Versions, loc
func getVersion(lg *zap.Logger, m *membership.Member, rt http.RoundTripper) (*version.Versions, error) {
cc := &http.Client{
Transport: rt,
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
var (
err error
Expand Down

0 comments on commit 9e21048

Please sign in to comment.