Talos Vulnerability Report

TALOS-2020-1035

NVIDIA D3D10 driver nvwgf2umx_cfg.dll nvwg MOV code execution vulnerability

September 30, 2020
CVE Number

CVE‑2020‑5981

Summary

An exploitable code execution vulnerability exists in the nvwg MOV 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[4].xyzw, immediateIndexed
customdata
dcl_input_ps_siv constant v0.xyzw, position
dcl_temps 7
...
mov r966590465.x, l(0, 0, 0, 0)
...

By modifying the mov instruction destination register operand, an attacker is able to trigger a memory corruption vulnerability in the NVIDIA graphics driver. The attacker can control the destination address by modifying the shader bytecode.

00007FFB907A2F9C | 8D 0C 8D 00 00 00 00     | lea ecx,qword ptr ds:[rcx*4]            | * attacker can partially control RCX value
00007FFB907A2FA3 | C1 F9 08                 | sar ecx,8                               |
00007FFB907A2FA6 | 48 C1 E1 06              | shl rcx,6                               |
00007FFB907A2FAA | 49 03 CE                 | add rcx,r14                             |
00007FFB907A2FAD | 33 C0                    | xor eax,eax                             |
00007FFB907A2FAF | 48 89 01                 | mov qword ptr ds:[rcx],rax              | * memory address for writting is based on attacker's data



0:253> r
rax=0000000000000000 rbx=000002256c748a60 rcx=000002655ff7ceb0
rdx=0000000000000002 rsi=000000009d000a08 rdi=0000000000041280
rip=00007ffb9e2bcecf rsp=0000002f8b96e970 rbp=0000002f8b96ea70
 r8=00007ffb9dfb0000  r9=00000000000000e4 r10=0000000000000084
r11=0000022578b7cc00 r12=000000000000ff5f r13=0000000000000000
r14=0000022578b7cc30 r15=0000022578b2d900
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+0x179a7f:
00007ffb`9e2bcecf 488901          mov     qword ptr [rcx],rax ds:00000265`5ff7ceb0=????????????????

stack trace:

0:253> kb
 # RetAddr           : Args to Child                                                           : Call Site
00 00007ffb`9e159456 : 00000225`6b97cb40 00000225`6c40e170 00000225`78356c00 00000225`786b1a60 : nvwgf2umx_cfg!OpenAdapter12+0x179a7f
01 00007ffb`9e15a232 : 00000000`00000000 00000225`786b1a60 00000225`78b36fe0 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x16006
02 00007ffb`9e15b826 : 00000000`00000000 00000000`00000000 00000000`00000000 00000225`54fc0328 : nvwgf2umx_cfg!OpenAdapter12+0x16de2
03 00007ffb`9e3f978d : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x183d6
04 00007ffb`9e46a84d : 00000225`7892d320 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x2b633d
05 00007ffb`9f2fc500 : 00000000`00000000 00000000`00000000 00000225`7825ebe0 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:253> !analyze -v
*******************************************************************************
*                                                                             *
*                        Exception Analysis                                   *
*                                                                             *
*******************************************************************************


KEY_VALUES_STRING: 1

	Key  : AV.Fault
	Value: Write

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

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


PROCESSES_ANALYSIS: 1

SERVICE_ANALYSIS: 1

STACKHASH_ANALYSIS: 1

TIMELINE_ANALYSIS: 1

Timeline: !analyze.Start
	Name: <blank>
	Time: 2020-03-16T16:28:08.151Z
	Diff: 151 mSec

Timeline: Dump.Current
	Name: <blank>
	Time: 2020-03-16T16:28:08.0Z
	Diff: 0 mSec

Timeline: Process.Start
	Name: <blank>
	Time: 2020-03-16T16:22:46.0Z
	Diff: 322000 mSec

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


DUMP_CLASS: 2

DUMP_QUALIFIER: 0

FAULTING_IP: 
nvwgf2umx_cfg!OpenAdapter12+179a7f
00007ffb`9e2bcecf 488901          mov     qword ptr [rcx],rax

EXCEPTION_RECORD:  (.exr -1)
ExceptionAddress: 00007ffb9e2bcecf (nvwgf2umx_cfg!OpenAdapter12+0x0000000000179a7f)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000001
   Parameter[1]: 000002655ff7ceb0
Attempt to write to address 000002655ff7ceb0

FAULTING_THREAD:  00003024

PROCESS_NAME:  rdvgm.exe

FOLLOWUP_IP: 
nvwgf2umx_cfg!OpenAdapter12+179a7f
00007ffb`9e2bcecf 488901          mov     qword ptr [rcx],rax

WRITE_ADDRESS:  000002655ff7ceb0 

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:  000002655ff7ceb0

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:  30cecf

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:  07cf5b1cb3db334c45e135329df89c5b430e148b

MODLIST_SHA1_HASH:  0bb9b3455134f525fc8cb50a235016bcdddd1bc9

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 17:28:08.0151

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:    [0x3024]
	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:    [0x3024]
	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:    [0x80c]
	TID:    [0x3024]
	Frame:  [0] : nvwgf2umx_cfg!OpenAdapter12

LAST_CONTROL_TRANSFER:  from 00007ffb9e159456 to 00007ffb9e2bcecf

STACK_TEXT:  
0000002f`8b96e970 00007ffb`9e159456 : 00000225`6b97cb40 00000225`6c40e170 00000225`78356c00 00000225`786b1a60 : nvwgf2umx_cfg!OpenAdapter12+0x179a7f
0000002f`8b96eb20 00007ffb`9e15a232 : 00000000`00000000 00000225`786b1a60 00000225`78b36fe0 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x16006
0000002f`8b96ecb0 00007ffb`9e15b826 : 00000000`00000000 00000000`00000000 00000000`00000000 00000225`54fc0328 : nvwgf2umx_cfg!OpenAdapter12+0x16de2
0000002f`8b96edb0 00007ffb`9e3f978d : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x183d6
0000002f`8b96f840 00007ffb`9e46a84d : 00000225`7892d320 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x2b633d
0000002f`8b96f930 00007ffb`9f2fc500 : 00000000`00000000 00000000`00000000 00000225`7825ebe0 00000000`00000000 : nvwgf2umx_cfg!OpenAdapter12+0x3273fd
0000002f`8b96f980 00007ffb`ad127bd4 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : nvwgf2umx_cfg!NVAPI_Thunk+0x7cb5d0
0000002f`8b96f9b0 00007ffb`aed8ced1 : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
0000002f`8b96f9e0 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:  2faf18a98d1c68b5746888e583c56af549c3d318

THREAD_SHA1_HASH_MOD:  701c05ef09dbf52b13a73d3e2d555e4906a8342a

FAULT_INSTR_CODE:  48018948

SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  nvwgf2umx_cfg!OpenAdapter12+179a7f

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: nvwgf2umx_cfg

IMAGE_NAME:  nvwgf2umx_cfg.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  5e543369

STACK_COMMAND:  ~253s ; .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+179a7f

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:  179a7f

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/0030cecf.htm?Retriage=1

TARGET_TIME:  2020-03-16T16:28:19.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:  2aef

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.