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"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/NYTimes/gziphandler"
|
||||
|
@ -296,9 +297,9 @@ func (as *AdminServer) nextOrIndex(w http.ResponseWriter, r *http.Request) {
|
|||
next := "/"
|
||||
url, err := url.Parse(r.FormValue("next"))
|
||||
if err == nil {
|
||||
path := url.Path
|
||||
path := url.EscapedPath()
|
||||
if path != "" {
|
||||
next = path
|
||||
next = "/" + strings.TrimLeft(path, "/")
|
||||
}
|
||||
}
|
||||
http.Redirect(w, r, next, http.StatusFound)
|
||||
|
|
Loading…
Reference in New Issue