[Programación] Problemas en php
KSTOR
programacion@lugro.org.ar
Wed, 24 Nov 2004 09:26:04 -0300
-----BEGIN PGP SIGNED MESSAGE-----Hash: SHA1
Amigos,...
Tengo un compañero que tiene en su página una especie de foro en PHP.El tema es que existe un bugs por el cual le borran msj y ademáspueden ver la IP de los que postean, etc...
El problema reside en que si en el navegar ingresaswww.pagina.org/foro/reply.php?id=1,1Te devuelve el primer mensaje (el id=1)Pero si pones:www.pagina.org/foro/reply.php?id=1,1 and ip like 1%Busca cualquier mensaje que cumpliese la segunda condición, e imaginoque por este método es posible inyectar ordenes delete.Mi amigo añadió estas dos instrucciones para intentar resolverlo
$ids[0] = intval($ids[0]);$ids[1] = intval($ids[1]);
Pero no tubo resultados.Ademas $ids = split( ",", $id, 2 ); solo deja pasar numeros enteros pero en la practica es posible enviar cualquier orden a la base de datos.Adjunto el código de la página en donde puede existir el problema.
#################
<?php require( "../comun/cabeza.inc" ); require( "functions.php" ); if( !isset( $id ) ) error( "LLamada incoreccta a'reply.php'" ); $ids = (int) (array) $ids; $ids = split( ",", $id, 2 );
$ids[0] = intval($ids[0]); $ids[1] = intval($ids[1]);
dbConnect(); $result = mysql_query( "SELECT rootID, name, email, topic,msg, time, ip FROMforum WHERE rootID=${ids[ 1 ]}" ) or error( mysql_error() ); $row = mysql_fetch_array( $result ); unset( $result ); displayHeader( $forumTitle ); echo " <div align=center> <center> <table border=0 cellpadding=0 cellspacing=0 width=80%> <tr> <td align=left width=100% height=20> <a href=forum.php>Indice del foro</a> </td> </tr> <tr> <td width=100% height=1 bgcolor=#808080></td> </tr> </table> </center> </div> <div align=center> <center> <table border=0 cellpadding=0 cellspacing=0 width=80%> <tr> <b>De:</b> {$row[ 'name' ]} <a href=mailto:{$row[ 'email' ]}>({$row['email' ]})</a><br> <td><b>Asunto:</b> {$row[ 'topic' ]}<br> <b>Mensaje:</b> {$row[ 'msg' ]}</p>"; echo " </tr> </table> </center> </div> <hr size=1 color=#808080 width=80%>"; if( $row[ 'ip' ] == "") displayFooter(); echo " <a name=reply> <center><h4>Responder</h4></center> <form method=post action=post.php> <input type=hidden name=action value=reply> <input type=hidden name=id value=\"${ids[ 0 ]},{$row[ 'rootID' ]}\"> <div align=center> <center> <table border=0 cellpadding=0 cellspacing=2 width=580> <tr> <td width=80 height=18><b>Asunto:</b></td> <td width=500 height=18><input type=text name=topicvalue=\"RE: {$row['topic' ]}\" size=50 maxlength=50></td> </tr> <tr> <td width=80 height=18><b>Nombre:</b></td> <td width=500 height=18><input type=text name=namesize=20 maxlength=20value='Anonimo'></td> </tr> <tr> <td width=80 height=18><b>E-mail:</b></td> <td width=500 height=18><input type=text name=emailsize=40maxlength=40 value='Anonimo@anonino.com'></td> </tr> <tr> <td width=80 valign='top'><b>Mensaje:</b><br><inputtype=submitvalue=Responder></td> <td width=500><textarea style='height:auto;' name=msgrows=10 cols=50maxlength=2000></textarea></td> </tr> <tr> <td width=80 height=18></td> <td width=500 height=18><input type=hidden name=getmailvalue=no></td> </tr> <tr> <td width=80 height=18></td> <td width=500 height=18></td> </tr> </table> </center> </div> </form>"; require( "../comun/pie.inc" ); displayFooter();
?>
#################
Que puede estar pasando?
SALUDOS y Gracias...
- --Martín Di Luzioekstor@yahoo.com.arJabber ID: kstor@lugro.org.arUsuario GNU/Linux #320520 - http://counter.li.org/
«Copyleft--all rights reversed»
-----BEGIN PGP SIGNATURE-----Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBpH3gPlxjGDYynKYRAnnEAJ9xGYj/TSQFlP3up5RfHfxze2rKswCfZQ3LsJBZxpvMS+Y547lhrHS1v00==eOu1-----END PGP SIGNATURE-----