InTroX 0 Denunciar post Postado Novembro 5, 2011 Olá pessoal, alguns amigos me deram um toque dizendo que o código que estou postando logo abaixo está vulneravel com o uso do havij para obter dados dos bando de dados do mysql. <!-- Chama Script e Styles e Funções do php + painel ---> <?php include "../central/central/config.php"; ?> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body{ background-color:#006666; font-family:Arial, Helvetica, sans-serif; } .s_titulo { font-size: 20px; font-weight:bold; color:#444444; border-bottom-style:dashed; } .s_titulo2 { font-size: 20px; font-weight:bold; font-style:italic; color:#FFFFFF; } .descri { font-size: 10px; font-weight:bold; color:#444444; } .descri2 { font-size: 11px; font-weight:bold; color:#FFFFFF; } .indisponivel { font-size: 11px; font-weight:bold; color:#FF9900; } a:link{ text-decoration: none; color:#FFFFFF; } a:visited{ text-decoration: none; color:#FFFFFF; } a:hover{ text-decoration: none; color:#cbcbcb; } a:active{ text-decoration: none; color:#FFFFFF; } .box_i_05_3_1_1_1_p_e{ width:203px; height:203px; margin-left:4px; margin-top:1px; color:#FFFFFF; font-size:12px; text-align:left; background-color:#FFFFFF; overflow:hidden; float:left; } .style1 {color: #FFFFFF} .style4 {font-size: 10px; font-weight: bold; color: #CCCCCC; } .style5 {font-family: Verdana, Arial, Helvetica, sans-serif} .style6 {font-size: 10px; font-weight: bold; color: #CCCCCC; font-family: Verdana, Arial, Helvetica, sans-serif; } --> </style> </head> <body> <table width="500" border="0" cellspacing="5" cellpadding="0"> <?php $id = $_GET["id"]; $select = "SELECT*FROM usuarios_clube WHERE id='$id'"; $result = mysql_query($select); while($linhas_destaque = mysql_fetch_array($result)){ $nome = $linhas_destaque['nome']; $id = $linhas_destaque['id']; $login = $linhas_destaque['login']; $foto = $linhas_destaque['foto']; $senha = $linhas_destaque['senha']; $skype = $linhas_destaque['skype']; $msn = $linhas_destaque['msn']; $orkut = $linhas_destaque['orkut']; $nascimento = $linhas_destaque['nascimento']; $estado = $linhas_destaque['estado']; $estado_civil = $linhas_destaque['estado_civil']; $cidade = $linhas_destaque['cidade']; $bairro = $linhas_destaque['bairro']; $sexo = $linhas_destaque['sexo']; $dia = $linhas_destaque['dia']; $mes = $linhas_destaque['mes']; $ano = $linhas_destaque['ano']; $quem_sou_eu = $linhas_destaque['quem_sou_eu']; $semhtml = strip_tags($quem_sou_eu,"<b><br>"); } ?> <title> - Radio LoL Club Perfil - <? echo $nome ?></title> <tr> <td height='40' colspan='3' class='s_titulo'><span class="style1">Club Rádio LoL</span> <span class="style1">Perfil</span> <span class="style1">-</span> <span class='s_titulo2'><? echo $nome ?></span></td> </tr> <tr> <td width='207' height='200' rowspan='8'><div class='box_i_05_3_1_1_1_p_e'><img src='../central/central/ultilitarios/clube/<? echo $foto ?>' width='200' height='200' style='margin-left:1px; margin-top:1px;' /></div></td> <td width='73' height='21' class='style4 style5'>Nome:</td> <td width='212' height='21' align='left' class='descri2'><? echo $nome ?></td> </tr> <tr> <td height='21' class='style6'>Sexo:</td> <td height='21' align='left' class='descri2'><? echo $sexo ?></td> </tr> <tr> <td height='21' class='style6'>Data de N.: </td> <td height='21' align='left' class='descri2'><? echo $dia ?><? echo $mes ?><? echo $ano ?></td> </tr> <tr> <td height='21' class='style6'>Estado Civil: </td> <td height='21' align='left' class='descri2'><? echo $estado_civil ?></td> </tr> <tr> <td height='21' class='style6'>Estado:</td> <td height='21' align='left' class='descri2'><? echo $estado ?></td> </tr> <tr> <td height='21' class='style6'>Cidade:</td> <td height='21' align='left' class='descri2'><? echo $cidade ?></td> </tr> <tr> <td height='21' class='style6'>MSN:</td> <td height='21' align='left' class='descri2'><a href='msnim:add?contact=<? if($msn == ''){echo'Indisponivel';}else{ echo$msn;}?>'><img src='imagens/msn.png' width='22' height='22' border='0' /> <? if($msn == ''){echo'Indisponivel';}else{ echo$msn;}?> </a></td> </tr> <tr> <td height='21' class='style6'>Skype:</td> <td height='21' align='left' class='descri2'><a href='skype:?add=<? if($skype == ''){echo'Indisponivel';}else{ echo$skype;}?>'><img src='imagens/skype.png' width='22' height='22' border='0' /> <? if($skype == ''){echo'Indisponivel';}else{ echo$skype;}?> </a></td> </tr> <tr> <td> </td> <td><span class="style6">Orkut:</span></td> <td><span class="descri2"><a href='<? if($orkut == ''){echo'Indisponivel';}else{ echo$orkut;}?>' target='_blank'><img src='imagens/orkut.png' width='22' height='22' border='0' /> Click aqui! </a></span></td> </tr> <tr> <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th height="16" valign="top" class="style6" scope="col"><div align="left">Quem Sou eu: </div></th> </tr> <tr> <th valign="top" scope="col"> <div align="left"> <? if($quem_sou_eu == ''){echo'<font class="indisponivel">Indisponivel</font>';}else{ echo"<font class='descri2'>$semhtml</font>";}?> </div></th> </tr> </table></td> </tr> <tr> <td colspan='3'><img src='imagens/rodape_m.jpg' width='500' height='99' border='0' usemap='#Map' /></td> </tr> </table> alguem poderia me dizer o que torna isso vulnerável? eu mesmo testei aqui o programa e realmente consegui ver tudo o que tava salvo no banco de dados, inclusive o nome de tabelas... Compartilhar este post Link para o post Compartilhar em outros sites
Henrique Barcelos 290 Denunciar post Postado Novembro 5, 2011 Está vulnerável pois você está pegando os valores via GET ($_GET) diretamente, sem um filtro prévio. No mínimo faça isso aqui: $id = (int) $_GET["id"]; Além disso, faça validações dos outros campos, para impedir que estejam vazios ou contendo HTML incorreto. :seta: Material para leitura Compartilhar este post Link para o post Compartilhar em outros sites
InTroX 0 Denunciar post Postado Novembro 5, 2011 Está vulnerável pois você está pegando os valores via GET ($_GET) diretamente, sem um filtro prévio. No mínimo faça isso aqui: $id = (int) $_GET["id"]; Além disso, faça validações dos outros campos, para impedir que estejam vazios ou contendo HTML incorreto. :seta: Material para leitura Perfeito amigão! obrigado. aproveitando o tópico, poderia dá uma olhadinha e conferir se ainda tem vulnerabilidade? www.RadioLoL.com.br ve ae! obrigado. Compartilhar este post Link para o post Compartilhar em outros sites