Image
 
linkedin_logo.png rss_logo.jpg
twitter_logo.png youtube_logo.jpg
Latest Additions
 
EH-Net Login
Welcome Guest.






Lost Password?
No account yet? Register
Who's Online
We have 54 guests and 2 members online
 
Advertisement

You are here: Home arrow Ethical Hacking Discussions and Related Certificationsarrow Programmingarrow Shell Code
EH-Net
May 22, 2013, 02:42:30 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Go back to The Ethical Hacker Network Online Magazine Home Page
 
   Home   Help Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Shell Code  (Read 10717 times)
0 Members and 1 Guest are viewing this topic.
JJJHS13
Newbie
*
Offline Offline

Posts: 16


View Profile
« on: January 10, 2008, 12:02:17 AM »

Sorry i didn't really know where to put this question. I want to write my own shell but i have no clue where to start, which programing languages to learn. Ive been trying to get articles from packet storm but they mainly just have exploits, i found a couple of articles searching the web and only got tips on securing shells but i cant find a decent one on how to write my own. If you could give me starting point it would be much appreciated.
Logged
dean
Guest
« Reply #1 on: January 10, 2008, 08:23:18 AM »

Hi JJJHS13,

You might want to learn to walk before you start running with scissors in your hand. But if you're looking to learn about exploits and shellcode then looking at existing exploits is not a bad place to start.

Developing exploit code is not really dependent on a specific language you can write an exploit in perl, python, C or Assembly for example. Shellcode is generally written in C and converted to ASM in order to reduce the size of the payload. If you look at one of the exploits on Milw0rm.com you will see the payload represented by something like the following:

char code[] = "\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb"\
         "\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89"\
         "\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd"\
         "\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f"\
         "\x73\x68\x58\x41\x41\x41\x41\x42\x42\x42\x42";

This is the hex representation of the bytecode. This shellcode is for a bind shell on a linux platform. It makes a call to execve() in order to spawn a shell using /bin/sh. Gotta love "int 0x80"!

Obviously, writing shellcode for each OS platform is different and requires a different approach.

There are some excellent books on the subject as well such as:

Sockets, Shellcode, Porting and Coding by James Foster

As for Google: try "writing shellcode" <-- got me hundreds of hits.

dean
Logged
JJJHS13
Newbie
*
Offline Offline

Posts: 16


View Profile
« Reply #2 on: January 10, 2008, 10:58:37 PM »

hey thanks man
Logged
g00d_4sh
Sr. Member
****
Offline Offline

Posts: 394



View Profile
« Reply #3 on: January 11, 2008, 11:51:10 AM »

I picked up a shell code hack book earlier this year.. and after the first chapter I realized without a solid knowledge of C and assembly language.. I was wasting my time even reading it.  It's on my shelf until next year or so.  Running with scissors is an understatement.
Logged

"Bad.. Good?  I'm the guy with the gun"
dannioni
Newbie
*
Offline Offline

Posts: 44


View Profile
« Reply #4 on: January 15, 2008, 04:42:56 AM »

I've got Gray Hat Hacking this week, I haven't read all of it, but for Table of Contents I'd say this is just the book you're looking for. Of course prior experience with C/C++/ASM is helpful you can get by without it, at least with this book.
Logged
don
Editor-In-Chief
Administrator
Hero Member
*****
Offline Offline

Posts: 4165


Editor-In-Chief


View Profile WWW
« Reply #5 on: January 15, 2008, 12:01:58 PM »

If anyone wants to check out the entire chapter in Grey Hat Hacking that introduces you to coding, it's right here on EH-Net:

Grey Hat Hacking - Chapter 7: Programming Survival Skills

Hope this helps,
Don
Logged

CISSP, MCSE, CSTA, Security+ SME
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Page created in 0.056 seconds with 23 queries.
 
Exclusive Deal

sansfire13_245x90_cw90.jpg
SANSFIRE 2013
June 15 - 22

5% Off w/ Code: EHN_5

SANS Deals 4 EH-Netters
5% OFF Any SANS Course in Any Format!
Coupon Code: EHN_5 Including SANS Rocky Mountain 2013 & SANS Boston 2013
Polls
Compared to this year, 2013 will be:
 
Recent Forum Topics
EH-Net News Feeds
Latest Additions
 
         
Advertisement

© 2013 The Ethical Hacker Network
Joomla! is Free Software released under the GNU/GPL License.