Skip to content

Commit

Permalink
11.00 working payload loader
Browse files Browse the repository at this point in the history
  • Loading branch information
LightningMods committed May 3, 2024
1 parent b060655 commit 42773d0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stage2/offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#ifndef __OFFSETS_H__
#define __OFFSETS_H__
#define ENABLE_DEBUG_MENU 1
//#define ENABLE_DEBUG_MENU 1

#if FIRMWARE == 900 // FW 9.00

Expand Down Expand Up @@ -60,6 +60,8 @@
#define vm_map_delete_offset 0x0007E680
#define create_thread_offset 0x001ED670
#define all_proc_offset 0x01B946E0
#define sys_dynlib_dlsym_p 0x0023B67F
#define sys_dynlib_dlsym_p2 0x00221B40

/* kernel offsets */

Expand Down
25 changes: 25 additions & 0 deletions stage2/stage2.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ static int sys_kexec(struct thread * td, struct sys_kexec_args * uap) {
}

void stage2(void) {

// Use "kmem" for all patches
uint8_t *kmem;
uint64_t kaslr_offset = rdmsr(MSR_LSTAR) - kdlsym_addr_Xfast_syscall;
uint8_t * kbase = (uint8_t * )(rdmsr(0xC0000082) - 0x1C0);
int( * printf)(const char * format, ...) = (void * ) kdlsym(printf);
Expand Down Expand Up @@ -387,6 +390,28 @@ void stage2(void) {
*(uint8_t * )(kbase + kemem_1) = VM_PROT_ALL;
*(uint8_t * )(kbase + kemem_2) = VM_PROT_ALL;

#if FIRMWARE == 1100 // FW 11.00, only neeeded for 11.00
kmem = (uint8_t *)&kbase[0x1E4C33];
kmem[0] = 0x90;
kmem[1] = 0x90;
kmem[2] = 0x90;
kmem[3] = 0x90;
kmem[4] = 0x90;
kmem[5] = 0x90;

kmem = (uint8_t *)&kbase[0x1E4C43];
kmem[0] = 0x90;
kmem[1] = 0x90;
kmem[2] = 0x90;
kmem[3] = 0x90;
kmem[4] = 0x90;
kmem[5] = 0x90;

kmem = (uint8_t *)&kbase[0x1E4C63];
kmem[0] = 0x90;
kmem[1] = 0xE9;
#endif

// Install kexec syscall 11
struct sysent * sys = & sysents[SYS_kexec];
sys -> sy_narg = 2;
Expand Down

1 comment on commit 42773d0

@DJTOMATO
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, any plans to support 9.03?

Please sign in to comment.