MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / Chain950Base

Class Chain950Base

g2all/900/rop/950.js:194–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194class Chain950Base extends ChainBase {
195 constructor() {
196 super();
197
198 // for conditional jumps
199 this._clean_branch_ctx();
200 this.flag = new Uint8Array(8);
201 this.flag_addr = get_view_vector(this.flag);
202 this.jmp_target = new Uint8Array(0x100);
203 rw.write64(this.jmp_target, 0x1c, this.get_gadget(jop4));
204 rw.write64(this.jmp_target, 0, this.get_gadget(jop5));
205
206 // for save/restore
207 this.is_saved = false;
208 this.is_stale = false;
209 this.position = 0;
210 const jmp_buf_size = 0xc8;
211 this.jmp_buf = new Uint8Array(jmp_buf_size);
212 this.jmp_buf_p = get_view_vector(this.jmp_buf);
213 }
214
215 // sequence to pivot back and return
216 push_end() {
217 this.push_gadget("leave; ret");
218 }
219
220 check_is_branching() {
221 if (this.is_branch_ctx) {
222 throw Error('chain is still branching, end it before running');
223 }
224 }
225
226 push_value(value) {
227 super.push_value(value);
228
229 if (this.is_branch_ctx) {
230 this.branch_position += 8;
231 }
232 }
233
234 _clean_branch_ctx() {
235 this.is_branch_ctx = false;
236 this.branch_position = null;
237 this.delta_slot = null;
238 this.rsp_slot = null;
239 this.rsp_position = null;
240 }
241
242 clean() {
243 super.clean();
244 this._clean_branch_ctx();
245 this.is_saved = false;
246 this.is_stale = false;
247 this.position = 0;
248 }
249
250 push_get_retval() {
251 this.push_gadget('pop rdi; ret');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected