What port is typically open on a system that runs an unencrypted http server?

The HTTP (Hypertext Transfer Protocol) and HTTPS (Hypertext Transfer Protocol Secure) ports are used to transfer data from a web server to a browser.  By default, HTTP connection uses TCP port 80 and HTTPS connection uses TCP port 443.

HTTP connections are unencrypted whereas HTTPS connections are encrypted and use Secure Socket Layer (SSL) protocol.

Telnet application is generally used to verify connectivity to remote services that are based on TCP.  However, the information exchanged in a telnet session between a client and server is unencrypted.   Non-secure HTTP port connections can be tested by using Telnet.
# telnet [hostname or IP address] 80

Example:
# telnet yahoo.com 80

Trying...
Connected to yahoo.com.        
Escape character is '^]'.

            Once connected, telnet connection appears hung as web server waits for HTTP protocol GET/POST request. Enter following lines quickly before the server times out:

GET / HTTP/1.1                        
HOST: yahoo.com

<Hit enter twice to send the request>

Server responds with HTTP status, response headers, data, and the connection is then ended:

HTTP/1.1 301 Moved Permanently                   
Date: Tue, 29 Jun 2021 02:25:58 GMT
Connection: keep-alive
Server: ATS
Cache-Control: no-store, no-cache
Content-Type: text/html
Content-Language: en
X-Frame-Options: SAMEORIGIN
Location: https://yahoo.com/
Content-Length: 8
redirectConnection closed.

For HTTPS port connection, telnet doesn't work, since a secure SSL connection needs to be set up before HTTP commands can be used.  The “openssl” toolkit “s_client” option can be used to test HTTPS connection. It connects to remote hosts by using SSL/TLS.

# openssl s_client -connect <hostname>:443

Example:
----------------------------------------
$ openssl s_client -connect yahoo.com:443
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CA
…..

Once connected, SSL certificate details are output before the HTTP request can be entered.

Certificate chain
……
Server certificate
-----BEGIN CERTIFICATE-----
…..
-----END CERTIFICATE-----
….
SSL handshake has read 3394 bytes and written 431 bytes
….
SSL-Session:
……

Start Time: 1624938529
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

From this point on, rest of session is similar to telnet session, but, it is tunneled through a secure connection.  Just like in telnet session, enter the HTTP request quickly before server times out and hit enter twice to send the request to the server:

GET / HTTP/1.1
HOST: yahoo.com

Server responds with HTTP status, response headers, data, and the connection is then ended:

HTTP/1.1 301 Moved Permanently
Date: Tue, 29 Jun 2021 03:49:00 GMT
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
Server: ATS
Cache-Control: no-store, no-cache
Content-Type: text/html
Content-Language: en
X-Frame-Options: SAMEORIGIN
Expect-CT: max-age=31536000, report-uri="http://csp.yahoo.com/beacon/csp?src=yahoocom-expect-ct-report-only"
Referrer-Policy: no-referrer-when-downgrade
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Location: https://www.yahoo.com/
Content-Length: 8

redirectclosed

port scan is a method for determining which ports on a network are open. As ports on a computer are the place where information is sent and received, port scanning is analogous to knocking on doors to see if someone is home. Running a port scan on a network or server reveals which ports are open and listening (receiving information), as well as revealing the presence of security devices such as firewalls that are present between the sender and the target. This technique is known as fingerprinting. It is also valuable for testing network security and the strength of the system’s firewall. Due to this functionality, it is also a popular reconnaissance tool for attackers seeking a weak point of access to break into a computer.

Ports vary in their services offered. They are numbered from 0 to 65535, but certain ranges are more frequently used. Ports 0 to 1023 are identified as the “well-known ports” or standard ports and have been assigned services by the Internet Assigned Numbers Authority (IANA). Some of the most prominent ports and their assigned services include:

  • Port 20 (udp) – File Transfer Protocol (FTP) for data transfer
  • Port 22 (tcp) – Secure Shell (SSH) protocol for secure logins, ftp, and port forwarding
  • Port 23 (tcp) – Telnet protocol for unencrypted text commutations
  • Port 53 (udp) – Domain Name System (DNS) translates names of all computers on internet to IP addresses
  • Port 80 (tcp) – World Wide Web HTTP

There are standard services offered on ports after 1023 as well, and ports that, if open, indicate an infected system due to its popularity with some far-reaching Trojans and viruses.

A port scan sends a carefully prepared packet to each destination port number. The basic techniques that port scanning software is capable of include:

  • Vanilla– the most basic scan; an attempt to connect to all 65,536 ports one at a time. A vanilla scan is a full connect scan, meaning it sends a SYN flag (request to connect) and upon receiving a SYN-ACK (acknowledgement of connection) response, sends back an ACK flag. This SYN, SYN-ACK, ACK exchange comprises a TCP handshake. Full connect scans are accurate, but very easily detected because full connections are always logged by firewalls.
  • SYN Scan– Also referred to as a half-open scan, it only sends a SYN, and waits for a SYN-ACK response from the target. If a response is received, the scanner never responds. Since the TCP connection was not completed, the system doesn’t log the interaction, but the sender has learned if the port is open or not.
  • XMAS and FIN Scans– an example of a suite of scans used to gather information without being logged by the target system. In a FIN scan, an unsolicited FIN flag (used normally to end an established session) will be sent to a port. The system’s response to this random flag can reveal the state of the port or insight about the firewall. For example, a closed port that receives an unsolicited FIN packet, will respond with a RST (an instantaneous abort) packet, but an open port will ignore it. An XMAS scan simply sends a set of all the flags, creating a nonsensical interaction. The system’s response by can be interpreted to better understand the system’s ports and firewall.
  • FTP Bounce Scan– allows for the sender’s location to be disguised by bouncing the packet through an FTP server. This is also designed for the sender to go undetected.
  • Sweep scan– pings the same port across a number of computers to identify which computers on the network are active. This does not reveal information about the port’s state, instead it tells the sender which systems on a network are active. Thus, it can be used as a preliminary scan.

Scans that are developed for the sender to go undetected by a receiving system’s log are known as stealth scans and are of particular interest to attackers. Despite its popularity in this area, port scanning is a valuable tool for fingerprinting a network and for a penetration tester to assess the strength of network security.

What port is typically used to accept administrative connections using the SSH?

SSH uses port 22 by default, but you can change this to a different port. To initiate an SSH connection to a remote system, you need the Internet Protocol (IP) address or hostname of the remote server and a valid username. You can connect using a password or a private and public key pair.

Which one of the following tools would be used for network discovery scans?

Nmap is a network discovery scanning tool that reports the open ports on a remote system and the firewall status of those ports.

What two techniques are commonly used by port and vulnerability scanners to perform?

Port scanning is commonly done during discovery to assess what services the target provides, and nmap is one of the most popular tools used for this purpose. Nessus and Nikto might be used during the vulnerability scanning phase.

Which of the following is not normally included in a security assessment?

Security assessments include many types of tests designed to identify vulnerabilities, and the assessment report normally includes recommendations for mitigation. The assessment does not, however, include actual mitigation of those vulnerabilities. You just studied 25 terms!