Monday 23 May 2016

What is the main difference between a “Normal” SQL Injection and a “Blind” SQL Injection vulnerability?

What is the main difference between a “Normal” SQL Injection and a “Blind” SQL Injection
vulnerability?
A.
The request to the web server is not visible to the administrator of the vulnerable application.
B.
The attack is called “Blind” because, although the application properly filters user input, it is still
vulnerable to code injection.
C.
The successful attack does not show an error message to the administrator of the affected
application.
D.
The vulnerable application does not display errors with information about the injection results to
the attacker.

Tuesday 10 May 2016

What is the difference between UDP and TCP internet protocols?

There are two types of Internet Protocol (IP) traffic. They are TCP orTransmission Control Protocol and UDP or User Datagram Protocol. TCP is connection oriented – once a connection is established, data can be sent bidirectional. UDP is a simpler, connectionless Internet protocol. Multiple messages are sent as packets in chunks using UDP.

Comparison chart



UDP
Acronym forTransmission Control ProtocolUser Datagram Protocol or Universal Datagram Protocol
ConnectionTCP is a connection-oriented protocol.UDP is a connectionless protocol.
FunctionAs a message makes its way across the internet from one computer to another. This is connection based.UDP is also a protocol used in message transport or transfer. This is not connection based which means that one program can send a load of packets to another and that would be the end of the relationship.
UsageTCP is suited for applications that require high reliability, and transmission time is relatively less critical.UDP is suitable for applications that need fast, efficient transmission, such as games. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients.
Use by other protocolsHTTP, HTTPs, FTP, SMTP, TelnetDNS, DHCP, TFTP, SNMP, RIP, VOIP.
Ordering of data packetsTCP rearranges data packets in the order specified.UDP has no inherent order as all packets are independent of each other. If ordering is required, it has to be managed by the application layer.
Speed of transferThe speed for TCP is slower than UDP.UDP is faster because there is no error-checking for packets.
ReliabilityThere is absolute guarantee that the data transferred remains intact and arrives in the same order in which it was sent.There is no guarantee that the messages or packets sent would reach at all.
Header SizeTCP header size is 20 bytesUDP Header size is 8 bytes.
Common Header FieldsSource port, Destination port, Check SumSource port, Destination port, Check Sum
Streaming of dataData is read as a byte stream, no distinguishing indications are transmitted to signal message (segment) boundaries.Packets are sent individually and are checked for integrity only if they arrive. Packets have definite boundaries which are honored upon receipt, meaning a read operation at the receiver socket will yield an entire message as it was originally sent.
WeightTCP is heavy-weight. TCP requires three packets to set up a socket connection, before any user data can be sent. TCP handles reliability and congestion control.UDP is lightweight. There is no ordering of messages, no tracking connections, etc. It is a small transport layer designed on top of IP.
Data Flow ControlTCP does Flow Control. TCP requires three packets to set up a socket connection, before any user data can be sent. TCP handles reliability and congestion control.UDP does not have an option for flow control
Error CheckingTCP does error checkingUDP does error checking, but no recovery options.
Fields1. Sequence Number, 2. AcK number, 3. Data offset, 4. Reserved, 5. Control bit, 6. Window, 7. Urgent Pointer 8. Options, 9. Padding, 10. Check Sum, 11. Source port, 12. Destination port1. Length, 2. Source port, 3. Destination port, 4. Check Sum
AcknowledgementAcknowledgement segmentsNo Acknowledgment
HandshakeSYN, SYN-ACK, ACKNo handshake (connectionless protocol)

Differences in Data Transfer Features

TCP ensures a reliable and ordered delivery of a stream of bytes from user to server or vice versa. UDP is not dedicated to end to end connections and communication does not check readiness of receiver.

Reliability

TCP is more reliable since it manages message acknowledgment and retransmissions in case of lost parts. Thus there is absolutely no missing data. UDP does not ensure that communication has reached receiver since concepts of acknowledgment, time out and retransmission are not present.

Ordering

TCP transmissions are sent in a sequence and they are received in the same sequence. In the event of data segments arriving in wrong order, TCP reorders and delivers application. In the case of UDP, sent message sequence may not be maintained when it reaches receiving application. There is absolutely no way of predicting the order in which message will be received.

Connection

TCP is a heavy weight connection requiring three packets for a socket connection and handles congestion control and reliability. UDP is a lightweight transport layer designed atop an IP. There are no tracking connections or ordering of messages.

Method of transfer

TCP reads data as a byte stream and message is transmitted to segment boundaries.UDP messages are packets which are sent individually and on arrival are checked for their integrity. Packets have defined boundaries while data stream has none.

How TCP and UDP work

A TCP connection is established via a three way handshake, which is a process of initiating and acknowledging a connection. Once the connection is established data transfer can begin. After transmission, the connection is terminated by closing of all established virtual circuits.
UDP uses a simple transmission model without implicit hand-shaking dialogues for guaranteeing reliability, ordering, or data integrity. Thus, UDP provides an unreliable service and datagrams may arrive out of order, appear duplicated, or go missing without notice. UDP assumes that error checking and correction is either not necessary or performed in the application, avoiding the overhead of such processing at the network interface level. Unlike TCP, UDP is compatible with packet broadcasts (sending to all on local network) and multicasting (send to all subscribers).

Different Applications of TCP and UDP

Web browsing, email and file transfer are common applications that make use of TCP. TCP is used to control segment size, rate of data exchange, flow control and network congestion. TCP is preferred where error correction facilities are required at network interface level. UDP is largely used by time sensitive applications as well as by servers that answer small queries from huge number of clients. UDP is compatible with packet broadcast - sending to all on a network and multicasting – sending to all subscribers. UDP is commonly used in Domain Name System, Voice over IP, Trivial File Transfer Protocol and online games.

TCP vs. UDP for Game Servers

For massively multiplayer online (MMO) games, developers often have to make an architectural choice between using UDP or TCP persistent connections. The advantages of TCP are persistent connections, reliability, and being able to use packets of arbitrary sizes. The biggest problem with TCP in this scenario is its congestion control algorithm, which treats packet loss as a sign of bandwidth limitations and automatically throttles the sending of packets. On 3G or Wi-Fi networks, this can cause a significant latency.
Experienced developer Christoffer Lernö weighed the pros and cons and recommends the following criteria to choose whether to use TCP or UDP for your game:
  • Use HTTP over TCP for making occasional, client-initiated stateless queries when it's OK to have an occasional delay.
  • Use persistent plain TCP sockets if both client and server independently send packets but an occasional delay is OK (e.g. Online Poker, many MMOs).
  • Use UDP if both client and server may independently send packets and occasional lag is not OK (e.g. Most multiplayer action games, some MMOs).

Monday 2 May 2016

Difference between XSS and CSRF

Key Difference: XSS and CSRF are two types of computer security vulnerabilities. XSS stands for Cross-Site Scripting. CSRF stands for Cross-Site Request Forgery. In XSS, the hacker takes advantage of the trust that a user has for a certain website. On the other hand, in CSRF the hacker takes advantage of a website’s trust for a certain user’s browser.
XSS stands for Cross-Site Scripting. Cross Site Scripting is a security exploit in which a malicious hacker inserts scripts into a dynamic form. It is now being considered as the most common security vulnerability that is found in websites. In XSS, a hacker injects a malicious client-side script into a website. This script is added to cause some form of vulnerability to a victim.
Attackers or hackers use JavaScript, VBScript, ActiveX, HTML or Flash for this purpose. Once the attack is successful, the hacker can cause harm in many ways. For example, the attacker may hijack the account or even change the user’s settings. A common example of XSS can be seen where a malicious link is used for that purpose. A link containing a hidden malicious code is created, and the user is asked to click on it. If the user clicks it, the malicious code gets executed on the client’s web browser.
Cross-site scripting attacks can be broadly divided into two types-
  • Persistent – In this type of vulnerability, the malicious data is stored permanently on a database and is later accessed and run by the victims without having any knowledge of it.
  • Non-persistent – In this type of vulnerability, the data provided by the malicious hacker is used at that particular instance without any delay.
CSRF stands for Cross-Site Request Forgery. It is also known as one-click attack or session riding. It takes advantage of the targeted website’s trust on a user. A malicious attack is designed in such a way that a user sends malicious requests to the target website without having the knowledge of the attack. A number of tasks can be performed by an attacker making use of CSRF, for example, some content can be posted to a message board, stocks can be traded and even an e-card can be mailed. One of the most common ways to carry out a CSRF attack is to use a HTML image tag or a JavaScript image object.
This kind of vulnerability is not only limited to browsers. The malicious scripting can also be done through a word document, Flash file, movie, etc. Some of the important features of CSRF include –
  • It is not mandatory for the victim to be logged in as it depends upon the intention of the attacker.
  • Multiple requests can be generated by the attacker to the target site.
  • It works extremely well with other types of attacks.
  • Generally, the data from the attacked site cannot be read by the attacker and this serves as a limitation for CSRF.
Comparison between XSS and CSRF:

XSS
CSRF
Full Form
Cross-Site Scripting
Cross-Site Request Forgery
Definition
In XSS, a hacker injects a malicious client side script in a website. This script is added to cause some form of vulnerability to a victim.
It takes advantage of the targeted website’s trust in a user. A malicious attack is designed in such a way that a user sends malicious requests to the target website without having knowledge of the attack.
Dependency
Injection of arbitrary data by data that is not validated
On the functionality and features of the browser to retrieve and execute the attack bundle
Requirement of JavaScript
Yes
No
Condition
Acceptance of the malicious code by the sites
Malicious code is located on third party sites
Vulnerability
A site that is vulnerable to XSS attacks is also vulnerable to CSRF attacks
A site that is completely protected from XSS types of attacks is still most likely vulnerable to CSRF attacks.