Last active
March 7, 2021 16:44
-
-
Save hahwul/b648e6d1c8c4a1ac79041024047759a2 to your computer and use it in GitHub Desktop.
Vuln web for path based XSS testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"time" | |
"net/url" | |
"github.com/labstack/echo" | |
"github.com/tylerb/graceful" | |
) | |
func main() { | |
e := echo.New() | |
e.GET("/", func(c echo.Context) error { | |
return c.String(http.StatusOK, "Hi wanda :D") | |
}) | |
// Router & Handler | |
e.GET("/xss/:name/1", func(c echo.Context) error { | |
name,_ := url.QueryUnescape(c.Param("name")) | |
return c.HTML(http.StatusOK, name) | |
}) | |
e.GET("/xss/:name/2", func(c echo.Context) error { | |
name,_ := url.QueryUnescape(c.Param("name")) | |
response := "<script>\n a = '"+name+"' \n</script>" | |
return c.HTML(http.StatusOK, response) | |
}) | |
e.GET("/xss/:name/3", func(c echo.Context) error { | |
name,_ := url.QueryUnescape(c.Param("name")) | |
response := "<div class='"+name+"'>abcd</div>" | |
return c.HTML(http.StatusOK, response) | |
}) | |
e.Server.Addr = ":8070" | |
// Serve it like a boss | |
graceful.ListenAndServe(e.Server, 5*time.Second) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"time" | |
"net/url" | |
"github.com/labstack/echo" | |
"github.com/tylerb/graceful" | |
) | |
func main() { | |
e := echo.New() | |
e.GET("/", func(c echo.Context) error { | |
return c.String(http.StatusOK, "path base xss , vuln server :D") | |
}) | |
// Router & Handler | |
e.GET("/users/:name/1234", func(c echo.Context) error { | |
name,_ := url.QueryUnescape(c.Param("name")) | |
return c.HTML(http.StatusOK, name) | |
}) | |
e.Server.Addr = ":8070" | |
// Serve it like a boss | |
graceful.ListenAndServe(e.Server, 5*time.Second) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Testing