Last active
August 29, 2015 14:21
-
-
Save dmitris/7f7cf36bd43aae713b89 to your computer and use it in GitHub Desktop.
XSS injection inside of a tag (UNSAFE code, use with caution and remember to shut down the server!)
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 ( | |
"fmt" | |
"net/http" | |
"net/url" | |
) | |
func main() { | |
http.HandleFunc("/", badHandler) | |
http.ListenAndServe(":8184", nil) | |
} | |
// Purposedly unsafe!! DO NOT USE in any setting where it can lead to a compromise! | |
func badHandler(w http.ResponseWriter, r *http.Request) { | |
w.Header().Set("Content-type", "text/html; charset=utf-8") | |
unsafe, _ := url.QueryUnescape(r.RequestURI) | |
fmt.Fprintf(w, "<!doctype html>\n<B>URL: %s</B>", unsafe) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment