Ch. 2
Ch. 2
Figure 2.1
System
Vulnerability
TCP Connections / Sockets
“In computer networking, an Internet socket or network socket is an endpoint of
a bidirectional inter-process communication flow across an Internet Protocol-
based computer network, such as the Internet.”
http://en.wikipedia.org/wiki/TCP_and_UDP_port
TCP
TCP Port Numbers
Port Numbers
TCP Port Numbers
• This involves a SYN sent to an TCP open port that has a service bound
to it.
• Typical examples are HTTP (port 80), SMTP (port 25), POP3 (port 110)
or SSH (port 22).
Behind the scenes…
Figure 2.5
Filtered Firewall
An Open Port (service) is found
• Services do not always run on default ports; hence the scanner must rely on
banners and “nudges” to elicit a response from a listening port
• If you possess an exploit for this version of SSH and know the target
operating system, then you’re a few steps away from compromising the
host
• N-map –O hostname
Behind the scenes…
Traffic Probe
• Invalid messages produce verbose errors from a service where valid messages
produce uninformative ones
$ echo -e "HEAD / HTTP/1.0\r\n\r\n" | nc -v
localhost 80 Connection to localhost 80 port
[tcp/http] succeeded!
HTTP/1.1 200 OK
Date: Mon, 12 Nov 2012 21:15:58 GMT
Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/1.0.1c DAV/2
PHP/5.3.14 Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
ETag: "eb879f-2c-
3e9564c23b600" Accept-Ranges: bytes
Content-Length: 44 Connection: close
Content-Type: text/html; charset=utf-8
Vulnerability Probe
• Some security bugs can’t be identified without sending a payload that exploits a
suspected vulnerability
– In PHP the NULL may be part of a string, but it serves as a string terminator in the
system function that underlies PHP’s include once directive.
– This exploit took advantage of a lack of input validation and a mismatch between
string handling in programming languages
Open VAS
The Open Vulnerability Assessment System (Open VAS)
• Collects and manages security information for networks, devices, and systems
– service banners
– version numbers
– network responses
• Two systems communicate with each other over a network by establishing a socket
• Each end point (usually a client who initiates a request) and server (which receives
the request) bind a local port to use for the connection.
• Net-cat performs a narrow function with a broad application to hacking and network
debugging
• It reads and writes data for TCP and UDP connections
• Net-cat enables you to redirect shell commands across a network.
• It’s a cat command for networking
Net cat’s Uses
• Obtain Remote Access to a Shell
• Perform Basic Port Scanning
• Identify Yourself: Services Spilling Their Guts
• Communicate with UDP Services
• Frame a Friend: IP Spoofing
• Hijack a Service
• Create Proxies and Relays
• Get Around Port Filters
• Build a Datapipe: Your Own File Transfer……
So-cat
• So-cat is a Net-cat clone with extensive configuration options
• It supports several protocols, from Open SSL to proxies to IPv4 and IPv6
• The biggest difference from other clones is so-cat’s departure from familiar
command-line options
• Instead of the alphabet soup of Net-cat’s flags, so-cat uses
word-based directives on the command line
Understanding Port and Services tools
• For a packet to reach its destination, it must have an IP address (a host on the
network) and a port (a “socket” on that host)
• Example
– E-mail and the Web have predefined destination port numbers
– e-mail uses port 25 (SMTP)
– Web uses 80 (HTTP) and 443 (HTTPS)
Cont..
• A port redirection tool works by:
– Receiving data on one IP/port combination
– Forwarding the data to another IP/port combination.
• It works as an intermediary between the original client and the eventual destination
Data pipe
• A port redirection tool passes TCP/IP traffic received by the tool on one port to
another port to which the tool points.
• Aside from handling IP addresses and port numbers, port redirection is protocol
ignorant—the tool does not care whether you pass encrypted SSH traffic or plain-text
e-mail through it.
Data Pipe Cont…..