locked
q RRS feed

  • Question

  • Question text

    Which vulnerability does the following code snippet suffer from?
    <?php
    $search = mysql_real_escape_string($_GET['search']);
    $qid = mysql_query("select * from books where title like %$search%");
    echo "You searched for: " . trim($search) . " <hr />Results: <br /><ol>";
    while ($result = mysql_fetch_array($qid))
        echo "<li>${result['title']}</li>\n";
    echo "</ol>\n";

    Select one:
    <input id="q6366:2_answer0" name="q6366:2_answer" type="radio" value="0" /><label for="q6366:2_answer0">Cross Site Scripting (XSS)</label>
    <input id="q6366:2_answer1" name="q6366:2_answer" type="radio" value="1" /><label for="q6366:2_answer1">XML Entity Injection</label>
    <input id="q6366:2_answer2" name="q6366:2_answer" type="radio" value="2" /><label for="q6366:2_answer2">Local and/or Remote File Inclusion</label>
    <input id="q6366:2_answer3" name="q6366:2_answer" type="radio" value="3" /><label for="q6366:2_answer3">SQL Injection</label>
    <input id="q6366:2_answer4" name="q6366:2_answer" type="radio" value="4" /><label for="q6366:2_answer4">There is no vulnerability present</label>
    • Moved by Mike Danes Sunday, April 12, 2015 6:05 AM nothing to do with .NET BCL
    Sunday, April 12, 2015 3:55 AM

Answers

  • We will not do your homework for you.

    If this is not for a class, please explain what exacly you are looking for?

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    • Proposed as answer by Just Karl Tuesday, April 21, 2015 5:53 PM
    • Marked as answer by Just Karl Monday, May 4, 2015 10:37 PM
    Tuesday, April 14, 2015 6:20 PM

All replies

  • And you're posting a PHP/HTML/MySQL security question in the .NET BCL forum because?
    Sunday, April 12, 2015 6:05 AM
  • We will not do your homework for you.

    If this is not for a class, please explain what exacly you are looking for?

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    • Proposed as answer by Just Karl Tuesday, April 21, 2015 5:53 PM
    • Marked as answer by Just Karl Monday, May 4, 2015 10:37 PM
    Tuesday, April 14, 2015 6:20 PM