Government Security
Network Security Resources

Jump to content

Photo

Having Trouble Compiling Exploit Code? Look Here!

security windows linux unix bsd hacking exploit
  • Please log in to reply
39 replies to this topic

#1 shaun2k2

shaun2k2

    Staff Sergeant

  • Sergeant Major
  • 348 posts

Posted 28 February 2004 - 06:05 AM

Hi,

A quarter of posts on our great board are people, often people new in the security or hacking scene, stating that they are having problems compiling exploit code that a member has posted on the thread. People post this time after time after time, and although we like helping, it gets very tiresome. Here is the reason you are likely not able to compile the exploits:


THE EXPLOIT IS WRITTEN TO BE COMPILED ON A UNIX-LIKE OS

I repeat: THE CODE IS *NOT* FOR WINDOWS

Most exploit code is written to be compiled on UNIX-like OSes, but a few of Kralor's exploits are for Windows. Here is how to spot UNIX code:

HEADER FILES LIKE "sys/socket.h" and "netinet/in.h" are present in the includes.


Now, if you are that desperate to run the code, but do not want to move to Linux, or *BSD, get Cygwin, and use 'gcc' to compile the exploit.

www.cygwin.com

Then, providing you have installed it correctly, you can type 'gcc' at the BASH prompt:
bash$ gcc sploit.c -o sploit
bash$ ./sploit target.com 21 -o 0xbfff45
crackedbox# echo "r00t::0:0:0wned:/root:/bin/sh" >> /etc/passwd
crackedbox# echo "w00t, I own you!" > /dev/tty1
Okay, so a little cheesy, but you get my point.

Experiment, use cygwin, move to Linux even (I've heard knoppix is good for those who don't want to install Linux on their hard disk).

Hacking is all about using your mind to achieve goals - remember this guys. Use your head, be a hacker.




Thank you for your time.
Shaun.

#2 stonebreaker

stonebreaker

    Private First Class

  • Members
  • 98 posts

Posted 28 February 2004 - 06:16 AM

good article and it can answer many people's question

#3 nolimit

nolimit

    Staff Sergeant

  • Members
  • 387 posts

Posted 28 February 2004 - 06:30 AM

sad that so many people on this board need that..
Might as well help a lil too tho
You guys might get this alot in VC++
Compiling...
servu.cpp
S:\coding\c++\servu\servu.cpp(450) : error C2440: '=' : cannot convert from 'char [128]' to 'unsigned char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
-
This means the variable being allocated, or being passed to a function is not the variable type expected, so you need to convert it. This is done as said by using a reinterpret_cast, C-style cast or function-style cast, converted to simple terms, use the second var type in this format
(type it needs) variable. so, in this it'd be
(unsigned char *)username
Then the error will be gone. Obviously another method is if you get alot of errors concerning one variable, simply change the variable declaration to be the type that it needs.
Kinda tired, hope i covered that right, if not oh well..

#4 prog

prog

    Corporal

  • Members
  • 159 posts

Posted 28 February 2004 - 06:43 AM

After about 2-3 years of struggling with linux. Trying with duel boot. both on one hd and even one on each hd. I wanted to test out cygwin so bad i was d/ling it on dialup. . .=x

But now I have 2 good speed computers. Networked them together. and now I can (filtered) with the linux box and if anything that bad happens, reinstall like i do every 6 months with windows.

#5 BuzzDee

BuzzDee

    Staff Sergeant

  • Sergeant Major
  • 454 posts

Posted 28 February 2004 - 07:53 AM

lol just tried to install cygwin on my windowz box (lnx box is currently down :( ).
after the installation i start cygwin and typing gcc i get command not found. i must have missed something... but dunno what! damn this installation routine suxx lol
would be nice if u could give me a hint ;)

thx

#6 Pro21

Pro21

    Sergeant

  • Members
  • 230 posts

Posted 28 February 2004 - 07:54 AM

Yes good suggestion shaun2k2 :)
With Windows, it s better to use Cygwin to compile Unix Exploits.

damn this installation routine suxx lol

It s very easy to use Cygwin but by default Gcc packages are not installed, then not miss to install them :P
And if you are a good machine, the possibilty is to install VM software who will emuling a secon OS. Under Windows you can emule Unix or Linux system to compile exploit.

Link : http://www.vmware.com/

Personnaly i am running under Windows XP with cygwin and dev c++, i can compile 90 % of unix exploits. (and it s easy to add new lib)
Else you ask a friend help :P

remember this guys. Use your head, be a hacker.

Too LoL ^_^

#7 invisible-boy

invisible-boy

    Private First Class

  • Members
  • 20 posts

Posted 28 February 2004 - 08:07 AM

hi
i install cygwin but it don't have GCC ,& show this message when type GCC:
invisible-boy@invisible-boy ~
$ gcc
bash: gcc: command not found
thx,

#8 prog

prog

    Corporal

  • Members
  • 159 posts

Posted 28 February 2004 - 08:39 AM

install gcc for cygwin, dunno the link. the site is full of 'addons' basicly arent they?

#9 BuzzDee

BuzzDee

    Staff Sergeant

  • Sergeant Major
  • 454 posts

Posted 28 February 2004 - 08:44 AM

lol i only find filelists... this damn site site with its 1000s of links is quite confusing... <_<

anyone got a link for this package? im getting nervous lol

thx

#10 ST.

ST.

    Private First Class

  • Members
  • 94 posts

Posted 28 February 2004 - 08:54 AM

Check to install GCC when installing CYGWIN, at deafaults it does not selected, after that, find the cygwin1.dll and copy it to c:/windows directory (if there will be the other one, owerwrite it) and all will work just fine

#11 Kenny

Kenny

    Former Commander In Chief

  • Retired Admin
  • 6,747 posts

Posted 28 February 2004 - 02:28 PM

This is why GSO created

http://www.codelinx.net/forum

a Forum for dealing with programming

the forums aim is to cover all types of programming with various articles , code examples and resources

we have over 90 members atm , your all welcome.... it will help you to develope your coding skills

the forum is in its early stages... but with your help we can make it a good learning zone

so check it out if your interested ;)
Kenny aka ComSec

Please read the Forum Rules !!!

______________________

#12 Guest_tribalgoa_*

Guest_tribalgoa_*
  • Guests

Posted 28 February 2004 - 03:56 PM

I installed linux ... (debian)
compiled my exploit ... (servu2.c)
got no errors .. have a resulting file called 'Servu2' but when i type Servu2 it says unrecognised command ?!?!?

#13 Pro21

Pro21

    Sergeant

  • Members
  • 230 posts

Posted 28 February 2004 - 04:10 PM

Linux if for Gays :P
Windows Rox ^^

#14 stonebreaker

stonebreaker

    Private First Class

  • Members
  • 98 posts

Posted 28 February 2004 - 07:14 PM

hehe hi tribalgoa i think you shoud type ./Servu2
attention capital of letter

#15 Tyrano

Tyrano

    Staff Sergeant

  • Members
  • 296 posts

Posted 29 February 2004 - 12:03 AM

good info, though not quite sure why people would need this info. shouldn't be compiling exploits if you don't know how to compile in the first place. <_<





Also tagged with one or more of these keywords: security, windows, linux, unix, bsd, hacking, exploit