04.08.2016 Views

$hell on Earth

shell-on-earth

shell-on-earth

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Exploitati<strong>on</strong> of CVE-2016-0175<br />

Although this seems limited, this was used to increase the size of a window object’s extra bytes. Once<br />

a window object’s extra bytes were modified, calls to SetWindowL<strong>on</strong>gPtr were used to set the size and<br />

address of another window object’s window text. At that point, arbitrary reads were performed through<br />

calls to InternalGetWindowText and arbitrary writes were performed through calls to NtUserDefSetText.<br />

Exploitati<strong>on</strong> at this point occurred by using the arbitrary reads to find the SYSTEM process in order to<br />

steal the SYSTEM token and apply it to the current process. From there, IsPackagedProcess <strong>on</strong> the<br />

current process was unset and a new process was created as SYSTEM.<br />

CVE-2016-0175 Patch<br />

Microsoft patched this by changing bDeleteLoadRef, such that the return value now matches whether or<br />

not f<strong>on</strong>t resources were freed.<br />

Here is the original versi<strong>on</strong> of bDeleteLoadRef:<br />

if ( v9 )<br />

{<br />

PFFOBJ::vKill(v5);<br />

v4 = 1;<br />

}<br />

return *(_DWORD *)(*(_DWORD *)v5 + 44) == 0 ? v4 : 0;<br />

Note that v4 is set in the block that also calls vKill. However, the return value is dependent <strong>on</strong> the reference<br />

count of v5.<br />

After the patch, the return value of bDeleteLoadRef is dependent solely <strong>on</strong> whether or not vKill was called.<br />

if ( v9 )<br />

{<br />

PFFOBJ::vKill(v5);<br />

v4 = 1;<br />

}<br />

return v4;<br />

46 | <str<strong>on</strong>g>$hell</str<strong>on</strong>g> <strong>on</strong> <strong>Earth</strong>: From Browser to System Compromise

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!