LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 02-07-2009, 02:00 PM   #1
linuxC
LQ Newbie
 
Registered: Feb 2009
Posts: 1

Rep: Reputation: 0
Why cant i get my exploit code to work?


VULNERABLE CODE
int func(char* a, short ar)
{
char buf[10];
int i, max = 10;
int l;

if (ar< max)
{
l= strlen(ar);
strncpy(buf, a, l);
}

return 0;
}


EXPLOIT CODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "shellcode.h"


#define TARGET "VULNER"
int main(void)
{
char *ar[3];
char *e[2];
char *tmp = NULL;
ar[0] = problemcode.c;
ar[1] = `perl -e 'print "A"x32768,"shellcode"'`;
ar[2] = NULL;
e[0] = "FOO=bar";
e[1] = NULL;

if (0 > execve(TARGET, ar, e))
return 0;
}


I DONT KNOW WHAT AM I DOING WRONG TO GET THE SHELL TO WORK ON THE VULNERABLE CODE ABOVE
 
Old 02-07-2009, 02:46 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
No chance. We aren't here to help you run malicious code you don't understand that you copied from a book...
 
Old 02-07-2009, 05:44 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,960

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by linuxC View Post

I DONT KNOW WHAT AM I DOING WRONG TO GET THE SHELL TO WORK ON THE VULNERABLE CODE ABOVE
This has to be a joke.

Either that, or you're too stupid to own a computer, if you believe people will help you do something such as this.
 
Old 02-07-2009, 10:41 PM   #4
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
I think you are overreacting, I think that he is just studying about buffer overflows, something that more programmers should know how to avoid by the way.

However, the whole code he pasted doesn't make sense as a whole. So, whatever info you need, you will need to be more explicit on what the concrete problem is, and paste the exact code you are trying to compile, because this doesn't make much sense and won't compile as is.

Last edited by i92guboj; 02-07-2009 at 10:48 PM.
 
Old 02-08-2009, 03:39 AM   #5
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Quote:
Originally Posted by i92guboj View Post
I think you are overreacting, I think that he is just studying about buffer overflows, something that more programmers should know how to avoid by the way.
Maybe, but just look over the title "Why cant i get my exploit code to work?". He clearly stated "exploit code"... what just isn't a good sign. However I do agree that to protect against exploits and hacks you have to learn about the exploits and hacks to being with.
 
Old 02-08-2009, 03:49 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by r3sistance View Post
Maybe, but just look over the title "Why cant i get my exploit code to work?". He clearly stated "exploit code"... what just isn't a good sign. However I do agree that to protect against exploits and hacks you have to learn about the exploits and hacks to being with.
The title might be misleading, but just looking at the code you know even if you are not a C programmer that this is not the A-bomb. It's a simple program that "aims" to copy strings in a potentially buggy way.

However, as I said, the code is incomplete and full of flaws. So it won't work anyway.

Maybe he's just a non-native english speaker who chose the wrong words. However, his post is strange to say the least. :P
 
Old 02-08-2009, 03:53 AM   #7
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
I know some C, and that code does look like nonsense, personally I just get a scripter kiddy impression coming from the original post. Personally I like well structured code that says what it is actually doing (or atleast trying to do) anyway, but oh well.
 
Old 02-08-2009, 12:31 PM   #8
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,053

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
Maybe it doesn't like you shouting at it
 
Old 02-08-2009, 12:39 PM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
Talking

Quote:
Originally Posted by salasi View Post
Maybe it doesn't like you shouting at it
Actually, you can cause read errors in hard drives by yelling at them. I wouldn't be surprised it that were used to skew read time tests on a competitor's hard drive, to be published in an ad.
 
Old 02-08-2009, 04:24 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
And closed for (at least to me) obvious reasons. We *don't* do sploits
or support thereof at LQ
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in writing exploit code under linux ! *Mafia* Programming 11 03-25-2007 08:52 PM
LXer: Firefox targeted with exploit code LXer Syndicated Linux News 0 12-14-2005 09:31 AM
LXer: Firefox 1.5 exploit code released LXer Syndicated Linux News 1 12-13-2005 06:53 AM
SSH remote exploit code... khermans Linux - Security 1 10-01-2003 04:28 AM


All times are GMT -5. The time now is 06:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration