Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General »

Puedo hacer SQL injection con este codigo?

Estas en el tema de Puedo hacer SQL injection con este codigo? en el foro de Bases de Datos General en Foros del Web. Aqui tienen el codigo, si existe un modo de entrar mediante inyeccion me pueden decir de que forma y si tiene solucion. Es un programa ...
  #1 (permalink)  
Antiguo 06/04/2004, 06:51
 
Fecha de Ingreso: abril-2004
Mensajes: 2
Antigüedad: 20 años, 1 mes
Puntos: 0
Exclamación Puedo hacer SQL injection con este codigo?

Aqui tienen el codigo, si existe un modo de entrar mediante inyeccion me pueden decir de que forma y si tiene solucion. Es un programa de la universidad llamado SENECA, no se si sabran cual es.

<SCRIPT LANGUAGE="JavaScript" SRC="../scripts/hashtable.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="../scripts/jvalida.js"></SCRIPT>

<style type="text/css">
<!--
.mensajeError { font-family: times, sans-serif; font-size: 12pt; font-weight: bold; color: #FF0033}
-->
</style>

<link rel="stylesheet" href="../include/cec.css">

<script language="JavaScript">
function init(){
if (top.menu){
var inc=document.forms[0].INCORRECTO.value
top.location.replace("IdenUsu.jsp?INCORRECTO="+esc ape(inc)+"&rndval=FFLCYXGSYXHKGSAEAE")
}
}

function comprobarclave() {
if(validar()) {
document.forms[0].action="ComprobarUsuario.jsp"+"?rndval=FFLCYXGSYX HKGSAEAE";
document.forms[0].submit();
}
}
</script>

<title>S&eacute;neca.....Gesti&oacute;n acad&eacute;mica de los centros dependientes de la Junta de Andaluc&iacute;a</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" scroll="0" scrollbar="0">

<script>
function cancelarIden() {
if(confirm("¿Desea cancelar la operación?")){
window.close();
}
}
</script>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../images/punto.gif">
<tr>
<td width="100%" height="171" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../images/lineavertical2.gif">
<tr valign="top">
<td height="138" width="100%">&nbsp;</td>
</tr>
</table>
</td>
<td rowspan="2" valign="top">
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="240"><img src="../images/arriba1.gif" width="240" height="138"></td>
<td width="27"><img src="../images/arriba2.gif" width="288" height="138"></td>
<td width="513"><img src="../images/arriba3.gif" width="252" height="138"></td>
</tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="169">&nbsp;</td>
<td width="366"><img src="../images/centro1.gif" width="368" height="38"></td>
<td width="243">&nbsp;</td>
</tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0" height="121">
<tr>
<td width="170" height="138">
<div align="right"></div>
</td>
<td width="41" height="138" background="../images/centro2.gif"><img src="../images/punto.gif" width="1" height="1"></td>
<td width="224" height="138" background="../images/centro3.gif" valign="top"><img src="../images/punto.gif" width="1" height="1">
<form name="FORMULARIO_IDEN_USU" method="POST" action="javascript:comprobarclave()">
<table width="175" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="65" height="6" background="../images/punto_blanco.gif"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#006666"><b>Usuario</b></font></td>
<td width="84" height="6" background="../images/punto_blanco.gif">
<input type="text" name="USUARIO" size="15" maxlength="25" value="">
</td>
</tr>
<tr>
<td width="65" height="2" background="../images/punto_blanco.gif"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#006666"><b>Clave<br>
</b></font></td>
<td width="84" height="2" background="../images/punto_blanco.gif">
<input type="password" name="CLAVE" size="15" maxlength="25">
</td>
</tr>
<tr background="../images/unto_blanco.gif">
<td background="../images/punto.gif" height="11" colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr background="../images/unto_blanco.gif">
<td background="../images/punto.gif" height="11" width="48%" align="left">
<a href="javascript:comprobarclave()" target="_top"><img src="../images/aceptar2.gif" width="73" height="27" border="0"></a>
</td>
<td height="11" background="../images/punto_blanco.gif" width="52%" align="right">
<a href="javascript:cancelarIden()" ><img src="../images/cancelar.gif" width="78" height="27" border="0"></a></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
<td background="../images/centro4.gif" height="138" width="103"><img src="../images/punto.gif" width="1" height="1"></td>
<td height="138" width="244"></td>
</tr>
</table>
<table width="780" border="0" cellspacing="0" cellpadding="0" height="90">
<tr>
<td width="169" height="92"></td>
<td width="366" background="../images/centro5.gif" height="81" valign="top">

<table width="100%" border="0" >
<tr>
<td width="20%" background="../images/punto.gif" height="35">&nbsp;</td>
<td width="46%" background="../images/punto.gif" height="35" >&nbsp;</td>
<td width="34%" background="../images/punto.gif" height="35">&nbsp;</td>
</tr>
</table>


</td>
<td width="245" height="92"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" height="236">&nbsp;</td>
</tr>
</table>
</body>
</html>

<SCRIPT LANGUAGE=javascript>

function validar() {
hashTotal = new Hashtable();
hashElemento1 = new Hashtable();
hashElemento1.put('etiqueta','USUARIO');
hashElemento1.put('obligatorio',true);
hashElemento1.put('numerico',false);
hashElemento1.put('fecha',false);
hashElemento1.put('hora',false);
hashElemento1.put('ccc',false);
hashElemento1.put('filtroNumerico',false);
hashElemento1.put('filtroFecha',false);
hashElemento1.put('filtroCadena',false);
hashElemento1.put('dni',false);
hashElemento1.put('cif',false);
hashElemento1.put('combo',false);
hashElemento1.put('value',document.forms[0]['USUARIO'].value);
hashTotal.put('USUARIO',hashElemento1);
hashElemento2 = new Hashtable();
hashElemento2.put('etiqueta','CLAVE');
hashElemento2.put('obligatorio',true);
hashElemento2.put('numerico',false);
hashElemento2.put('fecha',false);
hashElemento2.put('hora',false);
hashElemento2.put('ccc',false);
hashElemento2.put('filtroNumerico',false);
hashElemento2.put('filtroFecha',false);
hashElemento2.put('filtroCadena',false);
hashElemento2.put('dni',false);
hashElemento2.put('cif',false);
hashElemento2.put('combo',false);
hashElemento2.put('value',document.forms[0]['CLAVE'].value);
hashTotal.put('CLAVE',hashElemento2);
return valida(hashTotal);
}

</SCRIPT>
<script language="JavaScript">
document.forms[0]['USUARIO'].focus();
</script >

<SCRIPT>
self.resizeTo(screen.width, screen.availHeight);
self.moveTo(0,0);
</SCRIPT>
  #2 (permalink)  
Antiguo 06/04/2004, 08:22
 
Fecha de Ingreso: febrero-2004
Ubicación: Resistencia - Argentina
Mensajes: 299
Antigüedad: 20 años, 2 meses
Puntos: 0
El tema del sql inyection es que no te pongan en algun campo de entrada, tipo password, algo asi: a;drop databse
Lo mejor es hacer un control que no deja introducir simbolos raros en una cadena de texto(";"","".""-",etc) o anyes de hacer la consulta reemplazar estos caracteres por espacios o algo asi.-
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:48.