Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit 44c5637

Browse files
committed
Change how arguments are sent to the start method
1 parent b8d1dc9 commit 44c5637

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

exploit/runNro.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ module.exports = (res, args) => {
103103
utils.log("closing sm and jumping...");
104104
sc.svcCloseHandle(sc.smHandle).assertOk();
105105
sc.smHandle = undefined;
106-
utils.log("returned " + utils.paddr(sc.call(utils.add2(sc.svcNroBase, 0x80), [libtransistorContext])));
106+
var handle = sc.svcGetThreadId().assertOk();
107+
utils.log("returned " + utils.paddr(sc.call(utils.add2(sc.svcNroBase, 0x80), [0, handle, libtransistorContext])));
107108

108109
var logBufferAddr = [libtransistorContext[6], libtransistorContext[7]];
109110
var logLengthAddr = [libtransistorContext[8], libtransistorContext[9]];

exploit/svc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,23 @@ svcMixin.svcCreateSharedMemory = function (size, permission1, permission2) {
103103
return this.svcWithResult(0x50, [handleBuffer, size, permission1, permission2]).replaceValue(handleBuffer[0]);
104104
};
105105

106+
/*
107+
Usages:
108+
svcGetThreadId()
109+
svcGetThreadId(tid)
110+
*/
111+
svcMixin.svcGetThreadId = function (tid) {
112+
if (tid === undefined) {
113+
tid = 0xffff8000;
114+
}
115+
116+
if (typeof (tid) === 'number') { tid = [tid, 0]; }
117+
if (!Array.isArray(tid)) { throw new Error('invalid tid type'); }
118+
119+
var handleBuffer = new Uint32Array(2);
120+
return this.svcWithResult(0x25, [handleBuffer, tid]).replaceValue([handleBuffer[0], handleBuffer[1]]);
121+
};
122+
106123
/*
107124
Usages:
108125
svcMapSharedMemory(handle, size)

0 commit comments

Comments
 (0)