Sitio personal de Ariel M. Liguori De Gottig

Thursday, January 15

Broken Authentication attack

Uno de los errores más comunes y críticos en la programación web susede en el momento del diseño de estructuras de acceso de usuarios o comúnmente conocidas "Login Pages". Es aquí donde se ingresa la información sensible, es la puerta al sitio que queremos vulnerar y es un método para entrar sin que nadie se de cuenta.
A pesar de su criticidad los ataques por aprovechamiento de Broken Authentication son elevados, así lo afirma OWASP al incluirlos en el puesto número 7 de su TOP10.

¿Qué podemos hacer al respecto? Primero, entender en que consiste.

Un ataque por broken authentication se basa en el error de los métodos de protección de una determinada página, en la cual, por definición de vulnerable, se emplean malos hábitos para la gestión del acceso a un área en particular, dichos errores pueden ser la utilizacion de métodos GET en lugar de POST, la no-utilizacion de SSL, el no cifrado de los session-id, el permitir _e_interpretar_como_correctos_ parámetros malformados por un atacante, etc, etc, etc...

Aquí les dejo un video con el ejemplo de como realizar una vulnerabilidad por Broken Authentication (No es casualidad que tenga este archivo aquí y ahora, el verlo inspiro este post).

¿Como prevenirlo? Leamos lo que nos recomiendan los que saben. Link a Recomendaciones de OWASP.

Saludos,

Wednesday, January 14

David Bisbal has been hacked! xD

Pues si no me lo creen....

Header Drawings

He encontrado una página en donde se disponen de los gráficos de las cabeceras de paquetes IPv4, IPv6, TCP, UDP e ICMP ! Algo más que útil para tener a mano en la web, gracias a Sor_Zitroën por haberlo publicado aquí.

Ver Headers Drawings


Saludos,

Análisis de Malware.-

Por la web, realmente no recuerdo donde, me he encontrado con el link a este documento en donde nos introducen en una suerte de FAQ sobre Malware y, sobre todo, en el análisis del mismo.

Análisis de Malware

Enjoy it!

Saludos,

Seguridad en las sesiones de las aplicaciones Web - IV

s21sec continúa brindándonos estos interesantes artículos, comparto con ustedes el número 4.

Seguridad en las sesiones de las aplicaciones Web - IV


Saludos,

Tuesday, January 13

Videos y Presentaciones: DISI 2008

Toda la información referente al DISI 2008 se encuentra disponible en el canal de youtube de la UPM. Les recomiendo que le den un vistazo, vale la pena ;-)

Saludos,

Monday, January 12

MD5 Collision Demo

Comparto con ustedes esta nota que leí aquí.

Collisions in the MD5 cryptographic hash function

It is now well-known that the crytographic hash function MD5 has been broken. In March 2005, Xiaoyun Wang and Hongbo Yu of Shandong University in China published an article in which they describe an algorithm that can find two different sequences of 128 bytes with the same MD5 hash. One famous such pair is the following:
d131dd02c5e6eec4693d9a0698aff95c 2fcab58712467eab4004583eb8fb7f89
55ad340609f4b30283e488832571415a 085125e8f7cdc99fd91dbdf280373c5b
d8823e3156348f5bae6dacd436c919c6 dd53e2b487da03fd02396306d248cda0
e99f33420f577ee8ce54b67080a80d1e c69821bcb6a8839396f9652b6ff72a70
and
d131dd02c5e6eec4693d9a0698aff95c 2fcab50712467eab4004583eb8fb7f89
55ad340609f4b30283e4888325f1415a 085125e8f7cdc99fd91dbd7280373c5b
d8823e3156348f5bae6dacd436c919c6 dd53e23487da03fd02396306d248cda0
e99f33420f577ee8ce54b67080280d1e c69821bcb6a8839396f965ab6ff72a70
Each of these blocks has MD5 hash 79054025255fb1a26e4bc422aef54eb4. Ben Laurie has a nice website that visualizes this MD5 collision. For a non-technical, though slightly outdated, introduction to hash functions, see Steve Friedle's Illustrated Guide.
Exploits

As we will explain below, the algorithm of Wang and Yu can be used to create files of arbitrary length that have identical MD5 hashes, and that differ only in 128 bytes somewhere in the middle of the file. Several people have used this technique to create pairs of interesting files with identical MD5 hashes:
  • Magnus Daum and Stefan Lucks have created two PostScript files with identical MD5 hash, of which one is a letter of recommendation, and the other is a security clearance.
  • Eduardo Diaz has described a scheme by which two programs could be packed into two archives with identical MD5 hash. A special "extractor" program turn one archive into a "good" program and the other into an "evil" one.
  • In 2007, Marc Stevens, Arjen K. Lenstra, and Benne de Weger used an improved version of Wang and Yu's attack known as the chosen prefix collision method to produce two executable files with the same MD5 hash, but different behaviors. Unlike the old method, where the two files could only differ in a few carefully chosen bits, the chosen prefix method allows two completely arbitrary files to have the same MD5 hash, by appending a few thousand bytes at the end of each file. (Added Jul 27, 2008).
An evil pair of executable programs

The following is an improvement of Diaz's example, which does not need a special extractor. Here are two pairs of executable programs (one pair runs on Windows, one pair on Linux).
  • Windows version:
    • hello.exe. MD5 Sum: cdc47d670159eef60916ca03a9d4a007
    • erase.exe. MD5 Sum: cdc47d670159eef60916ca03a9d4a007
  • Linux version (i386):
    • hello. MD5 Sum: da5c61e1edc0f18337e46418e48c1290
    • erase. MD5 Sum: da5c61e1edc0f18337e46418e48c1290
These programs must be run from the console.

How it works

The above files were generated by exploiting two facts: the block structure of the MD5 function, and the fact that Wang and Yu's technique works for an arbitrary initialization vector. To understand what this means, it is useful to have a general idea of how the MD5 function processes its input. This is done by an iteration method known as the Merkle-Damgard method. A given input file is first padded so that its length will be a multiple of 64 bytes. It is then divided into individual 64-byte blocks M0, M1, ..., Mn-1. The MD5 hash is computed by computing a sequence of 16-byte states s0, ..., sn, according to the rule: si+1 = f(si, Mi), where f is a certain fixed (and complicated) function. Here, the initial state s0 is fixed, and is called the initialization vector. The final state sn is the computed MD5 hash.

The method of Wang and Yu makes it possible, for a given initialization vector s, to find two pairs of blocks M,M' and N,N', such that f(f(s, M), M') = f(f(s, N), N'). It is important that this works for any initialization vector s, and not just for the standard initialization vector s0.

Combining these observations, it is possible to find pairs of files of arbitrary length, which are identical except for 128 bytes somewhere in the middle of the file, and which have identical MD5 hash. Indeed, let us write the two files as sequences of 64-byte blocks:

M0, M1, ..., Mi-1, Mi, Mi+1, Mi+2, ..., Mn,

M0, M1, ..., Mi-1, Ni, Ni+1, Mi+2, ..., Mn.

The blocks at the beginning of the files, M0, ..., Mi-1, can be chosen arbitrarily. Suppose that the internal state of the MD5 hash function after processing these blocks is si. Now we can apply Wang and Yu's method to the initialization vector si, to find two pairs of blocks Mi, Mi+1 and Ni, Ni+1, such that

si+2 = f(f(si, Mi), Mi+1) = f(f(si, Ni), Ni+1).

This guarantees that the internal state si+2 after the i+2st block will be the same for the two files. Finally, the remaining blocks Mi+2, ..., Mn can again be chosen arbitrarily.

So how can we use this technique to produce a pair of programs (or postscript files) that have identical MD5 hash, yet behave in arbitrary different ways? This is simple. All we have to do is write the two programs like this:

Program 1: if (data1 == data1) then { good_program } else { evil_program }
Program 2: if (data2 == data1) then { good_program } else { evil_program }

and arrange things so that "data1" = Mi, Mi+1 and "data2" = Ni, Ni+1 in the above scheme. This can even be done in a compiled program, by first compiling it with dummy values for data1 and data2, and later replacing them with the properly computed values.

Do it yourself: the "evilize" library

Here, you can download the software that I used to create MD5-colliding executable files. This software is based on Patrick Stach's implementation of Wang and Yu's algorithm. You can find his original implementation here.

Quick usage instructions:

Note for Windows users: the below instructions are for Unix/Linux. On Windows, you may have to append ".exe" to the names of executable files. Also, to use "make", you must have the GNU tools installed and working.

  1. Unpack the archive and build the library and tools:
        tar zxf evilize-0.1.tar.gz
    cd evilize-0.1
    make
    This creates the programs "evilize", "md5coll", and the object file "goodevil.o".
  2. Create a C program with multiple behaviors. Instead of the usual top-level function main(), write two separate top-level functions main_good() and main_evil(). See the file hello-erase.c for a simple example.
  3. Compile your program and link against goodevil.o. For example:
        gcc hello-erase.c goodevil.o -o hello-erase
  4. Run the following command to create an initialization vector:
        ./evilize hello-erase -i
  5. Create an MD5 collision by running the following command (but replace the vector on the command line with the one you found in step 4):
        ./md5coll 0x23d3e487 0x3e3ea619 0xc7bdd6fa 0x2d0271e7 > init.txt
    Note: this step can take several hours.
  6. Create a pair of good and evil programs by running:
        ./evilize hello-erase -c init.txt -g good -e evil
    Here "good" and "evil" are the names of the two programs generated, and "hello-erase" is the name of the program you created in step 3.

    NOTE: steps 4-6 can also be done in a single step, as follows:

        ./evilize hello-erase -g good -e evil
    However, I prefer to do the steps separately, since step 5 takes so long.
  7. Check the MD5 checksums of the files "good" and "evil"; they should be the same.
  8. Run the programs "good" and "evil" - they should exhibit the two different behaviors that you programmed in step 2.


Fuente: Peter Selinger's WebPage.

Sunday, January 11

Mini-Tutorial de Esteganografía/Estegoanálisis. Técnica Sustitutiva LSB by Alfonso Muñoz

Les dejo este mini-tutorial que halle en unos de mis blogs predilectos :-), espero que les sirva tanto como a mi.

Fuente: Un informático del lado del mal
FASE 3 - Parte Esteganografía

Estimados "malignos", hace aproximadamente un mes. Chema y yo coincidimos en el CIBSI2007, donde presentaba oficialmente (más o menos) mis impresiones sobre mi herramienta estegoanalítica beta StegSecret. Chema me comentó que le resultaría muy interesante publicar algún que otro tutorial sobre esteganografía/estegoanálisis, ya que a "sus chicos..." les gustan las sensaciones nuevas ;)

Aprovechando el Reto Hacking V se introdujo una pequeña imagen con información oculta de forma secuencial en los LSB (Least Significant Bit) de cada pixel de la imagen, para probar un poco al personal y como escusa para introducir este mini-tutorial.

Empezemos con un mini-tutorial introductorio sobre esteganografía/estegoanálisis y técnicas sustitutivas LSB aplicadas a ficheros BMP, sin base matemática, de momento, en un futuro (maligno mediante) más...

El término Esteganografía se define como la ciencia y/o arte de ocultar una información dentro de otra, que haría la función de “tapadera” (estegomedio o cubierta). En la criptografía, en cambio, no se oculta la existencia del mensaje sino que se hace ilegible para quien no esté al tanto de un determinado secreto (la clave). En actualidad, es muy interesante la combinación de ambas.

El término Estegoanálisis se define como la ciencia que estudia la detección (ataques pasivos) y/o anulación (ataques activos) de información oculta en distintas tapaderas, así como la posibilidad de localizar la información útil dentro de la misma (existencia y tamaño).

Dependiendo del proceso empleado para ocultar la información, su recuperación puede ser inviable, correspondiendo su inversión a la ciencia del criptoanálisis. Piensese, por ejemplo, en el cifrado de una información utilizando un algoritmo criptográfico “seguro” (¿?) y la utilización de un PRNG (Pseudo-Random Number Generator) para seleccionar las posiciones donde se ocultara la información dentro de un estegomedio dado al aplicar una técnica sustitutiva, por ejemplo, LSB.

El estegoanálisis en casos muy concretos se convierte en una tarea trivial, pero en general, es un tema complejo y de difícil aplicación, principalmente por el número enorme de medios de información que existen (cantidad) y por la variedad de técnicas esteganográficas en estos medios.

En este mini-tutorial introductorio voy a centrar la atención en el estegomedio más utilizado: las imágenes digitales, y especialmente, los ficheros BMP por su sencillez.

Una de las técnicas más antiguas y difundidas es la técnica de sustitución LSB (Least Significant Bit). Esta técnica se basa en dos principios simples:

a) La modificación de los bits menos significativos de la codificación de los pixeles de una imagen no introduce un "ruido visual", en general, suficiente para levantar sospechas a una persona que vea una imagen que contiene información oculta.

b) La información almacenada "naturalmente" en los LSB es aleatoria, con lo que su modificación para introducir información oculta no proporcionaría pistas adicionales a un analista.

La primera afirmación a), en general, se cumple, pero la segunda es falsa, más adelante veremos porqué.

Existen distintas maneras de aplicar una técnica sustitutiva LSB dependiendo del estegomedio elegido, en un formato BMP, en general, en la codificación de los pixeles de la imagen, en un fichero GIF, por ejemplo, a los indices que apuntan a la paleta de colores, en un formato JPEG a los coeficientes cuantificados DCTs, etc, etc.

En el Reto V escogimos el formato BMP (cuando hablo de BMP me refiero aquí al Windows BMP) por ser, en general, un formato sin compresión con lo cual permitiría a cualquiera que intentará detectar la información oculta acceder directamente a la codificación de los pixeles. Además, la información se ocultó en el 1erLSB de cada octeto de la zona de los pixeles, con lo que más fácil imposible....

Es posible utilizar cualquier bit de la codificación de un pixel para ocultar una información, pero el ruido introducido, por ejemplo, visual, el bastante notorio para los bits de mayor peso. Leer más...