mirror of https://github.com/gophish/gophish
Fix open redirect vulnerability on the login page (#2262)
parent
e215132bdf
commit
67e304f372
|
@ -7,6 +7,7 @@ import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/NYTimes/gziphandler"
|
"github.com/NYTimes/gziphandler"
|
||||||
|
@ -296,9 +297,9 @@ func (as *AdminServer) nextOrIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
next := "/"
|
next := "/"
|
||||||
url, err := url.Parse(r.FormValue("next"))
|
url, err := url.Parse(r.FormValue("next"))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
path := url.Path
|
path := url.EscapedPath()
|
||||||
if path != "" {
|
if path != "" {
|
||||||
next = path
|
next = "/" + strings.TrimLeft(path, "/")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
http.Redirect(w, r, next, http.StatusFound)
|
http.Redirect(w, r, next, http.StatusFound)
|
||||||
|
|
Loading…
Reference in New Issue