Retrieved by Ultimakillz, http://h4ck.fi.st/index.php/topic,80.0.html
Well, as I wished to do something with the recent MoHH exploit, a friend came with a nice suggestion: making an eloader. And I said myself "why not, let's give it a try". After a couple of weeks of research and coding, I can tell I'm able to load some non-signed ELFs on OFW using this exploit. How is this acheived? Well, you have to get some basic knowledge about how the whole thing works. Let's start with it.
First of all, we have to keep in mind that the exploit allows us to run our code, but we're still limited to user mode. This is not a kernel exploit, so we're stuck in user mode. This means we cannot access kernel memory whatsoever, so patching syscalls/functions is out of the order of the day.
Second, we're still under OFW. This means we cannot load unsigned code using sceKernelLoadExec() or sceKernelLoadModule(), unless we replace them with our own module/executable loading function. Any attempt to use such functions on homebrew modules will just crash the console.
Third, the exploit SDK only allows us to use a little subset of the whole PSP functions. Basically, you can use any function imported by the game, in this case MoHH, but only those. But not all of them are linked by the exploit SDK linker. You have to patch the SDK if you want to use those imported but not included.
Well, quite a few restrictions, right? We'll have to make workarounds for this. Let's see how.
We cannot access kernel mode, no way to workaround this except finding a kernel exploit. That said, any homebrew that require kernel mode priviliges to run would not run on our eloader.
We cannot load unsigned code using OFW kernel functions. Then we'll have to code the module loader function manually. That is, basically rewriting sceKernelLoadExec()/sceKernelLoadModule() without sign check. We'll talk about this in more detail later.
We're limited to the functions subset the exploit SDK allows us to use. We can find more MoHH imports and patch the SDK linker to be able to use more. We can also call some functions directly if we know their address or syscall (well, syscalls are not that easy as we will see), just like the TIFF and ChickHEN exploits did.
Well, basically we have to write a replacement for sceKernelLoadExec()/sceKernelLoadModule() functions taking into account those restrictions. I'll go into it in next.
Any comments appreciated, as always.
Advertising

