Título: Miren esto que me pusieron en mi web php
Publicado por: Red Mx en 29 Noviembre 2006, 17:36 pm
bueno este por ay un gracioso tipo que se creyo muy aca puso en las altas de la sección de ligue un pequeño script js bueno con el mensaje "aprende a programa" este es el script <font face="verdana" size="1"> Nombre: <b>h</b><br> Edad: <b>h</b><br> E-mail: <b>h</b><br> Pais: <b>n</b><br> Algo sobre mi:<br><b><script language=\"javascript\"> for (;;) { alert(); } </script></b><br> <br> <img src=""></img> </font>
al parecer lo intento varias veces pero este solo le funciono bueno solo se lo dejo de tarea el que aprenda programar es otro jajaja bueno como sea el echo es que esto se pudo dar ya que los registros los guardo en un txt entonces lo lee y como lo lee intrepeta la maquina como codigo bueno como dicen es un gran error de seguridad pero no pasa nada :D saludos bandera y ya saben esa pagina es open sourse http://inicio.host.sk/am/
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Azielito en 29 Noviembre 2006, 17:59 pm
deberias limpiar esas variables antes de guardarlas en tus archivos [...] creo que fue a ti a quien comente eso mira, cuando recuperas tus variables(antes de guardarlas al txt) las limpias de codigo html... algo asi <?php $nombre = htmlspecialchars($_POST['nombre']); //o con esta otra $nombre = urlencode($_POST['nombre']); ?> busca info en el foro sobre ataques XSS ;) Los Poderes Secretos de XSS (Cross Site Scripting)http://foro.elhacker.net/index.php/topic,98324.0.html [::Tutorial::] - Ataques XSShttp://foro.elhacker.net/index.php/topic,32042.0.html y aca salen mas cosas xD http://www.google.com.mx/search?q=XSS+site%3Aforo.elhacker.net
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Red Mx en 29 Noviembre 2006, 18:08 pm
no pos has de cuenta que el nombre lo mando a una variable de ahi digamos ago esto <?php
$texto= '<font color="#ff0000">Hola me llamo <b>'.$nombre.'</b>';
todo eso lo guardo en el txt asi se me hizo mas facil ya que las bases de datos en ese servicor como que no andan muy bien asi que este code: <script language=\"javascript\"> for (;;) { alert(); } </script> tambien se toma como si fuera de la web entonces esto implico un gran error de seguridad biendolo de eso forma asi que en la tarde lo acomodo bueno estubo bien para apreder mas...
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: дٳŦ٭ en 29 Noviembre 2006, 18:13 pm
no pos has de cuenta que el nombre lo mando a una variable de ahi digamos hago esto <?php
$texto= '<font color="#ff0000">Hola me llamo <b>'.$nombre.'</b>';
todo eso lo guardo en el txt asi se me hizo mas facil ya que las bases de datos en ese servicor como que no andan muy bien asi que este code: <script language=\"javascript\"> for (;;) { alert(); } </script> tambien se toma como si fuera de la web entonces esto implico un gran error de seguridad biendolo de eso forma asi que en la tarde lo acomodo bueno estubo bien para apreder mas... Como dice bien aziel, pasale la función htmlspecialchars() a las variables para que no te iyecten html. Saludos
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Azielito en 29 Noviembre 2006, 18:20 pm
ok, entonces haslo de esta forma <?php $texto= '<font color="#ff0000">Hola me llamo <b>'.htmlspecialchars($nombre).'</b>'; ?> con esto ya te evitas lo que te han hecho... el problema es por que, estas mandano a imprimir lo que el usuario te dice, en este caso te dice que haga un ciclo infinito con un alert, pudo tambien hacer otras cosas <script> document.location.href='http://www.google.com'; </script> y, en lugar del alert te redirije a google, claro, es un ejemplo pero pudiera ser una pagina pornoGay xDDDDDD y, no se, muchas otras cosas como te digo, limpia, siempre limpia tus variables señor Red Mx ;) Mira, leete esto aprenderas un poco, ya que con esta funcion solo limpias algunas cosillas :P [html] PHP Seguro (http://72.14.253.104/search?q=cache:XMP3Vek48hEJ:www.soulblack.com.ar/repo/papers/phpseguro.pdf+programacion+segura+php&hl=es&gl=mx&ct=clnk&cd=2&client=firefox) [pdf] PHP Seguro (http://www.soulblack.com.ar/repo/papers/phpseguro.pdf)
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Red Mx en 29 Noviembre 2006, 22:40 pm
Sale pues gracias por la info la verdad es que esa no me la sabia ya me estoy leyendo la info que puso azielito y claro ya estoy tambien acomodando la web
saludos y gracias
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Red Mx en 30 Noviembre 2006, 22:28 pm
jajajaja siguen la mata dando miren a este hijo de p**a Nombre: <b>Mexico *****</b> Edad: 32 E-mail: sdaas@asdsa.xokm Pais: sdfsfd Algo sobre mi: <script> document.location.href=\'http://red_mx.esgay.com/\'; </script>
la neta no me ofende antes le doy las gracias por visitar mi web como puede ver el agradabler caballero segui los consejos de azielito y le puse ese pequeño codigo para los caracteres especiales de html asi que no le salio la maldad al chavo
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Azielito en 1 Diciembre 2006, 00:41 am
jahahaha, esta buena esa web [red_mx.esgay.com]
deberias de ponerte a limpiar las variables señor
puedes postear el codigo de el archivo que guarda para decirte donde y como limpiar las variables y eso :P
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Red Mx en 1 Diciembre 2006, 09:00 am
este es el codigo de la que guarda <html> <head> <title>Acorder Manager</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body> <?php $hora =date('d/m/Y - H:i:s'); // lo mas nuevo if((strlen(trim($nombre))==0)||(strlen(trim($mail))==0)||(strlen(trim($edad))==0)||(strlen(trim($des))==0)||(strlen(trim($pais))==0)) { echo'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Acoerder Manager</title> <style type="text/css"> <!-- .Estilo2 { font-size: 9px; color: #A36929; font-family: Verdana, Arial, Helvetica, sans-serif; } .Estilo4 { font-size: 10; font-weight: bold; } .Estilo5 {color: #D59753} --> a,a:link { color: #D59753; text-decoration: none; } a:hover { color: #ff9900; text-decoration: none; } </style> </head> </html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body bgcolor="#6B2101"> <style> select { background:#993300; color:#D7B344; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; } input { background:#993300; color:#D7B344; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; } </style> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="img/cabezera.jpg" width="250" height="80" /><img src="img/cabesera.jpg" width="500" height="80" /></td> </tr> </table> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="336"><div align="center"> <table width="750" border="0" cellpadding="0" cellspacing="0"> <tr bgcolor="#993300"> <td height="20"> <div align="center"><a href="new.php"><img src="img/new.jpg" alt="Descubre las trascripciones mas nuevas" width="100" height="20" border="0"></a><a href="colabora.php"><img src="img/colabora.jpg" alt="Tu puedes subir tus trascripciones en colabora" width="100" height="20" border="0" /></a><a href="peticiones.php"><img src="img/peticiones.jpg" alt="No esta solo pidela" width="100" height="20" border="0"></a> <a href="top20.php"><img src="img/top20.jpg" alt="Los mas popular de acoder manager" width="100" height="20" border="0"></a><a href="http://ladinastia.webcindario.com/acordermanager.exe"><img src="img/descargar.jpg" alt="Descarga Acorder Manager" width="100" height="20" border="0"></a> <a href="chat.php"><img src="img/chat.jpg" alt="Chat" width="100" height="20" border="0"></a> <a href="ligue.php"><img src="img/ligue.jpg" width="100" height="20" border="0" /></a></div></td> </tr> </table> <br /><br /> <table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="247"> <!-- agregar php --> <font color="#D59753" face="verdana" size="1"> <center> <b>! Un error ocurrio ¡<b><bR><BR> no se agrego tu perfil ya que dejaste campos vacios </center> </font> </td> </tr> </table> <p><font color="#993300" size="1" face="Verdana, Arial, Helvetica, sans-serif">©Ldc y Red Mx Derechos reservados 2006</font></p> </div></td> </tr> </table> </body> </html> ';
} else { /***Esta parte solo abre un archivo de control***************/ $archivo = 'ligue.txt'; $fp = fopen('ligue.txt','r'); $texto = fread($fp, filesize($archivo)); if($texto>9){ $numero=1; $file = fopen("ligue.txt","w"); fwrite($file,($numero)); fclose($file); }else{ $numero=$texto+1; $file = fopen("ligue.txt","w"); fwrite($file,($numero)); fclose($file); }; /***************************************************/ if ($numero== "1") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l1.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "2") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l2.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "3") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l3.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "4") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l4.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "5") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l5.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "6") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l6.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "7") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l7.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "8") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l8.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "9") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l9.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; if ($numero== "10") { $datos='<font face="verdana" size="1"> Nombre: <b>'.htmlspecialchars($nombre).'</b><br> Edad: <b>'.htmlspecialchars($edad).'</b><br> E-mail: <b>'.htmlspecialchars($mail).'</b><br> Pais: <b>'.htmlspecialchars($pais).'</b><br> Algo sobre mi:<br><b>'.htmlspecialchars($des).'</b><br> <br></font>'; if($photo!=""){ $datos=''.$datos.'<img src="'.htmlspecialchars($photo).'"></img>'; } $file = fopen("l10.txt","w");//escribimo el nuevo numero fwrite($file,($datos)); fclose($file); }; echo('
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Acoerder Manager</title> <style type="text/css"> <!-- .Estilo2 { font-size: 9px; color: #A36929; font-family: Verdana, Arial, Helvetica, sans-serif; } .Estilo4 { font-size: 10; font-weight: bold; } .Estilo5 {color: #D59753} --> a,a:link { color: #D59753; text-decoration: none; } a:hover { color: #ff9900; text-decoration: none; } </style> </head> </html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> </head> <body bgcolor="#6B2101"> <style> select { background:#993300; color:#D7B344; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; } input { background:#993300; color:#D7B344; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; } </style> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="img/cabezera.jpg" width="250" height="80" /><img src="img/cabesera.jpg" width="500" height="80" /></td> </tr> </table> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="336"><div align="center"> <table width="750" border="0" cellpadding="0" cellspacing="0"> <tr bgcolor="#993300"> <td height="20"> <div align="center"><a href="new.php"><img src="img/new.jpg" alt="Descubre las trascripciones mas nuevas" width="100" height="20" border="0"></a><a href="colabora.php"><img src="img/colabora.jpg" alt="Tu puedes subir tus trascripciones en colabora" width="100" height="20" border="0" /></a><a href="peticiones.php"><img src="img/peticiones.jpg" alt="No esta solo pidela" width="100" height="20" border="0"></a> <a href="top20.php"><img src="img/top20.jpg" alt="Los mas popular de acoder manager" width="100" height="20" border="0"></a><a href="http://ladinastia.webcindario.com/acordermanager.exe"><img src="img/descargar.jpg" alt="Descarga Acorder Manager" width="100" height="20" border="0"></a> <a href="chat.php"><img src="img/chat.jpg" alt="Chat" width="100" height="20" border="0"></a> <a href="ligue.php"><img src="img/ligue.jpg" width="100" height="20" border="0" /></a></div></td> </tr> </table> <br /><br /> <table width="750" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="247"> <!-- agregar php --> <font color="#D59753" face="verdana" size="1"> <center> Hola '.htmlspecialchars($nombre).' tu perfil fue agregado exitosamente <br><br> <a href="ligue.php">Clicl aqui para ver tu perfil</a> </center> </font> </td> </tr> </table> <p><font color="#993300" size="1" face="Verdana, Arial, Helvetica, sans-serif">©Ldc y Red Mx Derechos reservados 2006</font></p> </div></td> </tr> </table> </body> </html> '); }; ?> </body> </html>
taria bien apreder eso ya que el PHP me enseñe yo solo mas o menos ya le se pero me falta tadavia.
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: SirLanceCC en 3 Diciembre 2006, 15:54 pm
:o Esto tengo que recordarlo ahora que quiero hacer una pagina un poco parecida...
Aprenderé del error de Red Mx y ¡Limpiaré las variables de cualquier etiqueta html!
EDITO: Encontré esta función por la web... ¿cual sería mejor de usar? http://php.net/strip_tags
Título: Re: Miren esto que me pusieron en mi web php
Publicado por: Ertai en 3 Diciembre 2006, 16:56 pm
Depende de como quieras que aparezcan.
strip_tags borra todo lo que haya entre <> y las otras lo dejan pero codificado de tal manera que no se ejecute como HTML.
|