Heimdal Security Blog

What Is Session Hijacking. Session Hijacking Types

Session hijacking lets hackers steal your online session and perform actions on your behalf. You don’t want to fall into their trap, do you? Then you are now in the right place. We’ve got your back. We have gathered all you need to know about what is session hijacking, how session hijacking works, and session hijacking prevention. Keep reading and stay safe!

What Is Session Hijacking? Definition

Session hijacking stands for a cyberattack where a malicious hacker places himself in between your computer and the website’s server while you are engaged in an active computer session (the time between you first log into your bank account, and then log off after your operation, for example) in order to steal it. The hacker actively monitors everything that happens on your account, and can even kick you out and take control of it. It is often called cookie hijacking or cookie side-jacking because the hacker gains knowledge of your session cookie giving him access to the session ID that lets him impersonate the user and perform actions on his behalf: transferring your money to his account for instance.

What’s a session cookie? A temporary session cookie is created when you login into an application. This helps the server remember you are logged in and identify your session through the HTTP stateless application protocol attached to the HTTP header.

What Can Attackers Do After They Successfully Hijack a Session?

The biggest threat of session hijacking is that the malicious attacker can also enter the server and access its information without having to hack a registered account. In addition, he can also make modifications on the server to help him hack it in the future or to simplify a data-stealing operation.

If successful, threat actors would:

Sounds nasty? Let’s dive into session hijacking types for a better sprinkle of awareness.

How Session Hijacking Works. Session Hijacking Types

When we talk about session hijacking broadly, we can do it at two different levels: the first is the session hijacking application level (HTTP), the second it’s the TCP session hijacking (network level). The first targets a session cookie, the hacker steals the session ID and performs actions on the behalf of the user, the latter means intercepting packets transmission between the user and the server.

We will talk about session hijacking types at the application level in this article, as when hijacking a session hackers generally target websites and web applications that involve cookies found in the HTTP application-level protocol, hence its generic nickname cookie hijacking. The TCP session hijacking is not relevant in a session cookie hijacking context, however, an example of this is mentioned at the end of the article to make you understand the difference.

Here are the top 6 session hijacking types:

1)     Cross-Site Scripting (XSS) or Misdirected Trust

2)     Session side-jacking

 

3)     Session fixation

Session fixation is a session hijacking example method a hacker uses to access your account with a Session ID of his choosing.

Session fixation example:

What does this session fixation example show?

By logging into your account from this link, the malicious hacker has “fixed” your Session ID as “I_want_your_money”. He can now use it to access your account at the same time as you, and clean it of any money or do any other operation.

4)     Malware infections

5)     Brute-forcing the Session ID

6)     Man-in-the-Browser

What Is a Session ID?

As you can guess, the SessionID is basically the “name” of a particular session. For instance:

Your Facebook session might have the SessionID 1233vs%fav.

Your Amazon session might have the SessonID 684s`9lbd.

Image Source

What Are the Ideal Targets of Session Hijacking?

Session hijacking usually targets:

Also, the fact the organizations use SSO (Single Sign-On) makes them a target, since authenticated users are identified through cookies in these systems, giving threat actors access to everything: financial systems, web applications, customer data, and so on.

How to Prevent Session Hijacking

Here you can find the session hijacking prevention measures that will keep you away from cookie hijacking. Start to implement them today and be a step ahead!

1) Check if the website is HTTPS

HTTPS indicates the security of a website. Therefore, if you access a website’s URL starting with HTTPS instead of HTTP, this means that the data your computer sends to the server will be encrypted.

Without HTTP, data packets sent between your computer and the server are essentially plain text, meaning the malicious hacker can just read them as they are.

2) Log out at the end of every session

Regenerate your session key

Logging out of your account will terminate the session. This means you will also force the attacker to log out, stopping him to hijack the session.

Ideally, you want operations on sensitive accounts such as your bank to be “hit and run” operations, where you go in, do the operation, and immediately log out. This will significantly cut down the amount of time an attacker has access to your account, and limit how much damage he can inflict.

3) Use a good antivirus

While not the end-all, be-all solution to cybersecurity, an antivirus goes a long way in keeping you safe. The best antivirus programs have a significant database of malware signatures, a good behavioral analysis engine, and removal capabilities.

Here’s a more in-depth resource that might help you find the best antivirus.

Heimdal™ Security’s Next-Gen Antivirus & MDM can help you with this.

4) Prevent Cross-Site Scripting with HttpOnly

Go to the HTTP Header, find the Set-Cookie, and set the HttpOnly attribute. This way, threat actors will not have the possibility to access cookies from client-side scripts. You can also apply the Secure and Same Site directives.

5) Don’t log in on open wireless networks

An unencrypted Wi-Fi network is an open invitation for a malicious hacker to steal your information.

Using either a hardware tool or software, a malicious hacker can easily intercept the traffic, and see what is communicated over the open network.

This includes everything, from credit card data to passwords, instant messages, or emails.

As a takeaway, do your best not to use open Wi-Fi networks. If you have to use the Internet, switch to your data plan instead.

Or, if you still need public Wi-Fi, make sure you use a VPN that protects and encrypts your data.

6) Keep your browser and other software updated at all times

Software vulnerabilities are a major security risk since hackers design their malware to target a specific vulnerability in a certain kind of software.

Outdated browsers, Flash, and other toolbars exponentially increase the risk of a session hijacking, so be sure to always update this software.

If this sounds like too much of a hassle, then we suggest you use HEIMDAL™ THREAT PREVENTION HOME, a security tool that automatically updates critical software on your computer, without bothering you with popups and other nuisances.

7) Traffic filtering

Another way to make sure session stealing malware doesn’t infect you is to use traffic filtering solutions. These programs scan your traffic and then block any malware that might be coming towards your PC.

A traffic filtering solution will also scan your outgoing traffic. If it notices personal information of yours going to a suspicious site, it will cut off communications, keeping it safe and out of the hands of malicious hackers.

The Additional Security Pill

Remember that we talked at the beginning about classifying session hijacking at two levels? Before you go, read an example of TCP session hijacking for your extra info and to help you make the difference between cookie hijacking (what’s the article about) and TCP session hijacking. What is out on the internet is all about cookie hijacking at the application level.

This example is not related to session cookie whatsoever; therefore, the hacker will not steal the session ID to hijack your computer session but will use transmission of data packets between the user and the server to hijack a session at the network level.

The TCP session hijacking is not actually relevant when talking about cookie hijacking, because it does not involve the stealing of the session cookie, but focuses on sequence numbers of data packets. It is just worth mentioning as another type of session hijacking, generally speaking, that could be performed at the network level.

TCP session hijacking

The question is: are guesses always correct? Well, if the threat actors fail to properly guess the sequence number, this can result in the server sending a reset packet, that will basically restart the connection from scratch. In other cases, the server might decide to end the session entirely.

Wrapping up…

An old attack method, that will still be around for a long time to come, session hijacking is an understated threat, overshadowed by the bigger ones such as ransomware, DDoS attacks, or banking Trojans.

However, its ease of use combined with the outsized potential for profit still makes it a potent and heavily used tool in the arsenal of malicious hackers.

Have you ever suffered a session hijacking? What are some other security methods that you use to stay safe online?

The easy way to protect yourself against malware
Here's 1 month of Heimdal™ Threat Prevention Home, on the house!
Use it to: Block malicious websites and servers from infecting your PC Auto-update your software and close security gaps Keep your financial and other confidential details safe

EASY AND RELIABLE. WORKS WITH ANY ANTIVIRUS.

Download Free Trial

NO CREDIT CARD REQUIRED

Also, drop a line if you have any comments or suggestions. We will be more than happy to answer you!

And if you really want to be updated, you can also subscribe to our newsletter!

This post was updated by Andra Andrioaie in July 2021.