Skip to content

ZeroNights 2013 and NTVDM vulnerabilities

Just yesterday I had the pleasure to speak at a highly hacking-oriented Russian conference, ZeroNights, for the second time (see my “ZeroNights slides, Hack In The Box Magazine #9 and other news” post from last year). The conference itself has been great so far – several interesting and inspiring talks, lots of leet Russian hackers and the Moscow atmosphere makes it a truly unique event. The title of my talk was “Windows Kernel Trap Handler and NTVDM Vulnerabilities — Case Study”, and as the name suggests, it included coverage of four vulnerabilities in all 32-bit Windows kernels starting from Windows NT 3.1 through Windows 8/Server 2012, making them 20 year old issues now. Namely, the following problems were discussed:

  • CVE-2013-3196 (nt!PushInt write-what-where condition)
  • CVE-2013-3197 (nt!PushException write-what-where condition)
  • CVE-2013-3198 (nt!VdmCallStringIoHandler write-where condition)
  • 0-day (nt!PushPmInterrupt and nt!PushRmInterrupt Blue Screen of Death DoS)

All of the above security flaws were local problems (i.e. require the ability to execute arbitrary code on the victim machine); the first three have a maximum impact of elevation of privileges (ring-0 code execution) and thus were fixed by Microsoft in September this year by the MS13-063 security bulletin. While equally interesting, the fourth one only makes it possible to get the kernel to reference memory at addressess 0xfff80008 through 0xffffffff (top 128 pages of the kernel address space) which, given the memory layout used by the operating system, is believed to be non-exploitable at the time of this writing. The bugcheck triggered by the condition is as follows:

TRAP_FRAME:  88c37b90 -- (.trap 0xffffffff88c37b90)
ErrCode = 00000000
eax=00000000 ebx=00000002 ecx=7fff0000 edx=fffffeff esi=88c37d34 edi=fff80008
eip=82b31e51 esp=88c37c04 ebp=88c37c50 iopl=0         nv up ei ng nz na pe cy
cs=0008  ss=0010  ds=0023  es=0023  fs=0030  gs=0000             efl=00010287
nt!PushPmInterrupt+0x20c:
82b31e51 668b07          mov     ax,word ptr [edi]        ds:0023:fff80008=????
Resetting default scope

The slide deck can be downloaded here (zn2013_slides.pdf, 6.9MB).

Enjoy!

{ 8 } Comments

  1. Yuhong Bao | 14-Nov-13 at 20:51:11 | Permalink

    BTW, the privileged instruction emulation in protected mode in NTVDM is there to support DPMI applications.

  2. j00ru | 15-Nov-13 at 02:55:47 | Permalink

    @Yuhong Bao: Yeah, I should have mentioned that. Updated the slides with an additional line mentioning DPMI.

  3. 0x16 | 15-Nov-13 at 09:30:55 | Permalink

    Hi!Thanks for you work!I make a PoC of CVE-2013-3196 (nt!PushInt write-what-where condition),
    but met trouble:
    I can’t add to the LDT custom Expand Down SS segment.
    Inside PspIsDescriptorValid function this condition doesn’t pass:
    Base == 0×0 ActualLimit == 0xFFFFFFFF
    if (Base > Base + ActualLimit ||
    ((PVOID)(Base + ActualLimit) > MM_HIGHEST_USER_ADDRESS)) {
    return FALSE;
    }
    If we will use usual expand up data-segment we fail inside PushInt:
    cmp edi,[esi].RiSsLimit ; edi==0xDEADBEEF (esp must be below limit)
    jnb err_

    Can you give me a hint?)
    With regards!

  4. j00ru | 16-Nov-13 at 09:02:38 | Permalink

    @0×16: which operating system are you targetting? On Windows 7, you can create a custom LDT data segment with Base=0×0 and Limit=0xffffffff without any problems.

  5. vexillium_fan | 16-Nov-13 at 12:45:20 | Permalink

    Excellent job. Again. Excellent work. Again. ;)
    Thanks. Again. Keep goin’ – again.

    Take a beer from me. Again. ;)

  6. 0x16 | 16-Nov-13 at 16:27:13 | Permalink

    Thanks for answer!Yes it was xp sp3,so now i see that in w7x86 PspIsDescriptorValid totaly different,and not exist all limit-conditions..So it looks like on old windows exploitation not possible…?

  7. j00ru | 16-Nov-13 at 16:29:33 | Permalink

    @0×16: pretty much yes.

  8. Yuhong Bao | 16-Nov-13 at 18:45:26 | Permalink

    @j00ru: Also note that Protected mode != 32-bit, 16-bit DPMI is also very common.

{ 1 } Trackback

  1. […] j00ru hakuje NTVDM […]

Post a Comment

Your email is never published nor shared. Required fields are marked *