本文讲的是
破解索尼PS4系列:用户代码执行(二),
struct memoryRegionInfo info;struct otherMemoryRegionInfo otherInfo;void *m = NULL;int i;// Iterate over first 107 memory mappingsfor(i = 0; i < 107; i++) { // Find base of next mapping getOtherMemoryInfo(m, 1, &otherInfo); // Get more info about this mapping getMemoryInfo(otherInfo.base, &info); // If readable, dump it if(info.flags & PROT_CPU_READ) { sceNetSend(sock, info.base, info.end - info.base, 0); } m = info.end;}
int i;for(i = 0; i < 0x7FFFFFFF; i++) { if(!sceVideoOutWaitVblank(i)) return i; if(i % 0x10000 == 0) debug(sock, "At %08xn", i);}sceNetSocketClose(sock);return 0;
var body = document.getElementsByTagName("body")[0]; // Create canvas var canvas = document.createElement("canvas"); canvas.id = "canvas"; canvas.width = 160; canvas.height = 144; canvas.style.zIndex = 1; canvas.style.position = "absolute"; canvas.style.border = "1px solid"; // Centered //canvas.style.left = ((window.screen.width - canvas.width) / 2).toString() + "px"; //canvas.style.top = ((window.screen.height - canvas.height) / 2).toString() + "px"; // Fullscreen canvas.style.left = "0px"; canvas.style.top = "0px"; canvas.style.width = "100%"; canvas.style.height = "100%"; body.appendChild(canvas);
while(body.firstChild) { body.removeChild(body.firstChild); }
document.body.style.cursor = "none";
libusb_context *context;libusb_init(&context);libusb_exit(context);
sceUsbdInit();sceUsbdExit();
ugen0.4: <SanDisk> at usbus0 umass1: <SanDisk Cruzer Edge, class 0/0, rev 2.00/1.26, addr 4> on usbus0 umass1: SCSI over Bulk-Only; quirks = 0x0000 umass1:2:1:-1: Attached to scbus2 da1 at umass-sim1 bus 1 scbus2 target 0 lun 0 da1: <SanDisk Cruzer Edge 1.26> Removable Direct Access SCSI-5 device da1: 40.000MB/s transfers da1: 3819MB (7821312 512 byte sectors: 255H 63S/T 486C) [SceAutoMount] /mnt/usb0 is now available. fstype=exfatfs, device=/dev/da1s1 MSG AutomounterMelUtil(void sceAutomounterMelUtil::callbackMountAll(void **) 203): device(/dev/da1s1): exfat(mediaType=0x1001) is mounted at /mnt/usb0.
fork(2)系统调用被禁用,因此我们无法创建新进程。 chroot(61)系统调用被禁用。 libc函数getprocname返回一个空字符串。
int libPad = sceKernelLoadStartModule("libScePad.sprx", 0, NULL, 0, 0, 0);
struct kld_sym_lookup data;data.version = sizeof(struct kld_sym_lookup);data.symname = "sys_getpid";if(kldsym(libKernel, KLDSYM_LOOKUP, &data) == 0) { printf("%pn", data.symvalue); printf("%dn", data.symsize);}
var result = chain.data; var name = chain.data + 8; writeString(name, "getpid"); chain.syscall("getFunctionAddressByName", 591, LIBKERNEL, name, result); chain.execute(function() { logAdd(readString(name) + " libkernel offset = 0x" + (getU64from(result) - module_infos[LIBKERNEL].image_base).toString(16)); });
000000000000BBB0 getpid proc near 000000000000BBB0 mov rax, 20 000000000000BBB7 mov r10, rcx 000000000000BBBA syscall 000000000000BBBC jb short loc_BBBF 000000000000BBBE retn 000000000000BBBF ; --------------------------------------------------------------------------- 000000000000BBBF 000000000000BBBF loc_BBBF: 000000000000BBBF lea rcx, sub_DF60 000000000000BBC6 jmp rcx 000000000000BBC6 getpid endp
int (*sceSystemServiceLaunchWebBrowser)(const char *uri, void *);void *t(void *n) { sceKernelSleep(10); sceSystemServiceLaunchWebBrowser("http://google.com/", NULL); return NULL;}int _main(void) { initKernel(); initLibc(); initPthread(); int libSceSystemService; loadModule("libSceSystemService.sprx", &libSceSystemService); RESOLVE(libSceSystemService, sceSystemServiceLaunchWebBrowser); ScePthread thread; scePthreadCreate(&thread, NULL, t, NULL, "t"); return 0;}
function getStackProtection() { var info = chain.data; chain.syscall("getMemoryInfo", 547, stack_base, info); chain.execute(function() { var base = getU64from(info + 0x0); var size = getU64from(info + 0x8) - base; var protection = getU32from(info + 0x10); logAdd("Stack base: 0x" + base.toString(16)); logAdd("Stack size: 0x" + size.toString(16)); logAdd("Stack protection: 0x" + protection.toString(16)); }); } function getStackName() { var info = chain.data; chain.syscall("getOtherMemoryInfo", 572, stack_base, 0, info, 0x40); chain.execute(function() { var base = getU64from(info + 0x0); var size = getU64from(info + 0x8) - base; var name = readString(info + 0x20); logAdd("Stack base: 0x" + base.toString(16)); logAdd("Stack size: 0x" + size.toString(16)); logAdd("Stack name: " + name); }); }
var info = chain.data; chain.syscall("getOtherMemoryInfo", 572, 0, 1, info, 0x40); chain.execute(function() { var base = getU64from(info + 0x0); var size = getU64from(info + 0x8) - base; var name = readString(info + 0x20); logAdd("First page base: 0x" + base.toString(16)); logAdd("First page size: 0x" + size.toString(16)); logAdd("First page name: " + name); });
Name Address Size Protection executable 0x65620000 0x4000 0x5 executable 0x65624000 0x4000 0x3 anon:000819401c98 0x200578000 0x4000 0x3 anon:00081baf2243 0x20057c000 0x8000 0x3 anon:00081add693a 0x200584000 0x8000 0x3 anon:00081baf22d6 0x20058c000 0x8000 0x3 anon:00081add739e 0x200594000 0x100000 0x3 anon:00081add6ad2 0x200694000 0x8000 0x3 anon:00081add6ad2 0x20069c000 0x8000 0x3 anon:000815405218 0x2006a4000 0x4000 0x3 anon:00081ac4f19e 0x2006a8000 0x8000 0x3 anon:00081add739e 0x2006b0000 0x100000 0x3 anon:00081ba08107 0x2007b0000 0x4000 0x3 anon:00081ad834f7 0x2007b4000 0x4000 0x1 anon:00081add739e 0x2007b8000 0x300000 0x3 stack guard 0x7ef788000 0x4000 0x0 JavaScriptCore::BlockFree 0x7ef78c000 0x10000 0x3 stack guard 0x7ef79c000 0x4000 0x0 RscHdlMan:Worker 0x7ef7a0000 0x10000 0x3 stack guard 0x7ef7b0000 0x4000 0x0 SceWebReceiveQueue 0x7ef7b4000 0x10000 0x3 stack guard 0x7ef7c4000 0x4000 0x0 SceFastMalloc 0x7ef7c8000 0x10000 0x3 stack guard 0x7ef7d8000 0x4000 0x0 sceVideoCoreServerIFThread 0x7ef7dc000 0x10000 0x3 (NoName)WebProcess.self 0x7ef7ec000 0x4000 0x0 main stack 0x7ef7f0000 0x200000 0x3 0x7ef9f0000 0x4000 0x5 libSceRtc.sprx 0x802ccc000 0x4000 0x5 libSceRtc.sprx 0x802cd0000 0x4000 0x3 libSceSystemService.sprx 0x803468000 0x14000 0x5 libSceSystemService.sprx 0x80347c000 0x4000 0x3 libSceSystemService.sprx 0x803480000 0x8000 0x3 libSceSysmodule.sprx 0x8049bc000 0x4000 0x5 libSceSysmodule.sprx 0x8049c0000 0x4000 0x3 libkernel.sprx 0x808774000 0x34000 0x5 libkernel.sprx 0x8087a8000 0x2c000 0x3 libSceRegMgr.sprx 0x80a520000 0x4000 0x5 libSceRegMgr.sprx 0x80a524000 0x4000 0x3 libSceSsl.sprx 0x80d1c0000 0x48000 0x5 libSceSsl.sprx 0x80d208000 0x8000 0x3 libSceOrbisCompat.sprx 0x80f648000 0x15c000 0x5 libSceOrbisCompat.sprx 0x80f7a4000 0x38000 0x3 libSceOrbisCompat.sprx 0x80f7dc000 0x4000 0x3 libSceLibcInternal.sprx 0x8130dc000 0xd0000 0x5 libSceLibcInternal.sprx 0x8131ac000 0x8000 0x3 libSceLibcInternal.sprx 0x8131b4000 0x18000 0x3 libScePigletv2VSH.sprx 0x815404000 0x74000 0x5 libScePigletv2VSH.sprx 0x815478000 0x2c000 0x3 libSceVideoCoreServerInterface. 0x819400000 0xc000 0x5 libSceVideoCoreServerInterface. 0x81940c000 0x4000 0x3 libSceWebKit2.sprx 0x81ac44000 0x2414000 0x5 libSceWebKit2.sprx 0x81d058000 0x148000 0x3 libSceWebKit2.sprx 0x81d1a0000 0xbc000 0x3 libSceIpmi.sprx 0x81da60000 0x14000 0x5 libSceIpmi.sprx 0x81da74000 0x14000 0x3 libSceMbus.sprx 0x8288a0000 0x8000 0x5 libSceMbus.sprx 0x8288a8000 0x4000 0x3 libSceCompositeExt.sprx 0x829970000 0x8000 0x5 libSceCompositeExt.sprx 0x829978000 0x44000 0x3 libSceNet.sprx 0x82ccdc000 0x1c000 0x5 libSceNet.sprx 0x82ccf8000 0x14000 0x3 libSceNetCtl.sprx 0x833f1c000 0x8000 0x5 libSceNetCtl.sprx 0x833f24000 0x4000 0x3 libScePad.sprx 0x835958000 0x8000 0x5 libScePad.sprx 0x835960000 0x8000 0x3 libSceVideoOut.sprx 0x83afe4000 0xc000 0x5 libSceVideoOut.sprx 0x83aff0000 0x4000 0x3 libSceSysCore.sprx 0x83cdf4000 0x8000 0x5 libSceSysCore.sprx 0x83cdfc000 0x4000 0x3 SceLibcInternalHeap 0x880984000 0x10000 0x3 SceKernelPrimaryTcbTls 0x880994000 0x4000 0x3 SceVideoCoreServerInterface 0x880998000 0x4000 0x3 SceLibcInternalHeap 0x88099c000 0xc0000 0x3 SceLibcInternalHeap 0x880a5c000 0x20000 0x3 SceLibcInternalHeap 0x880a7c000 0x490000 0x3 SceLibcInternalHeap 0x880f0c000 0x470000 0x3 anon:00080f64a807 0x912000000 0x100000 0x3 anon:00080f64a98d 0x912100000 0x10000000 0x3 anon:00080f64aaa5 0x922100000 0x4000000 0x5 CompositorClient 0x1100000000 0x200000 0x33 CompositorClient 0x1100200000 0x200000 0x33 CompositorClient 0x1100400000 0x200000 0x33 CompositorClient 0x1100600000 0x200000 0x33 CompositorClient 0x1180000000 0x200000 0x33 CompositorClient 0x1180200000 0x200000 0x33 CompositorClient 0x1180400000 0x200000 0x33 CompositorClient 0x1180600000 0x200000 0x33 CompositorClient 0x1180800000 0x200000 0x33 CompositorClient 0x1180a00000 0x200000 0x33 CompositorClient 0x1180c00000 0x200000 0x33 CompositorClient 0x1180e00000 0x200000 0x33 CompositorClient 0x1181000000 0x200000 0x33 CompositorClient 0x1181200000 0x200000 0x33 CompositorClient 0x1181400000 0x200000 0x33 CompositorClient 0x1181600000 0x200000 0x33 CompositorClient 0x1181800000 0x200000 0x33 CompositorClient 0x1181a00000 0x200000 0x33 CompositorClient 0x1181c00000 0x200000 0x33 CompositorClient 0x1181e00000 0x200000 0x33 CompositorClient 0x1182000000 0x200000 0x33 CompositorClient 0x1184000000 0x200000 0x33 CompositorClient 0x1186000000 0x200000 0x33 CompositorClient 0x1188000000 0x200000 0x33 CompositorClient 0x118a000000 0x200000 0x33 CompositorClient 0x118c000000 0x200000 0x33 CompositorClient 0x118e000000 0x200000 0x33
CPU读-1 CPU写-2 CPU执行-4 GPU执行-8 GPU读-16 GPU写-32
// Give GPU read and write access to stack: chain.syscall("mprotect", 74, stack_base, 16 * 1024 * 1024, 1 | 2 | 16 | 32); // Give GPU read and execute access to WebKit2 module: chain.syscall("mprotect", 74, module_infos[WEBKIT2].image_base, 16 * 1024 * 1024, 1 | 4 | 16 | 8);
// Give GPU read and execute access to stack: chain.syscall("mprotect", 74, stack_base, 16 * 1024 * 1024, 1 | 2 | 16 | 8); // Give GPU read and write access to WebKit2 module: chain.syscall("mprotect", 74, module_infos[WEBKIT2].image_base, 16 * 1024 * 1024, 1 | 4 | 16 | 32);
setU64to(chain.data, 11); chain.syscall("getSandboxDirectory", 602, 0, chain.data + 8, chain.data); chain.write_rax_ToVariable(0); chain.execute(function() { var name = readString(chain.data + 8); logAdd(name); });
chain.syscall("mmap", 477, 0, 0x1000000, 1 | 2, 4096, -1, 0); chain.write_rax_ToVariable(0); chain.execute(function() { chain.logVariable(0); });
writeString(chain.data, "/AaQj0xlzjX/common/font/DFHEI5-SONY.ttf"); chain.syscall("open", 5, chain.data, 0, 0); chain.write_rax_ToVariable(0); chain.read_rdi_FromVariable(0); chain.syscall("read", 3, undefined, 0x200744000, 0x1000000); chain.syscall("fstat", 189, undefined, chain.data); chain.execute(function() { chain.logVariable(0); logAdd("Size: " + getU32from(chain.data + 0x48).toString()); });
sendBuffer("192.168.0.4", 9023, 0x200744000, 8312744); chain.execute(function() { logAdd("Dumped"); });
/user/home/[userID]/savedata/[titleID]/
/user/home/10000000/savedata/CUSA00455/FFXIVSYSTEM.bin
int libSave = sceKernelLoadStartModule("libSceSaveData.sprx", 0, NULL, 0, 0, 0);int (*sceSaveDataInitialize)(void *);RESOLVE(libSave, sceSaveDataInitialize);sceSaveDataInitialize(NULL);
原文发布时间为:2017年4月5日
本文作者:xiaohui
本文来自云栖社区合作伙伴嘶吼,了解相关信息可以关注嘶吼网站。