javascript - Cross Site Scripting Attack, troubles -
i'm preparing final exam class , attempting rework homework problems. 1 of them got 0 credit first time around.
the goal of exercise create url point page html below, , instead of showing collaboration policy intended, show own, user created collaboration policy.
attempted following without success...
escaped this
<script>document.getelementbyid('collab').firstchild = 'test';</script>
using website http://www.xs4all.nl/~jlpoutre/bot/javascript/utils/endecode.html
and added this... www.cs.edu/vulnerable.html/?[insert escaped script here] , didn't work. ideas on i'm going wrong here?
here html code (vulnerable.html) page suppose exploit.
<html><head> <script> function loaded() { var parsed = document.location.href.match(/\?(.*)/); if (parsed && parsed[1]) eval(unescape(parsed[1])); } </script> <title>example page title</title></head> <body onload="loaded()" bgcolor="#ffffff"> <font face="arial,arial,helvetica"> <table border=0 cellspacing=4 cellpadding=4> <tr> <td valign=top width="20%" bgcolor="#ffff66"> <p> <p> <p> <a href="home.html"> home</a> <p> course description <p> <a href="notes.html"> lecture notes</a> <p> <a href="assign.html"> assignments</a> <p> <a href="ref.html"> reference</a> <p> <p> <p> <p> </td> <td valign=top width=800> <h2 align=center> example course title </h2> <p> <h3 align=center>fall 2010</h3> <p> <h2>syllabus</h2> syllabus here... <h2>collaboration policy</h2> <p id="collab"> assignments strictly individual. no collaboration permitted. </td> </tr> </table> </font> </body> </html>
remove script tags vector. put eval
function runs javascript, not html.
also want vector be: document.getelementbyid('collab').innerhtml = 'test';
Comments
Post a Comment