How to install multiple CUDA versions on a single Linux server

After you installed the first CUDA toolkit (preferably the latest stable version), and you want to install others beside it, due to some compatibililty issues for example, just do the following:

Download the standalone file installer, e.g. https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run

chmod +x file_name
sudo ./file_name

When prompted for the components, you MUST deselect the driver, better just keep the CUDA toolkit and deselect all others

When prompted to update the /usr/local/cuda symlink, DON’T accept

After installation is done, just run the following and you are good to go:

export PATH=/usr/local/cuda-11.7/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64:$LD_LIBRARY_PATH

Tested and working properly on Ubuntu 22.04 with A100 GPUs

Enjoy!

Source: https://medium.com/@peterjussi/multicuda-multiple-versions-of-cuda-on-one-machine-4b6ccda6faae

Posted in Linux | Tagged , , , | Leave a comment

CVE-2020-0796 – SMBGhost RCE Vulnerability

Description and Impact

Also known as CoronaBlue, EternalDarkness and SMBleedingGhost, this critical buffer-overflow pre-authentication RCE vulnerability affects Microsoft SMB version 3.1.1 that have SMBv3 Compression enabled. It occurs when the server attempts to decompress a data packet with malformed header, causing a memory buffer overflow. That overflow can cause memory corruption, crashing the kernel and allowing an attacker to execute arbitrary code.

This vulnerability can affect both servers and clients. To affect a server, the attacker could send a compressed data packet with the malformed header to that server. To exploit it against a client, a malicious SMBv3 server must be created by the attacker and trick a user into connecting to it.

The following products and versions are affected:

ProductVersion
Windows Server1903
Windows Server1909
Windows 101903 for x86-32bit, x86-64bit, ARM-64bit Systems
Windows 101909 for x86-32bit, x86-64bit, ARM-64bit Systems

Lifecycle and Trend

This vulnerability was disclosed on March 10th, 2020 accidentally in a security vendor’s blog for March’s Microsoft Patch Tuesday. The accidental disclosure of the vulnerability identified it as CVE-2020-0796. This was confirmed by Microsoft on March 12th, 2020, and released an out-of-band patch.

With the beginning of March, Keysight’s honeypots detected a sudden increase in SMB related activity with 63,322 scans on 13th of March.

Multiple POCs were released after Microsoft published the security advisory.

Programming Flaw

There are two main flaws leading to this vulnerability:

  • Improper Input Validation: When the server receives a compressed data packet, it doesn’t add a check for the size of uncompressed data before starting the decompression. This check should be added, and if the size is too large, then reject the packet.
  • Missing Memory Allocation Checks: Before writing decompressed data to the buffer, the process doesn’t ensure that the buffer has adequate space. This check should be added to make sure of that. Depending on the result, it should decide whether to accept or reject the packet.

Exploitation Methodology

This vulnerability can be exploited through the integer overflow bug in the Srv2DecompressData function in the Srv2.sys file. This vulnerability can be triggered when the SMB server receives a malformed SMB2_Compression_Transform_Header. After that, the Srv2DecompressData function creates a buffer to hold the decompressed data. The function computes the buffer size by adding the “OriginalSize” to the “Offset”. After the buffer size has been calculated, it passes the size to the SrvNetAllocateBuffer function to allocate the buffer. The overflow caused the kernel to allocate a buffer that was much smaller than it should be. This caused memory corruption and can crash the kernel.

An exploit has been developed on Metasploit: exploit/windows/smb/cve_2020_0796_smbghost

Log Traces

The following network logs should indicate attempts to exploit this vulnerability:

  • Spikes in SMB Traffic
  • Specific packet patterns with compression flag set and an anomalous size value

IDS Detection

Fortinet

Signature ID : 48773 MS.SMB.Server.Compression.Transform.Header.Memory.Corruption

Cisco Snort

1:53427 <-> ENABLED <-> OS-WINDOWS Microsoft Windows SMB srv2.sys remote code execution attempt (os-windows.rules)
1:53428 <-> ENABLED <-> OS-WINDOWS Microsoft Windows SMB srv2.sys remote code execution attempt (os-windows.rules)
1:53426 <-> ENABLED <-> OS-WINDOWS Microsoft Windows SMB srv2.sys remote code execution attempt (os-windows.rules)
1:53425 <-> ENABLED <-> OS-WINDOWS Microsoft Windows SMB srv2.sys remote code execution attempt (os-windows.rules)

McAfee IPS

Attack Name: NETBIOS-SS: Samba Remote Code Execution Vulnerability (CVE-2020-0796)
Attack ID: 0x43c0e600

References

Posted in Linux | Leave a comment

How to configure TP-LINK TL-WN722N v1.1 WiFi Adapter for Kali Linux

This WiFi card (which works mainly for monitoring mode) was not getting detected by Kali (2023.2 as of now) and I had to just install an extra package to get it working properly:

sudo apt update
sudo apt install firmware-atheros

Unplug and plug it again, and voila!

Enjoy!

Sources:

https://unix.stackexchange.com/questions/326462/how-do-i-install-atheros-ar9271-wifi-drivers-on-debian

Posted in Linux | Tagged , , | Leave a comment

Kali Desktop in a VM: Have a better desktop experience

Well, this issue has been bothering me for a while. If you have Kali Linux Desktop on a Virtual Machine (VMware Workstation or VirtualBox for example), and you have a low-resolution screen, you won’t feel that much, however, if you have a 2K+ screen, you will see these tiny icons and text:

Some would say just use the hidpi mode, but it becomes too big! The best solution I found so far is to install the gnome-desktop. Note: Before you do that, you might need to change the line in “/etc/apt/sources.list” that points to “kali-rolling” to” kali-last-snapshot” before running the below command, for a more stable Kali experience (Kali overall, not just the desktop):

sudo apt update && sudo apt install kali-desktop-gnome

Once prompted to select a display manager, choose gdm3.

After rebooting, login normally, open the Tweaks App (Not Kali Tweaks), go to Fonts, then modify the Scaling Factor to your preference. It will be much more convenient and comfortable for your eyes:

That’s it, Enjoy!

Posted in kali, Linux | Tagged , , , | Leave a comment

Remote Training in Cybersecurity for ICS

This is a summary of a very interesting paper for a proposed framework for ICS Cybersecurity remote training: https://www.sciencedirect.com/science/article/pii/S2405896322015427, especially with the move towards remote training with the COVID-19 pandemic still around the corner.

This summary is divided into 4 sections; An introduction, description of the proposed platform, Education experience and results from the proposed framework and eventually a conclusion.

Introduction

Cybersecurity is a key subject for digital transformation where institutional, industrial, and educational sectors should be involved in a coordinated way. Currently, there is a lack of workforce with essential competences to apply secure solutions in an industrial environment. For that reason, to address this increasing demand, universities promote ICS courses and related programs. In this work, a platform for remote training in cybersecurity is proposed using cabinets that include specific elements for automation and control as well as additional resources for administration and communication tasks. The platform was used to conduct two training courses and the feedback was mostly positive.

Proposed Platform

The IoT ULE-Schneider Electric Technological Classroom is being used for delivering the training. This classroom is composed of 10 control cabinets whose design follows a prototype developed by the researchers of the SUPPRESS research group. It comprises 4 subsystems: Field, Industrial Control and Supervision, Electric Management, and Communications. Physical devices and Hyper-V virtual machines were both utilized. A physical central server was used for providing an LMS, remote access management and administrative utilities. In addition, a PC was hooked up to each cabinet for software administration, including managing traffic, access management, PLC programming and HMI configuration, and monitoring traffic. Each student can remotely access an independent physical computer and is redirected to the assigned workstation after login. To avoid loss of connection to the cabinet, the architecture isolates the practice networks from the management one to be able to re-establish the systems in case of failure.

Educational Experience and Results

Two introductory, eminently practical, courses were developed using the proposed platform with generic ICS security topics as well as securing its communication networks. They are designed for educators with strong backgrounds in ICS and cybersecurity. Learning outcomes ranged from engineering technical perspectives such as utilizing vulnerability scanners and sniffing networks, to network design, security policies design and risk management. Both courses were provided in 2021 remotely, where the instructors had fully-fledged video conferencing with the students and remote access to stations. Materials included step-by-step hands-on exercises through the LMS, and all the students shared the same configuration for each task, regardless of which cabinet they are connected to.

Eventually, a questionnaire was handed out to the trainees to evaluate the effectiveness of the training and gain valuable feedback regarding the lab structure, quality of remote operation and their perception of the improvement in the learning process using the platform’s equipment. The results came back mostly positive in all the three sections.

Conclusion

An educational platform for remote training in industrial cybersecurity is developed. The architecture is composed of several functional blocks. The proposed platform has been used for training of professional educators in two eminently practical courses that addressed the security of ICS and communication networks. The students had the chance to work with key technologies for secure configuration of industrial hardware and software, as well as other technologies such as vulnerability assessment and IDS. In this sense, the proposed approach can be considered successful as an ICS training platform.

Posted in Linux | Tagged , , , , , | Leave a comment