Web Security
Web Security
Web security refers to networks, computer system and data are protected from
unauthorized person or group.
The purpose of web security is to prevent security attack like Passive attack and Active
Attack. Web security maintains the smooth operation of any business that uses
computers and prevents hackers and malware from manipulating your systems,
software, or network.
Keep your software & plugins up to date: If your website's s/w or applications are
not up-to-date, your site is not secure. Updates are vital to the health and security of
your website. Take all software and plugins update request seriously. Also use https
and SSL Certificate to secure your website
Password cracking tools: Password cracking tools help restore lost password,
whether you have forgotten a password of your password has been hacked, a password
Cracking tools can help you recover it.
Use of Antivirus: Antivirus software helps protect your computer against malwares
and other incoming threats. Antivirus software looks at data - like webpage, files,
software applications – which are travelling over the network to your device. It
searches for known threats and monitors the behaviour of all programs and flagging
suspicious behaviour.
Web security threats are vulnerabilities within website and applications or attacks
launched by malicious users. Web security threats are designed to breach security of
website or applications. Web security threats involve malicious people and
organizations, as well as the tools they use to leverage the internet in an attempt to
infiltrate your network or devices. The most common security threats are malware,
phishing, denial of services, SQL injection, stolen data.
Phishing: Phishing attack targeting users through email, text message or social media
messaging sites. Attackers impersonate of real user or website, users can trust that link
and click on given link and provide sensitive information like account number,
credit/debit card data and login credentials. User Can lost their money, sensitive
information etc.....
SQL Injection: SQL stands for structured query language. SQL is used to search and
query database. SQL Injection is a website security threats. SQL injection is the
placement of malicious code in SQL statement, via webpage input. Using SQL injection
hacker can retrieve credential and some sensitive information.
Figure illustrates that one way to provide Web security is to use IP security (IPsec).
The advantage of using IPsec is that it is transparent to end users and applications and provides a
general- purpose solution.
Furthermore, IPsec includes a filtering capability so that only selected traffic need incur the overhead of
IPsec processing.
Another relatively general-purpose solution is to implement security just above TCP.
The foremost example of this approach is the Secure Sockets Layer (SSL) and the follow-on Internet
standard known as Transport Layer Security (TLS).
At this level, there are two implementation choices.
For full generality, SSL (or TLS) could be provided as part of the underlying protocol suite and therefore
be transparent to applications.
Alternatively, SSL can be embedded in specific packages.
For example, Netscape and Microsoft Explorer browsers come equipped with SSL, and most Web servers
have implemented the protocol.
Application-specific security services are embedded within the particular application.
Figure shows examples of this architecture.
The advantage of this approach is that the service can be tailored to the specific needs of a given
application.
SSL Protocol
SSL protocol is implemented just above the TCP to provide web security.
SSL is designed to make use of TCP to provide a reliable end-to-end secure service.
SSL is not a single protocol but two layers of protocols.
The SSL Record Protocol provides basic security services to various higher layer protocols.
SSL Protocol stack
|| = concatenation,
SSLCompressed.fragment = the compressed fragment or plain text (if compression is not used) }
o Encryption: The compressed message plus the MAC are encrypted using symmetric encryption.
Algorithms supported are AES, RC4-40, IDEA, RC2, DES, 3DES and Fortezza.
o Add SSL Header: A header is prepared and added to the message. The header consists of the
following fields:
Content Type (8 bits): The higher-layer protocol used to process the fragment.
Major Version (8 bits): Indicates major version of SSL in use. For SSLv3, the value is 3.
Minor Version (8 bits): Indicates minor version in use. For SSLv3, the value is 0.
Compressed Length (16 bits): The length in bytes of the fragment.
This protocol consists of a single message of a single byte with the value 1.
Change cipher spec protocol
The purpose of this message is to cause the pending state to be copied into the current state, which
updates the cipher suite to be used on this connection.
Alert Protocol
The Alert Protocol is used to convey SSL-related alerts to the peer entity.
Each message in this protocol consists of two bytes:
o The first byte takes the value warning (1) or fatal (2) to convey the severity of the message.
o The second byte contains a code that indicates the specific alert.
Alert protocol
If the level is fatal, SSL immediately terminates the connection. Other connections on the same session
may continue, but no new connections are established.
Some of the alerts of fatal types are unexpected_message, bad_record_mac, decompression_failure etc.
Alerts of level warning include close_notify, no_certificate, bad_certificate etc.
Handshake Protocol
This protocol allows the server and client to authenticate each other and to negotiate an encryption and
MAC algorithm and cryptographic keys.
The Handshake Protocol is used before any application data is transmitted.
A handshake message has the following format:
o Type (1 byte): Indicates one of 10 messages of handshake protocol.
o Length (3 bytes): The length of the message in bytes.
o Content ( bytes): The parameters associated with this message.
Handshake protocol
At this point, the handshake is complete and the client and server may begin to exchange application-
layer data.
Handshake protocol message exchange
Cryptographic Computations
Version Number
The one difference is in version values. For the current version of TLS, the major version is 3 and the
minor version is 3.
Pseudorandom Function
TLS makes use of a pseudorandom function referred to as PRF to expand secrets into blocks of data for
purposes of key generation or validation.
The objective is to make use of a relatively small shared secret value but to generate longer blocks of
data in a way that is secure from the kinds of attacks made on hash functions and MACs.
The PRF is based on the data expansion function (Figure) given as
P_hash(secret, seed)= HMAC_hash(secret,A(1) || seed) ||
HMAC_hash(secret, A(2) || seed) || HMAC_hash(secret, A(3) || seed)
||... where A() is defined as
A(0) = seed
A(i) = HMAC_hash(secret,A(i – 1))
PRF is defined as
PRF(secret, label, seed) = P_hash(S1,label || seed)
PRF takes as input a secret value, an identifying label, and a seed value and produces an output of
arbitrary length.
Alert Codes
TLS supports all of the alert codes defined in SSLv3 with the exception of no_certificate.
A number of additional codes are defined in TLS; of these, the following are always fatal.
o record_overflow
o unknown_ca
o access_denied
o decode_error
o protocol_version
o insufficient_security
o unsupported_extension
o internal_error
o decrypt_error
o The remaining alerts include the following.
o user_canceled
o no_renegotiation
Cipher Suites
There are several small differences between the cipher suites available under SSLv3 and under TLS:
Key Exchange: TLS supports all of the key exchange techniques of SSLv3 with the exception of Fortezza.
Symmetric Encryption Algorithms: TLS includes all of the symmetric encryption algorithms found in
SSLv3, with the exception of Fortezza.
Cryptographic Computations
The pre_master_secret for TLS is calculated in the same way as in SSLv3.
As in SSLv3, the master_secret in TLS is calculated as a hash function of the pre_master_secret
and the two hello random numbers.
The form of the TLS calculation is different from that of SSLv3 and is defined as
master_secret=PRF(pre_master_secret,"master secret",ClientHello.random
||ServerHello.random)
The algorithm is performed until 48 bytes of pseudorandom output are produced.
The calculation of the key block material (MAC secret keys, session encryption keys, and IVs) is defined
as key_block = PRF(master_secret,"key expansion", SecurityParameters.
server_random || SecurityParameters.client_random)
As with SSLv3, the key_block is a function of the master_secret and the client and server
random numbers, but for TLS, the actual algorithm is different.
Padding
In SSL, the padding added prior to encryption of user data is the minimum amount required so that the
total size of the data to be encrypted is a multiple of the cipher’s block length.
In TLS, the padding can be any amount that results in a total that is a multiple of the cipher’s block length,
up to a maximum of 255 bytes.
A variable padding length may be used to frustrate attacks based on an analysis of the lengths of
exchanged messages.
HTTPS
HTTPS (HTTP over SSL) refers to the combination of HTTP and SSL to implement secure communication
between a Web browser and a Web server.
The HTTPS capability is built into all modern Web browsers. Its use depends on the Web server
supporting HTTPS communication.
For example, search engines do not support HTTPS.
The principal difference seen by a user of a Web browser is that URL (uniform resource locator)
addresses begin with https:// rather than http://.
A normal HTTP connection uses port 80. If HTTPS is specified, port 443 is used, which invokes SSL.
When HTTPS is used, the following elements of the communication are encrypted:
o URL of the requested document
o Contents of the document
o Contents of browser forms (filled in by browser user)
o Cookies sent from browser to server and from server to browser
o Contents of HTTP header
There is no fundamental change in using HTTP over either SSL or TLS, and both implementations are
referred to as HTTPS.
Connection Initiation
The client initiates a connection to the server on the appropriate port and then sends the TLS ClientHello
to begin the TLS handshake.
When the TLS handshake has finished, the client may then initiate the first HTTP request.
All HTTP data is to be sent as TLS application data.
Normal HTTP behavior, including retained connections, should be followed.
We need to be clear that there are three levels of awareness of a connection in HTTPS.
o At the HTTP level
o At the level of TLS
o At the level of TCP
Connection Closure
An HTTP client or server can indicate the closing of a connection by including the following line in an
HTTP record: Connection: close.
This indicates that the connection will be closed after this record is delivered.
At the TLS level, the proper way to close a connection is for each side to use the TLS alert protocol to
send a close_notify alert.
TLS implementations must initiate an exchange of closure alerts before closing a connection.
A TLS implementation may, after sending a closure alert, close the connection without waiting for the peer
to send its closure alert, generating an “incomplete close”.
Note that an implementation that does this may choose to reuse the session.
This should only be done when the application knows (typically through detecting HTTP message
boundaries) that it has received all the message data that it cares about.
HTTP clients also must be able to cope with a situation in which the underlying TCP connection is
terminated without a prior close_notify alert and without a Connection: close indicator.
Such a situation could be due to a programming error on the server or a communication error that
causes the TCP connection to drop.
However, the unannounced TCP closure could be evidence of some sort of attack.
So the HTTPS client should issue some sort of security warning when this occurs.