Tuesday, May 3, 2016

How “traceroute” use to identify network troubles

TRACEROUTE Command

Usually, information sent from one computer to another across the network, it does not reach the destination computer in one single jump. In fact, it usually requires several hops or routers to transmit the information. A “traceroute” is a utility program that identifies each router on that way, and the amount of time it takes to get from one computer to another. If there is an interruption in the transfer of data, the “traceroute” will show where in the chain the problem occurred.

On UNIX and Linux computers, the "traceroute" application is available in the shell, while on Windows computers, the "tracert" program can be accessed from DOS(usually command prompt in today).

How Trace route Works


The traceroute command is used to discover the routes that packets actually take when traveling to their destination. Each router along the path is required to decrements the TTL on a packet by at least 1 before forwarding it, so the TTL is effectively a hop count.

If a router finds a TTL value of 1 or 0, it drops the datagram (default send three UDP by router or PC) and sends back an Internet Control Message Protocol (ICMP) Time-Exceeded message to the sender. Traceroute determines the IP address of the first hop by examining the source address field of the ICMP Time-Exceeded message.

To identify the next hop, traceroute sends another three UDP message with a TTL value of 2. The first router decrement the TTL field by 1 and sends the datagram to the next router. The second router sees a TTL value of 1, discards the datagram, and returns the Time-Exceeded message to the source. This process continues until the TTL is incremented to a value large enough for the datagram to reach the destination host or until the maximum TTL is reached or the destination host replies with an ICMP Echo Reply.

Running a traceroute

UNIX systems, Mac OS X, and Windows 95 and later On a Unix system, including Mac OS X, run a
traceroute at the command line like this:

traceroute server.name
Windows, the tracert command type command prompt like this:
tracert server.name


The Traceroute command can be used to help you understand your network infrastructure and troubleshoot network problems. The most common use of the Trace command is to identify where on the network a packet has been dropped on its way to its intended destination. This is very helpful when dealing with a larger network or networks in which there are a several intermediate systems between the source and destination device.
For example, if we can usually reach an Internet site but it is slow today, then a traceroute to that site should show you one or more hops with either long times or marked with "*" indicating the time was really long.
See the below Microsoft command prompt screenshot..

The format of each line is as follows:

Hop RTT1 RTT2 RTT3 Domain Name [IP Address]

  • Hops: are the amount of connections in-between the source and destination. There are 12 hops to my PC (walakulu) to destination.
  • RTT1, RTT2, RTT3: This is the round-trip time that it takes for a packet to get to a hop and back to your computer (in milliseconds). This is often referred to as latency .Traceroute sends three packets to each hop and displays each time.



We can use to RRT for find the network lettency. Smaller numbers in RTT generally mean better connections.

If traceroute output indicate, a large “jump” in latency from one hop to the next, that could indicate a problem. It could be a saturated (overused) network link; a slow network link; an overloaded router; or some other problem at that hop.

  • Domain Name [IP Address]: The domain name, if available, can often help to see the location of a router. If this isn’t available, only the IP address of the router is displayed.

In hear “destination net unreachable” massage display last line because of the(Find yourself......you can search on web)
  • If an asterisk (*) appears for RTT, then a packet was not returned within the expected time frame.
  1. 1.     One or two asterisks for a hop do not necessarily indicate packet loss at the final destination. Many Internet routers intentionally discard traceroute packets, this used to prevent routers from being impacted by denial-of-service attacks.
  1. 2.      Three asterisks followed by the “Request timed out” message may appear for several reasons. 

Asterisks position
Why happened this ?

At the Beginning of a traceroute
Device that doesn’t respond to ICMP or traceroute requests (this is very common situation).
See the 1st hope in above screenshot.



At the End of a traceroute

1.      The destination’s firewall or other security device is blocking the request(or source device security, when return route)

2.      There may be a connection problem at that particular system or the next system.

See the 10-11 hops in above screenshot.

Sunday, April 24, 2016

Authentication AND Authorization




Code security protects the normal, day-to-day operations of an app, tool, or daemon. But what happens when your code is under siege? It is often essential to know not only what the user is doing but also who the user is and whether the user is allowed to do that. This is where authentication and authorization come into play. In simply Authentication verifies who you are Authorization verifies what you are authorized to do.

When we aimed to the area of user authentication then we can identify that there are three types of user authentication types. They can be named as;
  • 1.       What-you-know.
  • 2.       What-you-have.
  • 3.       What-you-are.

What-you-know
The idea here is “what you know” a secret --- often called a password --- that nobody else does. Thus, knowledge of a secret distinguishes you from all other individuals. And the authentication system simply needs to check to see if the person claiming to be you knows the secret. Otherwise, once that information falls into the wrong hands, a "game over.
Passwords are the original and most widely used authentication technique, but also the easiest to crack. Even if a password is not trivial to guess, it might succumb to an offline search of the password space. An offline search needs some way to check a guess without using the system itself, and some methods used today for storing passwords do provide such a way.
When passwords are used for authenticating a user, the system must have a way to check whether the password entered is valid. Simply storing a file with the list of usernames and associated passwords, however, is a bad idea because if the confidentiality of this file were ever compromised all would be lost. (Similarly, backup copies of this file would have to be afforded the same level of protection, since people rarely ever change their passwords.) Better not to store actual passwords on-line. So instead we might compute a cryptographic hash of the password, and store that. Now, the user enters a password; the system computes a hash of that password; and the system then compares that hash with what has been stored in the password file.


Even when password hashes instead of actual passwords are what is being stored, the integrity of this file of hashes must still be protected. Otherwise an attacker could insert a different hash (for a password the attacker knows) and log into the system using that new password.
The problem with having a password file that is not confidential -even if cryptographic hashes are what is being stored -is the possibility of offline dictionary attacks. Here, the attacker computes the hash of every word in some dictionary and then compares each hash with the stored password hashes. If any match, the attacker has learned a password.

What-you-have
The next level of protection validates users based on things in their possession, physical or otherwise. This can sometimes take the form of USB drives or smartphones.
In the case of mobile device usage, one-time passwords can be an effective solution. One-Time Password (OTP) Authentication products generate highly secure one-time passwords ensuring that only properly authenticated users are authorized access to critical applications and data.
OTP solutions first took the form of code generators and plug-in tokens that authenticated users with random codes on top of their personal passwords. But this method has taken a new step thanks to text messaging and mobile applications. OTP’s can be sent to smartphones and tablets upon the successful input of user-generated alphanumeric, meaning that even if passwords are obtained by malicious parties, there is still little that can be done with them without the user's personal device. This is why credential delivery is much more viable and secure than singular passwords. For example see the following figure what we met when we log in to Gmail.


A similar means of protection takes the form of public key cryptography. It is also one of the strongest methods of password security. For PKCs to work, a digital certificate is issued to users by verified third-party certificate authorities. These certificate authorities manage public key infrastructures, where those wishing to log in to a specific service must match private keys - stored in physical hardware tokens - with the public certifications they correspond with.


What-you-are
Since people forget things and lose things, one might contemplate basing an authentication scheme for humans on something that a person is. Therefor the third type of user authentication uses biometrics and is termed what you are. It is common to find user authentication systems that combine above approaches. For example, your bank ATM card (something you have) and the PIN number (something you know) is one such combination.
Authentication based on "what you are" will employ behavioral and physiological characteristics of the principal. These characteristics must be easily measured accurately and preferably are things that are difficult to spoof. For example, we might use
  • Retinal scan
  • Fingerprint reader
  • Handprint reader
  • Voice print
  • Keystroke timing
  • Signature...etc.
To implement such a biometric authentication scheme some representation for the characteristic of interest is stored. Subsequently, when authenticating that person, the characteristic is measured and compared with what has been stored. An exact match is not expected, nor should it be because of error rates associated with biometric sensors.


Physical Security in IT systems

Physical Security in IT systems

Physical security is the term used to describe protection needed outside the computer system. Typical physical security controls include guards, locks, and fences to deter direct attacks, floods and Power outages etc.. are the part of physical security.

IT systems of an organization is focus on fulfill its tasks, correctly and uninterrupted functioning. The term physical security of IT systems is used to refer to security issues related to computer systems, computer networks, communication systems, electrical power systems, buildings and also issues that related to people who operate, maintain and manage of a particular organization.
Depending on the organization physical security will vary. A government agency such as the Department of Defense may have armed guards at the door of the building. Many organizations are not in the position of breaching national security so armed guards are not a necessity. But in order to providing security in different approaches and understanding of the physical security of IT system, that can be categorized in to three main security control areas called,

 The physical facility in which the IT systems are installed and operated.


IT systems that can be installed statically (building or collection of buildings), portably (installed in a place that seems to be statics, but can be move if we wants. It systems in a large container is example for this kind) or mobility (installed in a vehicle).

According to the installed structure the level of physical threats to the system may be vary. In this area focus on fire in the building, roof leaks in networking room, unauthorized accesses of the system, water pump leak in the building etc.

 The physical location at which the IT systems are installed and operated.

Location of IT system installed is vary according to the IT system installed type(that mean static, portable or mobile).If system is static, that is situated in a fixed geographic location, If system is portable that there may be predefine list of places that the system could be move. If there is mobile installation, that it does not have fixed geographic location.

Threat
Example



Natural threats
Flooding, fire, tornado, Tsunami, volcano, storms, earthquakes etc.
(Although not natural disasters, building collapse, explosion, and damage from falling objects can be considered in the same category. These kinds of catastrophes are difficult to predict or estimate)

Man-made threats
sabotage, burglary, civil war, Interception of Sensitive Information etc.
Damages to the system due to nearby activities
Explosion, electromagnetic interference etc.


     The supporting facilities and services required and used by the IT systems.

In this category that can be identified two areas (facilities and services).They are
1.       Human supporting services.
2.       Technical supporting facilities.
System operations usually depends on electric power, telecommunication, air condition of that geographical area etc. If these facilities not enough good, that will cause a physical damage to the system hardware or system data.

Database Locks , Concurrency control and Database Security in a Bank


States of Transactions

A transaction in a database can be in one of the following states ,
·        
Active − in this state, the transaction is being executed. This is the initial state of every transaction.
·         Partially Committed − When a transaction executes its final operation, it is said to be in a partially committed state.
·         Failed − A transaction is said to be in a failed state if any of the checks made by the database recovery system fails. A failed transaction can no longer proceed further.
·         Aborted − If any of the checks fails and the transaction has reached a failed state, then the recovery manager rolls back all its write operations on the database to bring the database back to its original state where it was prior to the execution of the transaction.
·         Committed − If a transaction executes all its operations successfully, it is said to be committed. All its effects are now permanently established on the database system.


Issues and solutions of Database Transactions


Concurrency control


Concurrency Control Protocols are mechanisms to control concurrency of transactions to ensure isolation of transactions. Concurrency control is a database management systems (DBMS) concept that is used to address conflicts with the simultaneous accessing or altering of data that can occur with a multi-user system. Concurrency control, when applied to a DBMS, is meant to coordinate simultaneous transactions while preserving data integrity. The Concurrency is about to control the multi-user access of Database.

Example: Concurrency control
  1. When teller #1 starts working on an account, a lock is placed on the account.
  2. When teller #2 tries to read or update an account while teller #1 is updating an account, teller #2 will not be given access and gets an error message.
  3. After teller #1 has finished the update, teller #2 can proceed.
  4. At the end of the day, your account has Rs.1,100 (Rs.1000 - 200 + 300).

Lock based

A lock is nothing but a mechanism that tells the DBMS whether a particular data item is being used by any transaction for read/write purpose. Since there are two types of operations, i.e. read and write, whose basic nature are different, the locks for read and write operation may behave differently. Locking is necessary in a concurrent environment to assure that one process does not retrieve or update a record that is being updated by another process. Failure to use some controls (locking), would result in inconsistent and corrupt data.

Read operation performed by different transactions on the same data item poses less of a challenge. 
The value of the data item, if constant, can be read by any number of transactions at any given time.
Write operation is something different. When a transaction writes some value into a data item, the content of that data item remains in an inconsistent state, starting from the moment when the writing operation begins up to the moment the writing operation is over.
Sample Transactions with Locks

Locking is the most common type of concurrency control mechanism. In this approach, any data is retrieved by an active user for updating, must be locked or denied to other users until updating is not complete. Some locking types are:
1. Binary Lock

2. Shared/ exclusive (Read/Write) Lock
3. Certify Lock

Shared/ exclusive (Read/Write) Lock

Read-lock (shared lock):

 Is associated with a database object by a transaction before reading (retrieving the state of) this object. A transaction may acquire shared lock on a data item in order to read its content. The lock is shared in the sense that any other transaction can acquire the shared lock on that same data item for reading purpose. Shared locks exist when two transactions are granted read access.
One transaction gets the shared lock on data and when the second transaction requests the same data it is also given a shared lock. Both transactions are in a read-only mode, updating the data is not allowed until the shared lock is released. There is no conflict with the shared lock because nothing is being updated. Shared locks last as long as they need to last; it depends on the level of the transaction that holds the lock. Shared locks gives data access more efficiency, and increases the lock managers overhead.

Write-lock (exclusive lock):

Is associated with a database object by a transaction (Terminology: "the transaction locks the object," or "acquires lock for it") before writing (inserting/modifying/deleting) this object. A transaction may acquire exclusive lock on a data item in order to both read/write into it. The lock is excusive in the sense that no other transaction can acquire any kind of lock (either shared or exclusive) on that same data item.
When we use the shared/exclusive locking scheme, the system must enforce the following rules:

1. A transaction T must issue the operation read_lock(X) or write_lock(X) before any read_item(X) operation is performed in T.

2. A transaction T must issue the operation write_lock(X) before any write_item(X) operation is performed in T.

3. A transaction T must issue the operation unlock(X) after all read_item(X) and write_item(X) operations are completed in T.

4. A transaction T will not issue a read_lock(X) operation if it already holds a read (shared) lock or a write (exclusive) lock on item X. This rule may be relaxed.

5. A transaction T will not issue a write_lock(X) operation if it already holds a read (shared) lock or write (exclusive) lock on item X. This rule may be relaxed.

 6. A transaction T will not issue an unlock(X) operation unless it already holds a read (shared) lock or a write (exclusive) lock on item X.
The relationship between Shared and Exclusive Lock can be represented by the following table which is known as Lock Matrix.

Locks already existing

Shared
Exclusive
Shared
TRUE
FALSE
Exclusive
FALSE
FALSE

The common interactions between these lock types are defined by blocking behavior as follows:
·         An existing write-lock on a database object blocks an intended write upon the same object (already requested/issued) by another transaction by blocking a respective write-lock from being acquired by the other transaction. The second write-lock will be acquired and the requested write of the object will take place (materialize) after the existing write-lock is released.
·         A write-lock blocks an intended (already requested/issued) read by another transaction by blocking the respective read-lock.
·         A read-lock blocks an intended write by another transaction by blocking the respective write-lock.
·         A read-lock does not block an intended read by another transaction. The respective read-lock for the intended read is acquired (shared with the previous read) immediately after the intended read is requested, and then the intended read itself takes place.

Two phase locking

Growing Phase:
In this phase the transaction can only acquire locks, but cannot release any lock. The transaction enters the growing phase as soon as it acquires the first lock it wants. From now on it has no option but to keep acquiring all the locks it would need. It cannot release any lock at this phase even if it has finished working with a locked data item. Ultimately the transaction reaches a point where all the lock it may need has been acquired. This point is called Lock Point.
·         Can only lock items during this Phase.
·         May also upgrade
·         May also Read & Write once items are locked
·         no unlocking in this phase
·         If Transaction is successful, it gets all its locks.

Shrinking Phase:
After Lock Point has been reached, the transaction enters the shrinking phase. In this phase the transaction can only release locks, but cannot acquire any new lock. The transaction enters the shrinking phase as soon as it releases the first lock after crossing the Lock Point. From now on it has no option but to keep releasing all the acquired locks.
·         Can only unlock items during this Phase.
·         May still Read & Write items which are still locked.
·         Phase begins with first unlock
·         no lock after first unlock
Database deadlock
A deadlock is a situation that occurs when two or more different database sessions have some data locked, and each database session requests a lock on the data that another, different, session has already locked. Because the sessions are waiting for each other, nothing can get done, and the sessions just waste time instead. A deadlock is a condition wherein two or more tasks are waiting for each other in order to be finished but none of the task is willing to give up the resources that other task needs. In this situation no task ever gets finished and is in waiting state forever.
For example, assume a set of transactions {T0, T1, T2, ...,Tn}. T0 needs a resource X to complete its task. Resource X is held by T1, and T1 is waiting for a resource Y, which is held by T2. T2 is waiting for resource Z, which is held by T0. Thus, all the processes wait for each other to release resources. In this situation, none of the processes can finish their task. This situation is known as a deadlock.
Wait for graph
A simple way to detect a state of deadlock is with the help of wait-for graph. This graph is constructed and maintained by the system. One node is created in the wait-for graph for each transaction that is currently executing. Whenever a transaction T1 is waiting to lock an item X that is currently locked by a transaction T2, a directed edge (T1->T2) is created in the wait-for graph. When T2 releases the lock(s) on the items that Ti was waiting for, the directed edge is dropped from the wait-for graph.

Technique that can be used to prevent the deadlock situation

Releasing and reacquiring locks in order: The basic idea is to always acquire locks in a particular order.

Using coarser-grained locks: One way to modify a program to avoid holding multiple locks is to replace uses of multiple locks by a single lock.
Avoiding holding multiple locks: If not thread attempts to hold more than one lock, then no deadlock can occur since the Hold and Wait condition is invalidated. For some systems, this is easy to arrange, but for others there is a genuine needs to lock multiple objects at the same time. In such cases, minimizing the number of situations where threads hold multiple locks will often still reduce the number of situations that need to be resolved by other techniques, so is good practice.
Minimizing the holding of locks: The default style in Java holds locks on objects whenever a method for the object is executing.
Using finer-grained locks: A common use of this technique is to replace a lock on a whole object by a number of locks for its parts. E.g., instead of locking a collection object like an array, the individual objects in the collection may be locked as appropriate.
Reordering lock acquisition: If we require threads to always acquire locks in a particular order, then no deadlock can occur. The Circular Wait Condition is avoided, since we cannot have a circular chain if threads can only wait for locks which come after the locks they’ve already acquired.
Database deadlock example in banking
Suppose an example of two database users working at a bank – let’s call those database users A and B. Let’s say that user X works in the customer service department and has to update the database for two of the banks customers, because one customer (call him customer X) incorrectly received Rs.5, 000 in his account when it should have gone to another customer (call him customer Y) – so user A has to debit customer A’s account by Rs.5, 000 and also credit customer B’s account Rs.5, 000.
Starvation

Starvation describes a situation where a thread is unable to gain regular access to shared resources and is unable to make progress. This happens when shared resources are made unavailable for long periods by "greedy" threads. For example, suppose an object provides a synchronized method that often takes a long time to return. If one thread invokes this method frequently, other threads that also need frequent synchronized access to the same object will often be blocked.

Security of data in Bank database

In the CIA triad, confidentiality, integrity and availability are basic goals of information security. However, there are instances when one goal is more important than the others. The following are examples of situations or cases where one goal of the CIA triad is highly important, while the other goals are less important.

Confidentiality:

Protecting information from unauthorized disclosure, or through improper disposal techniques. Underpinning the goal of confidentiality are authentication methods like user-IDs and passwords that uniquely identify a data system's users, and supporting control methods that limit each identified user's access to the data system's resources.
Confidentiality is the protection of information from unauthorized access. This goal of the CIA triad emphasizes the need for information protection. Confidentiality requires measures to ensure that only authorized people are allowed to access the information. For example, confidentiality is maintained for a computer file if authorized users are able to access it, while unauthorized persons are blocked from accessing it. Confidentiality in the CIA triad relates to information security because information security requires control on access to the protected information.
For example, information confidentiality is more important than integrity or availability in the case of proprietary information of a Bank. Also, confidentiality is the most important when the information is a record of people’s personal activities. To guarantee confidentiality under the CIA triad, communications channels must be properly monitored and controlled to prevent unauthorized access.

Integrity:

Protecting information from unauthorized modification and ensuring that information can be relied upon and is accurate and complete. Integrity refers to ensuring the authenticity of information. That information is not altered, and that the source of the information is genuine. Imagine that you have a website and you sell products on that site.
The CIA triad goal of integrity is more important than the other goals in some cases of financial information. Any change in financial records leads to issues in the accuracy, consistency, and value of the information. For example, banks are more concerned about the integrity of financial records, with confidentiality having only second priority. Some bank account holders or depositors leave ATM receipts unchecked and hanging around after withdrawing cash. This shows that confidentiality does not have the highest priority. Instead, the goal of integrity is the most important in information security in the banking system. To guarantee integrity under the CIA triad, information must be protected from unauthorized modification.

Availability:

Ensuring information is available when it is required. Data is held in many different areas like Network Servers, Personal Computers, Data Backup Media, and Data Loss Prevention. Availability is the situation where information is available when and where it is rightly needed. The main concern in the CIA triad is that the information should be available when authorized users need to access it. Availability is maintained when all components of the information system are working properly. Problems in the information system could make it impossible to access information, thereby making the information unavailable. In the CIA triad, availability is linked to information security because effective security measures protect system components and ensuring that information is available.


Suggestions to data security


Encryption (Private Communication)


Secure Sockets Layer-SSL encryption technology is used within your Online Banking session to encrypt your personal information before it leaves your computer in order to ensure no one else can read it.

Session time out


If some person are inactive for a certain period of time while logged in to Bank Online, system will automatically log other out, to avoid unauthorized activities.

Automatic Account Locking

Lock a user's account after a specified number of consecutive failed log-in attempts. You can configure the account to unlock automatically after a specified time interval or to require database administrator intervention to be unlocked. The database administrator can also lock accounts manually, so that they must be unlocked explicitly by the database administrator.


Use Access control

Access control is a security technique that can be used to regulate who or what can view or use resources in a computing environment. Access control systems perform authorization identification, authentication, access approval, and accountability of entities through login credentials including passwords, personal identification numbers (PINs), biometric scans, and physical or electronic keys.There are two main types of access control: physical and logical. Physical access control limits access to campuses, buildings, rooms and physical IT assets. Logical access limits connections to computer networks, system files and data.
The four main categories of access control are:
·         Mandatory access control
·         Discretionary access control
·         Role-based access control
·         Rule-based access control

Use Intrusion Detection and Prevention Systems (IDS/IPS)

Intrusion Detection and Prevention Systems (IDS/IPS) can be quite expensive for a financial institution, especially if they are implemented in the proper way, which requires 24/7 proactive management. As such, a risk-based decision should be used to determine which system is best and where it should be located within the network in order to provide the most cost effective benefits. There are typically two deployment scenarios that determine the appropriate system or systems to provide the best value. The institution either hosts Internet accessible servers or it does not. The distinction plays a key role in determining the appropriate deployment of IDS/IPS systems for the financial institution.

Intrusion detection and prevention software technologies addresses four types of intrusion detection and prevention software technologies:
·  Network-based, which monitors network traffic for particular network segments or devices and analyzes the network and application protocol activity to identify suspicious activity.
·   Wireless, which monitors wireless network traffic and analyzes it to identify suspicious activity involving the wireless networking protocols themselves.
·         Network Behavior Analysis, which examines network traffic to identify threats that generate unusual traffic flows, such as denial of service attacks, certain forms of malware and policy violations such as client system providing network services to other systems.
·        Host-based, which monitors the characteristics of a single host and the events occurring within that host for suspicious activity.

Other Security Implementation Methods

·         Use Firewalls
·         Regularity monitor Software patches/updates
·         Use Anti-virus and anti-spyware software
·         Setup System Privileges
·         Auditing