Skip to content

Session Management Attacks – Part 1

First, before I get to the main topic of this article – session management – I will start by introducing some facts about sessions and why they are needed.

Hypertext Transfer Protocol (HTTP) is a stateless protocol!

This means multiple requests can be sent through one HTTP connection; requests are executed independently. 

The server is not attaching any additional information to the requests, so each request cannot know of the requests which are executed before. Once the transaction is terminated, the connection between the browser and the server is lost.

Historically, web used stateless protocol because the goal was to allow web pages to be served to many people using basic hardware as a server. If the connection was maintained for a long time, that would be very resource expensive.

Flow of an HTTP GET file:

– Request it made to get the file via URL

– File is returned in the response

– Connection disconnects

What is a session?

The session is a sequence of HTTP requests and transactions initiated by the user. 

What is session management?

Session management is the management of sessions between the web application and the users. Usually, web applications assign each user a specific session ID. Session IDs are used to uniquely identify the user, to maintain the state of the user and the state of the required web server so it can “remember” which user it is communicating with. Sessions are maintained by the server, and the session ID is sent with each request user makes.

This picture, which is taken from https://thecyphere.com/, gives a simple explanation of session management:

Solution for storing user data between HTTP requests:

In web applications, you need to find a way to store data between HTTP requests to associate one request with the other. Most often, developers use cookies and URLs to transfer the data. If you have sensitive data or you don’t want it to be visible in the UI, the best way to store it is in the session. As I mentioned before, in session management, the solution would be to provide each user session ID to maintain the data. 

Session cookies

Session ID needs to be stored somewhere, and cookies are often used for storage.

So, we have session ID, for example, SESSID=asdsadsa123456789, and we will store it in a cookie. Developers often set a short life for the session, which is automatically deleted if unused for some time (like 20 minutes).

Session management can use two types of cookies, non-persistent cookies, and persistent cookies. Non-persistent are also called session cookies. Persistent cookie will be the one which presents Max-Age or Expires attributes, and it is going to be stored on disk by the web browser until the expiration time.

Session Management Attacks

For the attackers to successfully perform the attack, they first need to explore how the application manages session IDs. After the user authenticates themselves with a known session ID, the target is to hijack the user-validated session with the session ID.

What is a cookie?

Wikipedia’s definition of a cookie is” A cookie is a baked or cooked snack or dessert that is typically small, flat, and sweet.”

But unfortunately, the definition of the cookie in the computer world is not so sweet.

A cookie is just a text file saved on the user’s computer. Maximum size of a cookie is 4KB. Other names of this type of cookie would be HTTP cookie, web cookie, etc.

How is it created?

When a user first visits a website, the site sends data packets to the user’s computer in the form of a text file, a so-called cookie.

*Very important to mention cookies are less safe than sessions because third-party can manipulate content in them. Whereas sessions are considered safer because they are stored in an encrypted form that only the user can read.

Implementation of cookie service in Angular

First, do nmp install of ngx package: npm i ngx-cookie-service 

Documentation of this package can be found here; also, if you need to check out older

versions: https://www.npmjs.com/package/ngx-cookie-service                  

Second, import the service in the app module:

import { CookieService } from 'ngx-cookie-service';
@NgModule({
  ...
    providers:
[CookieService],
...
})
export class AppModule {
}

You will also see in the documentation that it is easily used; just import in the class, inject in the constructor, and then you can use all methods from the cookie service.

constructor(private cookieService: CookieService)
{
  this.cookieService.set(Cookie1, 'Cookie value');
  this.cookieValue = this.cookieService.get('Cookie1');
}

Methods you can use from the cookie service:

  • check (checks cookie name)
  • get
  • getAll (returns cookie name, value, expires, path, domain, secure)
  • set (sets value: name, path, domain)
  • delete
  • deleteAll

How to implement Session Storage in Angular?

There is some confusion regarding the difference between session and local storage. The quick explanation is that data in session storage is lost when the browser closes and data in local storage remains until the browser cache is cleared. For a more detailed explanation, you can check out this site.

So, session storage is part of the web API, which stores ‘key’ – ‘value’ pairs. It can be accessed by the client side only, not by the server, to eliminate the security threat cookies present. 

As for implementation concerns, the best approach is to create the class with some helper methods, such as store and retrieveObject. I named that class SessionStorageManager.

import { Injectable } from "@angular/core";
 
@Injectable()
export class SessionStorageManager {
  readonly roles: string = "roles";
  readonly tenantsSettings: string = "tenantsSettings";
 
  store(key: string, content: Object) {
    sessionStorage.setItem(key, JSON.stringify(content));
  }
 
  private retrieve(key: string) {
    let storedItem: string = sessionStorage.getItem(key);
    if (!storedItem)
      throw No object with key ${key} found in the session storage!;
    return storedItem;
  }
 
  public retrieveObject(key: string) {
    let object = null;
    try {
      object = JSON.parse(this.retrieve(key));
    } catch (err) {
      console.error(err);
    }
    return object;
  }
}

As you can see, we can import this class into other classes that will store or retrieve items.

SessionStorage already has two methods: get and set item.

After we created the class SessionStorageManager, we need to add it also in app.module.ts, in providers.

As I mentioned, we can use it in any class we need to set or get data. For example, if we use Role Guard (if you want to check out its implementation, check out my article about IDOR), we can retrieve roles previously stored when the user logs in. When a user logs in from the API, we get their roles, and then we use SessionStorageManager and method store. So, in Role Guard, we can use SessionStorageManager and the method retrieveObject.

Store method in role service: 

  public loadUserRoles(): void {
    this._roleService.getEntity("/roles").pipe(
      delay(1),
    ).subscribe((data) => {
      this.userRoles = data;
      this._sessionStorage.store(
        this._sessionStorage.roles,
        data
      );
    });
  }

Retrieve method:

 let assignedRoles = this._sessionStorage.retrieveObject(
      this._sessionStorage.roles
 );

The data will be available until the browser closes!

Conclusion

In this article, I explained the best practice for implementing session management, whether it would be the implementation of session storage or cookie service in Angular.

There are many ways to write more secure code to prevent this attack from happening and hackers from succeeding, but first, it is important to choose the right way to set up session management!

In the next part of Session Management attacks article, I will write more about what you should pay attention to while implementing secured session management.

In the end, secure code is the cheapest code!

#session_management #session_cookies #cookie_service 

Cover photo by Mae Mu

About Version 2
Version 2 is one of the most dynamic IT companies in Asia. The company develops and distributes IT products for Internet and IP-based networks, including communication systems, Internet software, security, network, and media products. Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About VRX
VRX is a consolidated vulnerability management platform that protects assets in real time. Its rich, integrated features efficiently pinpoint and remediate the largest risks to your cyber infrastructure. Resolve the most pressing threats with efficient automation features and precise contextual analysis.

79% of organizations had a ransomware attack in the past year. Are you prepared?

The frequency of ransomware attacks is increasing along with the costs to businesses. Having a plan to respond in the event of a ransomware attack is more important than ever. 

IT research firm ESG conducted a ransomware study surveying 600 enterprise IT and cybersecurity professionals across North America and Western Europe. Here’s what they found: 

  • 79% of the organizations had a ransomware attack within the past year 
  • Every sixth company gets attacked by a ransomware weekly 
  • Every eighth company gets attacked by ransomware daily 

What’s the impact of a ransomware attack? 

When an organization suffers a ransomware attack, there are many negative consequences beyond the financial losses. According to the ESG study, victims of ransomware attacks suffered the following: 

  • 40% of the organizations reported a financial loss 
  • 50% reported data loss  
  • 32% reported reputational damage 
  • 39% reported a direct impact on employees, customers, and partners 
  • 30% reported compliance exposure 

As an IT Manager or a cybersecurity leader, can you bear these consequences in the organization?  

What’s the best ransomware recovery strategy?

 

Given the high frequency of these attacks, you need a recovery strategy to mitigate damage to your organization. A successful recovery strategy can help you recover data quickly to minimize the impact on operations. 

ESG research recommends cloud backup as the best practice for cyber recovery. The survey also found that the best-prepared organizations are the ones that have a cloud backup solution. 

How Keepit can play a role in your ransomware recovery strategy

If your organization is ready to get serious about protecting SaaS data and is looking for a solution, ESG recommends that you take a good look at Keepit.

Kerry Dolan, Senior IT Validation Analyst, ESG

Keepit offers an extremely simple, secure SaaS data protection solution that uses a proprietary object store to keep data protected and tamper-proof in its independent, redundant global data centers. With automatic snapshots, no backup scheduling is required, and retention is easy to configure and manage according to your compliance requirements.

Each daily snapshot is permanently preserved so that victims of ransomware can simply roll back to a point in time before the attack and restore their data in place.

Bottom Line

With the high frequency of ransomware attacks, IT leaders should focus on protecting their organization’s mission-critical data and digital assets by preparing and practicing to recover it quickly and completely. ESG recommends cloud backup as the best practice for cyber recovery. Keepit helps you in the cloud backup strategy with a backup that is simple, secure, and fast.   

Keepit backup is: 

Cloud independent – With Keepit, data is stored in a vendor-neutral cloud instead of public platforms like AWS, making Keepit a true third-party backup. 

Immutable – preserves your data permanently, even for data types that the source SaaS applications do not protect. 

Innovative storage architecture – allows super-fast data restores and inspection while giving you predictable restore performance and a fixed storage cost. 

To learn more about how Keepit secures data, read our security guide

About Version 2
Version 2 is one of the most dynamic IT companies in Asia. The company develops and distributes IT products for Internet and IP-based networks, including communication systems, Internet software, security, network, and media products. Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About Keepit
At Keepit, we believe in a digital future where all software is delivered as a service. Keepit’s mission is to protect data in the cloud Keepit is a software company specializing in Cloud-to-Cloud data backup and recovery. Deriving from +20 year experience in building best-in-class data protection and hosting services, Keepit is pioneering the way to secure and protect cloud data at scale.

UnderDefense becomes a member of MPN (Microsoft Partner Network)

UnderDefense enters strategic partnership with Microsoft Azure

Companies in various industries increasingly choose cloud as a primary location to store data or plan to migrate to the cloud. Such infrastructure is much more flexible for data modernization and analysis. But also among the main reasons for such transformation in the first place is cybersecurity and data protection.

UnderDefense selected Azure as main cloud platform to support Enterprise customers and becomes part of MPN (Microsoft Partner Network) to deliver better Incident Response and Managed Security Services.

Current UnderDefense partnerships, certifications and competence include also GCP and AWS where we serve our SMB &customers from Technology domain. The hassle we are going to solve for our Enterprise customers as part of their Cyber Resilience control include:

  • Onboarding new customers to the UnderDefense service in minutes
  • Implement MITRE ATT&CK detection coverage in a mixed Cloud environment
  • UnderDefense investigation of Microsoft Defender ATP, LogicApps SOAR and Sentinel SIEM for alerts and telemetry
  • Minimization of false positives and Massive automation with SOAR Provide on-demand
  • Inicdent Response & Cloud based Digital Forensics (C-DFIR)
  • 24×7 Cyber Incident Response Team (CIRT)

About Version 2
Version 2 is one of the most dynamic IT companies in Asia. The company develops and distributes IT products for Internet and IP-based networks, including communication systems, Internet software, security, network, and media products. Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About UnderDefense
UnderDefense, a globally top-ranked firm by Gartner and Clutch, provides cyber resiliency consulting and technology-enabled services to anticipate, manage and defend against cyber threats. We empower clients to predict, prevent, detect, and respond to threats.

Risk-Based Vulnerability Management Challenges & Solutions to Overcome Them

In today’s cyber landscape, efficient vulnerability management is a top priority. Organizations cannot afford to take chances with cyber-attacks on the rise and the increasing sophistication of malicious actors. Unfortunately many hold the wrong perspective of vulnerability management (VM) which can cause  recurring security challenges and  for organizations. 

In many cases targeted threat actors or untargeted ransomware attackers take advantage of an organization’s inaction. They infiltrate a network to disrupt operations, primarily for financial gain. No company should handle these issues with a kid’s glove. Looking at today’s threatscape, RBVM is critical in knowing how to combat the menace of cyber threats. 

Common Vulnerability Management Challenges & a Lasting Solution

1. Insufficient Asset Inventory: We all know how challenging it is to protect what you can’t see. One major factor facing most organizations is the incomplete asset inventory data at their disposal. At best, storage often occurs in obsolete spreadsheets or other methods. Unfortunately, the result is often incomplete or incorrect data. What organizations require is concise and up-to-the-minute data on their assets.

A company that utilizes robust asset inventory management solutions is on the road to successful vulnerability management. Asset inventories help to determine the scope of potential risks, and how to patch them safely. In-depth context on a company’s assets produces a formidable vulnerability analysis and prioritization. On the other hand,  insufficiently detailed asset profiling can make the process rather cumbersome. 

2. Inaccurate and Inefficient Prioritization of Vulnerabilities: Undoubtedly, most IT environments of organizations experience a large number of vulnerabilities. The threats range in scope and potential damage- which puts an arduous task on the security team to patch or fix. An essential factor to consider remains the exploitation or value of an asset. Therefore, a risk-based prioritization into low, medium, high, and critical-risk vulnerabilities becomes expedient. 

Every organization needs to check the connection between vulnerabilities and the presence of public exploits. Also, consider any attack with the sole aim of detecting the vulnerability of a network. Such actions help to focus more on the severity and urgency of every vulnerability. 

3. Difficulty in Detecting Vulnerabilities: Many companies use vulnerability scanning to identify weaknesses within a network to prevent the exploitation of their infrastructure. Unfortunately, while the method is suitable, it is not the most effective. Moreover, vulnerability scanning can come with specific challenges.

First, it disrupts or disables operations completely. Organizations often work with integrated systems; such disruption leads to the eventual tripping of the entire system infrastructure. Another challenge comes in the form of huge gaps between scans. The infrequency of scans during downtimes makes them out at the end of each process. This can lead to  an incomplete picture of the actual vulnerability. Furthermore, there’s reduced accuracy during the process since vulnerability scanning comes with settings. These settings help to decrease the function or force of a scan. 

What organizations need is a robust identification and tracking mechanism for vulnerabilities. Multiple agencies and services provide  penetration testing. Such platforms help to safely discover vulnerabilities within an organization. 

4. The Use of Outdated Scanning Methods: One VM challenge is the use of outdated scanning tools or manual scanning. Such methods include authenticated scanning, unauthenticated scanning, and agent-based scanning. 

Manual processes are time-consuming, thereby increasing the effort to perform scans. The outcome is a decline in accuracy and effectiveness since the  scan report  results are often redundant and inaccurate, with higher false positives and human errors.

5. Lack of a Unified View of Vulnerabilities: Organizations use various methods and scanners to detect vulnerabilities. Some of these include agent-based, authenticated, and unauthenticated scanning. The challenge is that each operates on its own. As a result, this leads to treating each vulnerability in disconnected systems. The inability to unify all vulnerabilities from multiple sources into a central system makes tracking and remediation difficult. Instead, what most companies need to gun for is a single unified view of vulnerabilities.

6. Untimely Remediation of Vulnerabilities: The remediation process of most organizations is a slow one. It takes an average of 100 days to remediate a vulnerability. The consequence is that it gives attackers a large window of opportunity to operate. However, software patching occurs daily or weekly, as the case may be. It is a complex and time-consuming process.

 Remediating vulnerabilities comes from patching, updating software, and bug fixes . The challenge is that many organizations’ pace with addressing or fixing vulnerabilities is often relatively slow. Effective vulnerability management involves patch automation controlled by a team of experts.

7. Lack of Vulnerability Asset Mapping: Many organizations fail to list all assets at their disposal, making it challenging to match vulnerabilities during analysis. However, the process is a must to get them prioritized for remediation. Vulnerability asset mapping helps to determine the attack surface of an organization. Such information is vital in providing visibility to the vulnerability landscape and allows the security team to gain a clear idea of the affected assets.

8. An Episodic Approach to Vulnerability Management: The vulnerability management approach for most companies is sporadic. As a result, controlling the flow of vulnerability becomes challenging. A progressive approach is a prerequisite to reducing vulnerability management risks. It would certainly not do any good to work with a backlog of security issues and incur more vulnerability debt. Instead, the goal should be to improve and harden the security posture.

Tracking the VM Process

Most organizations conduct one-time vulnerability assessments due to the manual effort involved. This process challenges the security team in managing the entire VM process from  beginning to the end. One of the reasons is that it’s hard to keep track of the entire process whether it’s making patches or keeping track of asset inventories, vulnerabilities, and remediation. It also entails updating information in real-time, refreshing relevant data, and more; the entire manual process can be quite cumbersome.  

Final Thoughts 

As much as we agree that VM challenges are part of the VM process, they shouldn’t be recurring. Where they are, organizations must take action. These challenges become easy to overcome with improved security tools and services.  Accurate Risk-Based Vulnerability Management requires contextualizing vulnerability intelligence (VI) to an organization’s assets that is comprehensive, detailed, and timely. 

About Version 2
Version 2 is one of the most dynamic IT companies in Asia. The company develops and distributes IT products for Internet and IP-based networks, including communication systems, Internet software, security, network, and media products. Through an extensive network of channels, point of sales, resellers, and partnership companies, Version 2 offers quality products and services which are highly acclaimed in the market. Its customers cover a wide spectrum which include Global 1000 enterprises, regional listed companies, public utilities, Government, a vast number of successful SMEs, and consumers in various Asian cities.

About Portnox
Portnox provides simple-to-deploy, operate and maintain network access control, security and visibility solutions. Portnox software can be deployed on-premises, as a cloud-delivered service, or in hybrid mode. It is agentless and vendor-agnostic, allowing organizations to maximize their existing network and cybersecurity investments. Hundreds of enterprises around the world rely on Portnox for network visibility, cybersecurity policy enforcement and regulatory compliance. The company has been recognized for its innovations by Info Security Products Guide, Cyber Security Excellence Awards, IoT Innovator Awards, Computing Security Awards, Best of Interop ITX and Cyber Defense Magazine. Portnox has offices in the U.S., Europe and Asia. For information visit http://www.portnox.com, and follow us on Twitter and LinkedIn.。

×

Hello!

Click one of our contacts below to chat on WhatsApp

×