Security: App Security Controls - Paiet/Tech-Journal-for-Everything GitHub Wiki

Page Contents:

    <?php
    $username = $_GET['username'];
    echo "<H1>Hello $username, welcome to ITProTV</H1><br><br>";
    echo "<a href='http://itpro.tv/'>Click here to continue to ITProTV</a>";
    ?>

  • Proper URL:
                http://127.0.0.1/index.php?username=Don

  • Attack URL:
        Download these show notes using the link above to see the
        full syntax

  • URL Substitution:
                http://127.0.0.1/index.php?username=<script>window.onload = function() {var link=document.getElementsByTagName("a");link[0].href="http://google.com/";}</script>

Input Validation:

    <?php
    $username = $_GET['username'];
    $username = htmlspecialchars($username);
    echo "<H1>Hello $username, welcome to ITProTV</H1><br><br>";
    echo "<a href='http://itpro.tv/'>Click here to continue to ITProTV</a>";
    ?>

or

    <?php
    $username = $_GET['username'];
    $username = preg_replace("/[^A-Za-z\- ]/", '', $username);
    echo "<H1>Hello $username, welcome to ITProTV</H1><br><br>";
    echo "<a href='http://itpro.tv/'>Click here to continue to ITProTV</a>";
    ?>
⚠️ **GitHub.com Fallback** ⚠️