Source for file ids.php

Documentation is available at ids.php

  1. <?php
  2. ////////////////////////////////////////////////////////////////////////////////
  3. // Copyright (C) ReloadCMS Development Team //
  4. // http://reloadcms.sf.net //
  5. // //
  6. // This program is distributed in the hope that it will be useful, //
  7. // but WITHOUT ANY WARRANTY, without even the implied warranty of //
  8. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. //
  9. // //
  10. // This product released under GNU General Public License v2 //
  11. ////////////////////////////////////////////////////////////////////////////////
  12.  
  13. if(!empty($system->config['enable_ids'])){
  14. $urlref = ($_SERVER['REQUEST_URI']);
  15.  
  16. if(isset($_COOKIE['UID'])) {
  17. print('Error connecting to MySQL database. Please try later');
  18. die();
  19. }
  20. function logattack(){
  21. global $system;
  22. rcms_log_put('Hack attempt', $system->user['username'], 'Remote address: ' . ($_SERVER['REMOTE_ADDR']) . "\n" .
  23. 'Suspected URI: ' . ($_SERVER['REQUEST_URI']) . "\n" . 'Suspected referer: ' . ($_SERVER['HTTP_REFERER']) . "\n" .
  24. 'User agent: ' . ($_SERVER['HTTP_USER_AGENT']) . "\n");
  25. }
  26.  
  27. // search of SQL Injections like a index.php?module=articles&c=news&b=1&a=1+[SQL injection here]
  28. if ((stristr($urlref, 'articles')) AND (stristr($urlref, 'news')) AND (stristr($urlref, 'union')))
  29. {
  30. logattack();
  31. print ('You have an error in your SQL syntax near \'WHERE newsid =');
  32. die();
  33. }
  34.  
  35. // search of SQL Injections like a index.php?module=articles&c=news&b=1+[SQL injection here]&a=1
  36. if ((stristr($urlref, 'module=articles')) AND (stristr($urlref, 'b=+')) AND (stristr($urlref, 'union')))
  37. {
  38. logattack();
  39. print ('You have an error in your SQL syntax near \'WHERE bid =');
  40. die();
  41. }
  42.  
  43. // search of trivial fopen bug like index.php?module=user.list&user=../../../../etc/passwd
  44. if ((stristr($urlref, 'user.list')) AND (stristr($urlref, 'user')) AND (stristr($urlref, 'etc/passwd')))
  45. {
  46. logattack();
  47. print ('failed to open stream: No such file or directory /etc/passwd');
  48. die();
  49. }
  50.  
  51. // search of trivial fopen bug like index.php?module=user.list&user=../../../../etc/shadow
  52. if ((stristr($urlref, 'user.list')) AND (stristr($urlref, 'user')) AND (stristr($urlref, 'etc/shadow')))
  53. {
  54. logattack();
  55. print ('failed to open stream: No such file or directory /etc/shadow');
  56. die();
  57. }
  58.  
  59. // search of SQL Injections in gallery
  60. if ((stristr($urlref, '=gallery')) AND (stristr($urlref, 'id=')) AND (stristr($urlref, 'union')))
  61. {
  62. logattack();
  63. print ('You have an error in your SQL syntax near \'WHERE imageid =');
  64. die();
  65. }
  66.  
  67. // Test for DoS via SQL injection like index.php?[someparam]=BENCHMARK(10000000,BENCHMARK(10000000,md5(current_date)))
  68. if (stristr($urlref, 'benchmark'))
  69. {
  70. logattack();
  71. setcookie('UID', rand(2,50), time()+7200);
  72. die();
  73. }
  74. //Showing some usefulpasswd file ;)
  75. if (stristr($urlref, 'module=../../../../etc/passwd'))
  76. {
  77. $passwdfile='
  78. root:x:0:0::/root:/bin/bash
  79. bin:x:1:1:bin:/bin:
  80. daemon:x:2:2:daemon:/sbin:
  81. adm:x:3:4:adm:/var/log:
  82. lp:x:4:7:lp:/var/spool/lpd:
  83. sync:x:5:0:sync:/sbin:/bin/sync
  84. shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
  85. halt:x:7:0:halt:/sbin:/sbin/halt
  86. mail:x:8:12:mail:/:
  87. news:x:9:13:news:/usr/lib/news:
  88. uucp:x:10:14:uucp:/var/spool/uucppublic:
  89. operator:x:11:0:operator:/root:/bin/bash
  90. games:x:12:100:games:/usr/games:
  91. ftp:x:14:50::/home/ftp:
  92. smmsp:x:25:25:smmsp:/var/spool/clientmqueue:
  93. mysql:x:27:27:MySQL:/var/lib/mysql:/bin/bash
  94. rpc:x:32:32:RPC portmap user:/:/bin/false
  95. sshd:x:33:33:sshd:/:
  96. gdm:x:42:42:GDM:/var/state/gdm:/bin/bash
  97. pop:x:90:90:POP:/:
  98. nobody:x:99:99:nobody:/:
  99. firebird:x:1006:102:Firebird Database Administrator:/opt/firebird:/bin/bash
  100. sql:x:1007:100:,,,:/home/sql:/bin/bash
  101. nagios:x:1008:100::/home/nagios:
  102. iconci:x:1009:100:Iconci,,,:/home/iconci:/bin/bash
  103. httpd:x:1010:104:Apache HTTPD User,,,:/home/httpd:/bin/bash
  104. ';
  105. logattack();
  106. print($passwdfile);
  107. die();
  108. }
  109.  
  110. //And showing more useful shadow file withe real passwords ;)
  111. if(stristr($urlref, 'module=../../../../etc/shadow')) {
  112. $shadowfile='
  113. root:$1$SWU0pAUD$Ht3oFKJy/Qt/Cp.yTvygZ1:12835:0:99999:7:::
  114. bin:*:12796:0:99999:7:::
  115. daemon:*:12796:0:99999:7:::
  116. adm:*:12796:0:99999:7:::
  117. lp:*:12796:0:99999:7:::
  118. sync:*:12796:0:99999:7:::
  119. shutdown:*:12796:0:99999:7:::
  120. halt:*:12796:0:99999:7:::
  121. mail:*:12796:0:99999:7:::
  122. news:*:12796:0:99999:7:::
  123. uucp:*:12796:0:99999:7:::
  124. operator:*:12796:0:99999:7:::
  125. games:*:12796:0:99999:7:::
  126. gopher:*:12796:0:99999:7:::
  127. nobody:*:12796:0:99999:7:::
  128. vcsa:!!:12796:0:99999:7:::
  129. rpm:!!:12796:0:99999:7:::
  130. xfs:!!:12796:0:99999:7:::
  131. rpc:!!:12796:0:99999:7:::
  132. dbus:!!:12796:0:99999:7:::
  133. mailnull:!!:12796:0:99999:7:::
  134. smmsp:!!:12796:0:99999:7:::
  135. rpcuser:!!:12796:0:99999:7:::
  136. nfsnobody:!!:12796:0:99999:7:::
  137. nscd:!!:12796:0:99999:7:::
  138. ntp:!!:12796:0:99999:7:::
  139. sshd:!!:12796:0:99999:7:::
  140. pcap:!!:12796:0:99999:7:::
  141. amanda:!!:12796:0:99999:7:::
  142. named:!!:12796:0:99999:7:::
  143. apache:!!:12796:0:99999:7:::
  144. desktop:!!:12796:0:99999:7:::
  145. mailman:!!:12796:0:99999:7:::
  146. fax:!!:12796:0:99999:7:::
  147. mysql:!!:12796:0:99999:7:::
  148. nut:!!:12796:0:99999:7:::
  149. postgres:!!:12796:0:99999:7:::
  150. pvm:!!:12796:0:99999:7:::
  151. squid:!!:12796:0:99999:7:::
  152. webalizer:!!:12796:0:99999:7:::
  153. wnn:!!:12796:0:99999:7:::
  154. nagios:!!:12796:0:99999:7:::
  155. netdump:!!:12796:0:99999:7:::
  156. popa3d:!!:12796:0:99999:7:::
  157. snort:!!:12796:0:99999:7:::
  158. admin:$1$A/TbUhKj$UOoGXnP3gWgaCFFDukJhQ/:12848:0:99999:7:::';
  159. logattack();
  160. print($shadowfile);
  161. die();
  162. }
  163. }
  164. ?>

Documentation generated on Fri, 08 Jun 2007 12:21:24 +0300 by phpDocumentor 1.3.0RC3