[10570] in bugtraq

home help back first fref pref prev next nref lref last post

Re: Clarification: LD_PRELOAD issue

daemon@ATHENA.MIT.EDU (John Daniele)
Mon May 17 17:29:43 1999

Content-Identifier: 003F8373DFAC5035
Content-Return: Allowed
Mime-Version: 1.0
Message-Id: <003F8373DFAC5035*/c=ca/admd=CONCERT/prmd=kpmg/o=noteServer/s=Daniele/g=John/@MHS>
Date: 	Sat, 15 May 1999 18:52:53 -0400
Reply-To: John Daniele <JDaniele@KPMG.CA>
From: John Daniele <JDaniele@KPMG.CA>
To: BUGTRAQ@NETSPACE.ORG

/*
  * rollover.c
  *
  * using ptrace() to intercept and modify the return value of a system call
  *
  * John Daniele
  * jdaniele@kpmg.ca
  * VOX: (416) 777-3759
  *
  */

#include <unistd.h>
#include <sys/ptrace.h>

int main(void)
{	
	int ret, x, y;
	pid_t procid;

	if(procid = fork()) {		
		for(;;) {
			x = ptrace(PTRACE_PEEKUSR, procid, 44, 0);
			if(x == 13) {	
				y = ptrace(PTRACE_PEEKUSR, procid, EBX,
0);		
				ptrace(PTRACE_POKEDATA, procid, y,
2175984000);	
			}
			ptrace(PTRACE_SYSCALL, procid, 1, 0);	
		}	
	}	
	ptrace(PTRACE_TRACEME, 0, 1, 0);	
	execl("/bin/date", "/bin/date", NULL, (char *)0);
}

home help back first fref pref prev next nref lref last post