HyperText Transfer Protocol
Input from untrusted source!
<form action="login"> <ul style="list-style-type:none"> <li> Username: <input type="text" name="uname" /> </li> <li> Password: <input type="password" name="password" /> </li> </ul> <input type="submit" value="Login" /> </form>
HTTP/1.0 POST login host: www.example.com uname=<uname>&pass=<password>
protected void doPost(HttpServletRequest request, HttpServletResponse response) { String uname = request.getParameter("uname"); String passwd = request.getParameter("password"); signInUser(uname,passwd); }
uname = | user.getUname() |
pass = | user.getPass() |
out.println(this.header()+ "<h1>XSS UserList" + "</h1>\n" + "<ul>\n"); while(users.hasNext()) { User user = users.next(); /* Output Encoding, you are not doing it! */ out.println("<li>"+user.getUname()+ ":" +user.getPass()+ "</li>"); } out.println("</ul>\n"+ this.footer());
<h2>XSS UserList</h2> <ul> <li>Sabine:6da91b75e</li> <li>Erika:5ed73af66</li> <li>Evelin:123456</li> <li>Solveig:0c07abddde</li> <li>Kathrin:1849933d93</li> <li>Natalie:e673ded9d9</li> </ul>
out.println(this.header()+ "<h1>XSS UserList" + "</h1>\n" + "<ul>\n"); while(users.hasNext()) { User user = users.next(); /* Output Encoding, you are not doing it! */ out.println("<li>"+ Encode.forHtmlContent(user.getUname()) + ":" + Encode.forHtmlContent(user.getPass()) + "</li>"); } out.println("</ul>\n"+ this.footer());
Special Characters: "<",">" | ⟾ | "<", ">" |