Networking

A Beginner’s Guide To Ports

Ports

So what are ports? What can we do with them?
Well lets think of a situation,
My friend (Internet) wants to send me (Firefox) a letter (data packet) and I live in a hostel.
He wrote my address (IP address) on the letter and gave it to postman (Internet)
He came to my hostel (Computer) but then he realized that there are three other boys (other applications) in my room having names Nidhish (Windows Update), Grey (Nmap) and Michael ( McAfee).
Now the postman (Internet) is confused because he don’t know whom should he give the letter (Data packet).
Well here is the point where the Ports come into play.
Every data packet has a number with it ranging from 0 to 65536.
And every program and service has its own Port number like HTTP’s port is 80 and FTP’s port is 21.
Now the Postman can say “Here is the delivery for Port no. 43” and I will get the data packet.
Ports are cool..Aren’t they?
But what if someone sends a bomb for me and there is no security check? Whoa…Ports are dangerous aren’t they?
Now lets talk about Open and Closed ports.
Well if a port is accepting data packets then its an open port.
And if a port is rejecting data packets then its closed port.
Now here is a thing to remember if a port is not associated with any service then its a closed port as it doesn’t accept any kind of data from internet.
If a port is associated with a service then it can be exploited*
Exploit means ummm
Everything has a weakness (we call it vulnerability) and taking advantage of this weakness is called exploitation.
And the script/code or method used is called Exploit.
So you want to know why this thing is so easy?
Well ports receive data by numbers like Port 53 will receive only the data sent for Port 53 but If we send it data with 53 no. tag then the port have to accept it as it is sent for it.
But what if we send an exploit with the tag 53 on it? Yes! This is what hackers do.
As you know now that every port represents a service running on a computer then hackers can use a port to exploit the service attached to it.

How to stay safe?

If you want to protect yourself from these Open Port problems you need a Firewall.
Well firewall is a program which scans the data coming in and out of your system and it can detect malicious data packets and block them before they reach your computer.

PORT NUMBERS

Port numbers range from 0 to 65536, but only port numbers 0 to 1024 are reserved for privileged services and designated as well-known ports. This list of well-known port numbers specifies the port used by the server process as its contact port:
.
1 TCP Port Service Multiplexer (TCPMUX)
5 Remote Job Entry (RJE)
7 ECHO
18 Message Send Protocol (MSP)
20 FTP — Data
21 FTP — Control
22 SSH Remote Login Protocol
23 Telnet
25 Simple Mail Transfer Protocol (SMTP)
29 MSG ICP
37 Time
42 Host Name Server (Nameserv)
43 WhoIs
49 Login Host Protocol (Login)
53 Domain Name System (DNS)
69 Trivial File Transfer Protocol (TFTP)
70 Gopher Services
79 Finger
80 HTTP
103 X.400 Standard
108 SNA Gateway Access Server
109 POP2
110 POP3
115 Simple File Transfer Protocol (SFTP)
118 SQL Services
119 Newsgroup (NNTP )
137 NetBIOS Name Service
139 NetBIOS Datagram Service
143 Interim Mail Access Protocol (IMAP)
150 NetBIOS Session Service
156 SQL Server
161 SNMP
179 Border Gateway Protocol (BGP)
190 Gateway Access Control Protocol (GACP)
194 Internet Relay Chat (IRC)
197 Directory Location Service (DLS)
389 Lightweight Directory Access Protocol (LDAP)
396 Novell Netware over IP
443 HTTPS
444 Simple Network Paging Protocol (SNPP)
445 Microsoft-DS
458 Apple QuickTime
546 Client
547 DHCP Server
563 SNEWS
569 MSN
1080 Socks

So it was my best attempt to tell you guys about ports and I hope you liked it.
Thanks for reading and don’t forget to ask something if you don’t understand.

Also Read: Port Scanning : First Step Of Exploitation


About the author

D3V

I am Somdev Sangwan also known as D3V. I am n00b and I love computers and hacking. I am a python freak and your friendly neighborhood hacker.

7 Comments

Click here to post a comment

Browse Categories:

Subscribe Now

Get the latest post directly into your inbox.

Thank you for subscribing.

Something went wrong.