Advertisement
Linkcabin

MYSQL Injection Vuln Script Example

May 9th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.22 KB | None | 0 0
  1. <?php
  2. /*
  3.                                     ███▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬▓█
  4.                                     ███▓███████▓▓╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▓▓▓█▓╬╬╬▓█
  5.                                     ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
  6.                                     ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
  7.                                     ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
  8.                                     ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
  9.                                     ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
  10.                                     ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
  11.                                     ███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
  12.                                     ████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
  13.                                     ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
  14.                                     █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
  15.                                     █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
  16.                                     █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
  17.                                     ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
  18.                                     ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
  19.                                     █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
  20.                                     █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
  21.                                     ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
  22.                                     ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
  23.                                     ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
  24.                                     ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
  25.                                     █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
  26.                                     ██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
  27.                                     ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
  28.                                     ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
  29.                                     ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
  30.         CREDITS:
  31. Originator:sec4app.com
  32. Presenter: LinkCabin
  33. Description: MYSQL Vuln Script Example, use for research ONLY
  34. Channel Link: http://youtube.com/linkcabin
  35. */
  36.  
  37. $username=$_GET['username'];
  38.  
  39. // GET method in URL E.G index.php?username=1
  40.  
  41. if($username)
  42. {
  43.  
  44.  
  45.  
  46. $conn=mysql_connect('localhost','root','') or die('Error: ' . mysql_error());
  47. mysql_select_db ('sqlvuln');
  48. // DB Config here
  49.  
  50.  
  51.  
  52. $SQL="SELECT * from `table` where `user`='".$username."'";
  53. //SQL statement
  54.  
  55. $result=mysql_query($SQL) or die('Error: ' . mysql_error());;
  56. // Run query
  57.  
  58. $row=mysql_fetch_array($result);
  59. if($row['user'])
  60. {
  61. echo "Username:".$row['user']."<br>";
  62. echo "TestOK!<br>";
  63. }
  64. else
  65. {
  66. echo "No Record!";
  67. }
  68. mysql_free_result($result);
  69. mysql_close();
  70. }
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement