-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbasic.js
129 lines (114 loc) · 3.33 KB
/
basic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
var VulnerableVault = ObjC.classes.VulnerableVault;
function solve101(){
var method = VulnerableVault["- setSecretInt:"];
Interceptor.attach(method.implementation, {
onEnter(args) {
console.log(args[2]);
}
});
}
function solve102(){
var method = VulnerableVault["- setSecretNumber:"];
Interceptor.attach(method.implementation, {
onEnter(args) {
console.log(new ObjC.Object(args[2]));
}
});
}
function solve103(){
var method = VulnerableVault["- setSecretString:"];
Interceptor.attach(method.implementation, {
onEnter(args) {
console.log(ObjC.Object(args[2]));
}
});
}
function solve104(){
var method = ObjC.classes["VulnerableVault"]["- winIfTrue:"]
Interceptor.attach(method.implementation, {
onEnter(args) {
args[2] = ptr(0x1)
}
});
}
function solve105(){
var method = VulnerableVault["- getSecretString"];
Interceptor.attach(method.implementation, {
onLeave(retval) {
console.log(new ObjC.Object(retval))
}
});
}
function solve106(){
var method = ObjC.classes["VulnerableVault"]["- hasWon"];
Interceptor.attach(method.implementation, {
onLeave(retval) {
retval.replace(ptr(0x1))
}
});
}
function solve107(){
var method = VulnerableVault["- getSecretKey"];
Interceptor.attach(method.implementation, {
onLeave(retval) {
// Via NSString
var theString = ObjC.classes.NSString.alloc()["- initWithData:encoding:"](retval, 4);
console.log(theString)
// Without NSString
var data = new ObjC.Object(retval);
console.log(data.bytes().readUtf8String(data.length()));
}
});
}
function solve108(){
var method = VulnerableVault["- getself"];
Interceptor.attach(method.implementation, {
onLeave(retval) {
var vault = new ObjC.Object(retval);
vault.win();
}
});
}
function solve109(){
var method = VulnerableVault["- getself"];
Interceptor.attach(method.implementation, {
onLeave(retval) {
var vault = new ObjC.Object(retval);
vault.winIfFrida_and27042_("Frida", 27042);
}
});
}
function solve110(){
var method = VulnerableVault["- doNothing"];
Interceptor.attach(method.implementation, {
onLeave() {
var hiddenVault = ObjC.chooseSync(ObjC.classes.HiddenVault)[0]
hiddenVault.win();
}
});
}
function solve111(){
var method = VulnerableVault["- doNothing"];
Interceptor.attach(method.implementation, {
onLeave() {
// Find hidden function
console.log(ObjC.classes.HiddenVault.$ownMethods);
// Call it
var hiddenVault = ObjC.chooseSync(ObjC.classes.HiddenVault)[0]
hiddenVault["- super_secret_function"]();
}
});
}
function solve112(){
var method = VulnerableVault["- generateNumbers"];
Interceptor.attach(method.implementation, {
onLeave(retval) {
let array = ObjC.Object(retval)
for(var i = 0; i<array["- count"](); i++){
if(array["- objectAtIndex:"](i) > 42){
array["- setObject:atIndex:"](42, i);
}
}
}
});
}