form-test.html 902 B

123456789101112131415161718192021222324252627
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset="utf-8" />
  5. <title></title>
  6. <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
  7. </head>
  8. <body>
  9. <form action="filesave.php">
  10. <input type="hidden" value="" name="output_svg" />
  11. </form>
  12. <script>
  13. /*globals $*/
  14. function xhtmlEscape(str) {'use strict';
  15. return str.replace(/&(?!amp;)/g, '&amp;').replace(/"/g, '&quot;').replace(/</g, '&lt;'); // < is actually disallowed above anyways
  16. }
  17. $('<form>').attr({
  18. method: 'post',
  19. action: 'filesave.php',
  20. target: 'output_frame'
  21. }).append('<input type="hidden" name="output_svg" value="' + xhtmlEscape('<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"><script>alert(document.cookie);<\/script><\/svg>') + '">')
  22. .appendTo('body')
  23. .submit().remove();
  24. </script>
  25. </body>
  26. </html>