UNIT 5 Eh
UNIT 5 Eh
UNIT 5 Eh
Session hijacking is an attack where a user session is taken over by an attacker. A session starts when you log into a service and ends when you log out;
for example, your banking application. The attack relies on the attacker’s knowledge of your session cookie, so it is also called cookie hijacking or cookie
side-jacking. Although any computer’s session could be hijacked, session hijacking most commonly applies to browser sessions and web applications. In
most cases when you log into a web application (for example, via a username and password), the server sets a temporary session cookie in your
browser to remember that you are currently logged in and authenticated. HTTP is a stateless protocol and session cookies attached to every HTTP
header are the most popular way for the server to identify your browser or your current session. To perform session hijacking, an attacker needs to
know the victim’s session ID (session key). This can be obtained by stealing the session cookie or convincing the user to click a malicious link containing
a prepared session ID. In both cases, after the user is authenticated on the server, the attacker can take over (hijack) the session by using the same
session ID for their own browser session. The server is then fooled into treating the attacker’s connection as the original user’s valid session
Session sniffing:- It is one of the basic techniques used with application-layer session hijacking. The attacker uses a sniffer
tool such as Wireshark, or a proxy, such as OWASP Zed, to capture network traffic which contains the session ID between a
website and a client. Once an attacker captures this value, he can use this valid token to gain unauthorized access into
system.
Predictable sessions token ID:- Many web servers use a custom algorithm or some predefined pattern to generate session
IDs. Greater the predictability of a session token, the weaker it is and the easier it is to predict. If an attacker can capture
several IDs and analyze its pattern, he may predict a valid session ID.
Man-in-the-browser attack :-This is similar to a man-in-the-middle attack, but the attacker must first infect the victim's
computer with a Trojan through some form of trickery or deceit. Once the victim is tricked into installing malware onto the
system, the malware waits for the victim to visit a targeted site. The man-in-the-browser malware can invisibly modify
transaction information and it can also create additional transactions without the user knowing. Because the requests are
initiated from the victim's computer, it is very difficult for the web service to detect that the requests are fake.
Cross-site scripting :-Cybercriminals exploit server or application vulnerabilities to inject client-side scripts into web pages.
This causes the browser to execute arbitrary code when it loads a compromised page. If HttpOnly isn’t set in session
cookies, cybercriminals can gain access to the session key through injected scripts, giving them the information, they need
for session hijacking.
Session side jacking :-Cybercriminals can use packet sniffing to monitor a victim’s network traffic and intercept session
cookies after the user has authenticated on the server. If TLS encryption is only used for login pages and not for the entire
session, cybercriminals can hijack the session, act as the user within the targeted web application.
Session fixation attacks:- This technique steals a valid session ID that is yet to be authenticated. Then, the attacker tries to
trick the user into authenticating with this ID. Once authenticated, the attacker now has access to the victim's computer.
Session fixation explores a limitation in the way the web application manages a session ID. Three common variations exist:
session tokens hidden in an URL argument, session tokens hidden in a form field and session tokens hidden in a session
cookie.
The attacker then finds an active session between the target and another machine and places himself between them. Using a sniffer like Wireshark, he
captures the traffic and tries to gather information about the session.
2. Monitor:
He then monitors the traffic for vulnerable protocols like HTTP, telnet, rlogin, etc., and tries to find any valid authentication packets passing through.
3. Session Id Retrieval:
The attacker tries to predict the session id using available information. Now that a target has been chosen, the next step in the session hijacking process
is sequence number prediction. Sequence number prediction is a critical step because failing to predict the correct sequence number will result in the
server sending reset packets and terminating the connection attempt. If the attacker guesses the sequence numbers wrong repeatedly, the likelihood of
detecting the attack increases.
4. Stealing:
In application-level hijacking, active attacks are pursued to steal the session Id. Man in the middle attack, cross-site scripting, sniffing are used to steal
the session id.
While sequencing number guessing can be done manually by skilled attackers, software tools are available to automate the process.
Once a session is chosen and sequence numbers predicted, one of the targets has to be silenced. This is generally done with a denial of service attack.
The attacker must ensure that the client computer remains offline for the duration of the attack, or the client computer will begin transmitting data on
the network causing the workstation and the server to repeatedly attempt to synchronize their connections; resulting in a condition known as an ACK
storm.
The final phase of the session hijack attack entails taking over the communication session between the workstation and server. The attacker will spoof
their client IP address, to avoid detection, and include a sequence number that was predicted earlier. If the server accepts this information, the attacker
has successfully attacked the communication session.
2. Passive Session Hijacking : In Passive Session Hijacking, instead of controlling the overall session of a network of targeted user, the
attacker monitors the communication between a user and a server. The main motive of the hacker is to listen to all the data and record it for
the future use. Basically, it steals the exchanged information and use for irrelevant activity. This is also a kind of man-in-middle attack (as
the attacker is in between the client and the server exchanging information.
3. Hybrid Hijacking : The combination of Active Session Hijacking and Passive Session Hijacking is referred to as Hybrid Hijacking. In this
the attackers monitors the communication channel (the network traffic), whenever they find the issue, they take over the control on the web
session and fulfill their malicious tasks.