(adsbygoogle = window.adsbygoogle || []).push({});
Recently, the spanish scene developer JaicraB has updated his personal blog with some very important key information on how the Cobra USB dongles are been doing their own internal JIG protection, that has been stopping the clones from working correctly using the various recent dumps.
Flynn sent me this text explaining this protective carrying the Cobra, I hope it will open the eyes of those interested in reversing the dumps.
EXPLAIN RTOC COBRA TRICK
Originally posted by another user
The JIG Cobra has several protective measures to ensure that your code could not be used correctly even if your code could be dumped.
This trick RTOC in the registry is the first used for this purpose in addition to hinder analysis.
Registration is initially RTOC stored in the battery to keep the RTOC of lv2 and power it back later:
Code:
# =============== S U B R O U T I N E
Originally posted by another user
cobra_syscall_sm_shutdown_hook: # CODE XREF: syscall_379 j
.set arg_20, 0x20
.set arg_28, 0x28
.set arg_30, 0x30
.set arg_38, 0x38
.set arg_40, 0x40
mflr %r0
std %r0, arg_20(%sp)
std %rtoc, arg_28(%sp)
At this point we have to explain that the OFFSET DELTA.
DELTA OFFSET is a method used in the x86 in its original moments in the creation of computer viruses, to calculate the memory address in which we are in the sea of bytes in RAM.
In the original time a computer virus when I did not know where he was pulled into an executable, depending on the executable it could be an initial site or another, for it was invented DELTA OFFSET.
DELTA OFFSET can be used in any system, the procedure is:
- Using the record that indicates the current execution address (or the next depending on the system)
- Reducing the size of the previous code we use the value obtained from the registry.
Knowing this, and taking for example the x86 processor where the EIP register can not be read directly invented the trick make a call to a "subfunction" which is simply the following line to the call:
Code:
Originally posted by another user
call x
x:
pop eax
X86 call instruction saves the top of the stack the address of the next instruction to itself.
Thus using pop draw from the top of the stack this value, and stored in eax for example, and having the memory address where we only subtract the above would be missing and we have the exact calculation.
The PowerPC can use this trick using the BL instruction is equivalent (LINK BRANCH), which jumps to a "subfunction" but before you save LR in the record the following address to BL.
Code:
Originally posted by another user
bl _delta_offset
_delta_offset:
At this point we see the trick used for the creation of the RTOC of charges at this time.
If you look both r0 and RTOC are passed to 0:
Code:
Originally posted by another user
li %r0, 0
li %rtoc, 0
Subsequently, given the value 0x11DE0 to RTOC:
Code:
Originally posted by another user
oris %rtoc, %rtoc, 1
ori %rtoc, %rtoc, 0x1DE0
A r0 is given the value 0x920:
Code:
Originally posted by another user
oris %r0, %r0, 0
ori %r0, %r0, 0x920
R0 is subtracted from the value of RTOC:
Code:
Originally posted by another user
subf %r0, %r0, %rtoc
Unlike the PowerPC x86 LR register can be read directly with mflr instruction, we put in RTOC the value obtained by the delta offset:
Code:
Originally posted by another user
mflr %rtoc
To calculate the delta offset subtract final instructions executed before the delta offset, which were 4, or 16 bytes:
Code:
Originally posted by another user
addi %rtoc, %rtoc, -0x10
Finally we add the value of r0 at the end of the delta offset RTOC, storing the result in the RTOC and this already takes RTOC suitable for this hook:
Code:
Originally posted by another user
add %rtoc, %rtoc, %r0
It takes having the RTOC stored in the stack 3 arguments that the hook received:
Code:
Originally posted by another user
std %r3, arg_30(%sp)
std %r4, arg_38(%sp)
std %r5, arg_40(%sp)
You call the function of the charges where the first argument will check for command 0x8202 (a special command to the usual):
Code:
Originally posted by another user
bl cobra_syscall_sm_shutdown
After making the necessary steps as charged, the battery recovers the original RTOC, like the arguments the hook received, it executes the original instruction that was overwritten in the syscall entry 379 (in this case) to have our hook, and call the original syscall lv2:
Code:
Originally posted by another user
ld %rtoc, arg_28(%sp)
ld %r3, arg_30(%sp)
ld %r4, arg_38(%sp)
ld %r5, arg_40(%sp)
mfcr %r12
bl original_syscall_sm_shutdown
Upon returning to retrieve the original LR from the stack and returns to the prompt:
Code:
Originally posted by another user
ld %r0, arg_20(%sp)
mtlr %r0
blr
# End of function cobra_syscall_sm_shutdown_hook
Maybe now with this bit of information, we will finally see the clones being able to handle the software end with PSX Backups working!
SOURCE
You must login or register to view this content.