Subject Name: Computer Network
Module 2: Application layer
Faculty Name : Dr. Gautam Borkar
Anita Patil
Index
Lecture 5-Provinding servises and Application Paradigms 3
Lecture 6-Client server Paradigms 19
Lecture7:Standard clint srver application,FTP,HTTP,TEL NET 31
Lecture 8– SSH,DNS 67
2
Module 2: Application layer
Lecture 5-Provinding servises
and Application Paradigms
Application layer
The application layer provides services to the user. Communication is
provided using a logical connection, which means that the two application
layers assume that there is an imaginary direct connection through which
they can send and receive messages. Figure 2.1 shows the idea behind
this logical connection.
Lecture 1: History and development of computer network, network
4
Application
Figure 2.1: Logical connection at the application layer
Lecture 1: History and development of computer network, network
5
Application
2.1.1 Providing Services
The Internet was originally designed to provide service to users around the world.
Since the application layer is the only layer that provides services to the Internet
user, it allows new application protocols to be easily added to the Internet, which
has been occurring during the lifetime of the Internet. When the Internet was
created, only a few application protocols were available to the users; today we
cannot give a number for these protocols because new ones are being added
constantly.
Lecture 1: History and development of computer network, network
6
Application
Providing Services
Standard and Nonstandard Protocols:
Standard Application-Layer Protocols
Nonstandard Application-Layer Protocols
Lecture 1: History and development of computer network, network
7
Application
Application-Layer Paradigm
It should be clear that to use the Internet we need two application programs to
interact with each other: one running on a computer somewhere in the world, the
other running on another computer somewhere else in the world. The two
programs need to send messages to each other through the Internet infrastructure.
However, we have not discussed what the relationship should be between these
programs. Should both application programs be able to request services and
provide services, or should the application programs just do one or the other?
Lecture 1: History and development of computer network, network
8
Application
Application-Layer Paradigm (cont)
• Traditional Paradigm: Client-Server
• New Paradigm: Peer-to-Peer
• Mixed Paradigm
Lecture 1: History and development of computer network, network
9
Application
Figure 2.2: Example of a client-server paradigm
Lecture 1: History and development of computer network, network
10
Application
Figure 2.3: Example of a peer-to-peer paradigm
Lecture 1: History and development of computer network, network
11
Application
Thank You
Module 2: Application layer
Lecture No: 6
Client- Server Paradigm:
Application Programming Interface
2-2 CLIENT-SERVER PARADIGM
In this paradigm, communication at the application layer is between two
running application programs called processes: a client and a server. A
client is a running program that initializes the communication by sending a
request; a server is another application program that waits for a request
from a client
14 Lecture 2:Network software and hardware components
Application Programming Interface
A computer language has a set of instructions for mathematical operations, a set of
instructions for string manipulation, a set of instructions for input/ output access, and so on.
If we need a process to be able to communicate with another process, we need a new set of
instructions to tell the lowest four layers of the TCP/IP suite to open the connection, send
and receive data from the other end, and close the connection. A set of instructions of this
kind is normally referred to as Application Programming Interface (API).
.
15 Lecture 2:Network software and hardware components
• Sockets
• Socket Address
• Finding Socket Addresses
Server Site
Client Site
16 Lecture 2:Network software and hardware components
Figure 2.4: Position of the socket interface
17 Lecture 2:Network software and hardware components
Figure 2.5: A Sockets used like other
sources and sinks
18 Lecture 2:Network software and hardware components
Figure 2.6: Use of sockets in process-to-process communication
19 Lecture 2:Network software and hardware components
Figure 2.7: A socket address
20 Lecture 2:Network software and hardware components
2.2.2 Using Services of Transport Layer
A pair of processes provide services to the users of the Internet, human or
programs. A pair of processes, however, need to use the services provided by the
transport layer for communication because there is no physical communication at
the application layer. There are three common transport layer protocols in the
TCP/IP suite: UDP, TCP, and SCTP.
• UDP Protocol
• TCP Protocol
• SCTP Protocol
21 Lecture 2:Network software and hardware components
Thank You
Module 2: Application layer
Lecture 7- Standard Client Server
applications: World Wide Web
and HTTP, FTP
STANDARD CLIENT-SERVER APPLICATIONS
During the lifetime of the Internet, several application programs have been
developed. We do not have to redefine them, but we need to understand
what they do. For each application, we also need to know the options
available to us. The study of these applications can help us to create
customized applications in the future
24
2.3.1 World Wide Web and HTTP
In this section, we first introduce the World Wide Web (abbreviated WWW or
Web). We then discuss the Hyper Text Transfer Protocol (HTTP), the most
common client-server application program used in relation to the Web.
25
(continued)
• World Wide Web
Architecture
Uniform Resource Locator (URL)
Web Documents
• HyperText Transfer Protocol (HTTP)
Nonpersistent versus Persistent Connections
Message Formats
Conditional Request
Cookies
• Web Caching: Proxy Server
Proxy Server Location
Cache Update
• HTTP Security
26
Formats of the request and response messages
27
Table 2.1: Methods
28
Table 2.2: Request Header Names
29
Table 2.3: Response Header Names
30
2.3.2 FTP
File Transfer Protocol (FTP) is the standard protocol provided by TCP/IP for
copying a file from one host to another. Although transferring files from one
system to another seems simple and straightforward, some problems must be
dealt with first. For example, two systems may use different file name
conventions. Two systems may have different ways to represent data. All of
these problems have been solved by FTP in a very simple and elegant
approach.
31
(continued)
Lifetimes of Two Connections
Control Connection
Data Connection
Communication over Data Connection
File Transfer
• Security for FTP
32
FTP
33
Some FTP commands
34
Some responses in FTP
35
2.3.3 Electronic Mail
Electronic mail (or e-mail) allows users to exchange messages. The nature of
this application, however, is different from other applications discussed so
far. In an application such as HTTP or FTP, the server program is running
all the time, waiting for a request from a client. When the request arrives, the
server provides the service. In the case of electronic mail, the situation is
different.
36
Continued
First, e-mail is considered a one-way transaction. When Alice sends an e-mail to
Bob, she may expect a response, but this is not a mandate. Bob may or may not
respond. If he does respond, it is another one-way transaction. Second, it is
neither feasible nor logical for Bob to run a server program and wait until
someone sends an e-mail to him. Bob may turn off his computer when he is not
using it. This means that the idea of client/ server programming should be
implemented in another way: using some intermediate computers (servers).
37
(continued)
• Architecture
• User Agent
Sending Mail
Receiving Mail
Addresses
Mailing List or Group List
38
(continued)
MIME
MIME Headers
• Web-Based Mail
Case I
Case II
• E-Mail Security
39
Message Transfer Agent: SMTP
Commands and Responses
Mail Transfer Phases
• Message Access Agent: POP and IMAP
POP3
IMAP4
40
Common scenario
41
Format of an e-mail
42
E-mail address
43
Protocols used in electronic mail
44
SMTP Commands
45
SMTP responses
46
SMTP responses
47
TELNET
A server program can provide a specific service to its corresponding client
program. However, it is impossible to have a client/server pair for each
type of service we need. Another solution is to have a specific client/server
program for a set of common scenarios, but to have some generic
client/server programs that allow a user on the client site to log into the
computer at the server site and use the services available there. We refer
to these generic client/server pairs as remote logging applications. One of
the original remote logging protocols is TELNET.
48
(continued)
Local versus Remote Logging
Network Virtual Terminal (NVT)
Options
User Interface
49
Local versus remote logging
50
Concept of NVT
51
Examples of interface commands
52
Thank You
Module 2: Application layer
Lecture 8– Secure Shell (SSH),
Domain Name System (DNS)
Secure Shell (SSH)
Although Secure Shell (SSH) is a secure application program that can be used
today for several purposes such as remote logging and file transfer, it was originally
designed to replace TELNET. There are two versions of SSH: SSH-1 and SSH-2,
which are totally incompatible. The first version, SSH-1, is now deprecated because
of security flaws in it. In this section, we discuss only SSH-2
55
• Components
SSH Transport-Layer Protocol (SSH-TRANS)
SSH Authentication Protocol (SSH-AUTH)
SSH Connection Protocol (SSH-CONN)
• Applications
SSH for Remote Logging
SSH for File Transfer
• Port Forwarding
• Format of the SSH Packets
56
Components of SSH
57
Port Forwarding
58
SSH Packet Format
59
Domain Name System (DNS)
To identify an entity, TCP/IP protocols use the IP address, which uniquely identifies
the connection of a host to the Internet. However, people prefer to use names
instead of numeric addresses. Therefore, the Internet needs to have a directory
system that can map a name to an address. This is analogous to the telephone
network. A telephone network is designed to use telephone numbers, not names.
People can either keep a private file to map a name to the corresponding telephone
number or can call the telephone directory to do so.
60
• Name Space
Domain Name Space
Domain
Distribution of Name Space
Zone
Root Server
• DNS in the Internet
Generic Domains
Country Domains
61
Resolution
Recursive Resolution
iterative Resolution
Caching
• Resource Records
• DNS Messages
• Encapsulation
• Registrars
• DDNS
• Security of DNS
62
Purpose of DNS
63
Generic domains
64
Generic domain labels
65
Recursive resolution
66
Iterative resolution
67
DNS types
68
DNS message
69
Example
In UNIX and Windows, the nslookup utility can be used to retrieve address/name mapping.
The following shows how we can retrieve an address when the domain name is given.
70
Module 2: Application Layer
Lecture 9-Compression: Lossless
Compression, Lossy Compression
COMPRESSION
In this section, we discuss compression, which plays a crucial role in
multimedia communication due to the large volume of data exchanged. In
compression, we reduce the volume of data to be exchanged. We can
divide compression into two broad categories: lossless and lossy
compression. We briefly discuss the common methods used in each
category.
Lecture 1: History and development of computer network, network
72
Application
Lossless Compression
In lossless compression, the integrity of the data is preserved because the
compression and decompression algorithms are exact inverses of each other: no
part of the data is lost in the process. Lossless compression methods are normally
used when we cannot afford to lose any data. For example, we must not lose data
when we compress a text file or an application program. Lossless compression is
also applied as the last step in some lossy compression procedures to further
reduce the size of the data.
Lecture 1: History and development of computer network, network
73
Application
(continued)
• Run-length Coding
• Dictionary Coding
Encoding
Decoding
• Huffman Coding
Huffman Tree
Coding Table
Encoding and Decoding
• Arithmetic Coding
Encoding
Decoding
Static versus Dynamic Arithmetic Coding
Lecture 1: History and development of computer network, network
74
Application
A version of run-length coding to compress binary patterns
Lecture 1: History and development of computer network, network
75
Application
LZW encoding
Lecture 1: History and development of computer network, network
76
Application
Huffman tree
Lecture 1: History and development of computer network, network
77
Application
Coding Table
Lecture 1: History and development of computer network, network
78
Application
: Encoding and decoding in Huffman coding
Lecture 1: History and development of computer network, network
79
Application
Arithmetic coding
Lecture 1: History and development of computer network, network
80
Application
Unit No: 2 Unit Name:Application Layer
Lecture 10– Issues and
vulnerabilities
Vulnerabilities in the Application Layer
• File Transfer Protocol (FTP)
• Telnet
• Secure Shell (SSH)
• Simple Mail Transfer Protocol (SMTP)
• Domain Name System (DNS)
• Dynamic Host Configuration Protocol (DHCP)
• Hypertext Transfer Protocol (HTTP)
82 Lecture 4– Design issues for the layers, Reference models : OSI,
TCP/IP
Cross Site Scripting (XSS)
The scripts can be JavaScript, VBScript, ActiveX, and
HTML, or even Flash (ActiveX), which will be executed
on the victim’s system. These scripts will be masked as
legitimate requests between the web server and the
client’s browser.
• XSS focuses on the following:
• Redirecting a victim to a malicious website/server
• Using hidden Iframes and pop-up messages on the
victim’s browser
• Data manipulation
• Data theft
• Session hijacking
83 Lecture 2
84 Lecture 2
Types of XSS attacks:
• Stored XSS (persistent):
– In this attack, the attacker injects a malicious script directly into
the web application or a website. The script is stored permanently
on the page, so when a potential victim visits the compromised
page, the victim’s web browser will parse all the code of the web
page/application fine.
• Reflected (non-persistent):
– In this attack, the attacker usually sends an email with the
malicious link to the victim. When the victim clicks the link, it is
opened in the victim’s web browser (reflected), and at this point,
the malicious script is invoked and begins to retrieve the loot
(passwords, credit card numbers, and so on) stored in the victim’s
web browser.
85 Lecture 2
SQL injection (SQLi)
SQLi attacks focus on parsing SQL commands into an
SQL database that does not validate the user input. The
attacker attempts to gain unauthorized access to a
database either by creating or retrieving information
stored in the database application
SQLi can be used to perform:
• Authentication bypass: Allows the attacker to log in to
a system without a valid user credential
• Information disclosure: Retrieves confidential
information from the database
• Compromise data integrity: The attacker is able to
manipulate information stored in the database
86 Lecture 2
Lightweight Directory Access Protocol (LDAP)
injection
•LDAP is designed to query and update directory services,
such as a database like Microsoft Active Directory.
•LDAP uses both TCP and UDP port 389 and LDAP uses
port 636.
•In an LDAP injection attack, the attacker exploits the
vulnerabilities within a web application that constructs
LDAP messages or statements, which are based on the
user input.
•If the receiving application does not validate or sanitize
the user input, this increases the possibility of
manipulating LDAP messages.
87 Lecture 2
Cross-Site Request Forgery (CSRF)
• In a CSRF attack, the victim machine/browser
is forced to execute malicious actions against a
website with which the victim has been
authenticated (a website that trusts the actions
of the user).
88 Lecture 2
Session hijacking
• Cookies are used to track the user’s
preferences and manage the session while the
user is on the site. While the user is on the
website, a session ID is also set within the
cookie, and this information may be persistent,
which allows a user to close the web browser
and then later revisit the same website and
automatically log in.
89 Lecture 2
Cookie poisoning
• Cookie poisoning is when an
attacker has modified a victim’s
cookie, which will then be used to
gain confidential information about
the victim such as his/her identity.
90 Lecture 2
DNS
• Distributed Denial-of-Service (DDoS)
• Typosquatting
• Registrar hijacking
– If a hacker modifies the A record on a domain to redirect all
traffic to a compromised or malicious server, anyone who visits
the compromised domain will be redirected to the malicious
website.
• Cache poisoning
– The resolved data is stored within the local system in a cache
area. The attacker can compromise this temporary storage area
and manipulate any further resolution done by the local system.
•
91 Lecture 2
Thank You