search
HomeSystem TutorialLINUXApplication of methods to repair SambaCry vulnerabilities in Linux systems

Application of methods to repair SambaCry vulnerabilities in Linux systems

Jan 02, 2024 pm 09:12 PM
linuxlinux tutorialRed Hatlinux systemlinux commandlinux certificationred hat linuxlinux video

Introduction Samba has long been the standard for providing shared file and print services to Windows clients on Linux systems. Used by home users, mid-sized businesses and large companies, it stands out as the best solution in environments where multiple operating systems coexist, something that most Samba installations face due to the widespread use of tools. The risk of an attack that exploits a known vulnerability that was considered unimportant until news of the WannaCry ransomware attack came out.

Linux 系统中这样修复 SambaCry 漏洞

Vulnerability

Outdated and unpatched systems are vulnerable to remote code execution vulnerabilities. In simple terms, this means that someone with access to a writable share can upload an arbitrary piece of code and have it executed using root privileges in the server.

This issue is described as CVE-2017-7494 on the Samba website and is known to affect Samba v3.5 (released in early March 2010) and later. It was unofficially named SambaCry due to similarities to WannaCry: they both target the SMB protocol and are likely worms - which could cause it to spread from one system to another.

Debian, Ubuntu, CentOS and Red Hat have taken quick action to protect their users and released patches for their supported versions. Additionally, unsupported security workarounds are provided.

Update Samba

As mentioned previously, there are two ways to update depending on how you installed it previously:

If you installed Samba from the distribution's repository

Let’s look at what you need to do in this situation:

Fixing SambaCry under Debian

Add the following line to your sources list (/etc/apt/sources.list) to ensure that apt gets the latest security updates:

deb http://security.debian.org stable/updates main
deb-src http://security.debian.org/ stable/updates main

Next, update the available packages:

# aptitude update

Finally, make sure that the version of the samba package matches the bug-fixed version (see CVE-2017-7494):

# aptitude show samba

Linux 系统中这样修复 SambaCry 漏洞

Fixing SambaCry in Debian

Fixing SambaCry in Ubuntu

To start the repair, check for new available packages and update the Samba package as follows:

$ sudo apt-get update
$ sudo apt-get install samba

The Samba versions that have fixed CVE-2017-7494 are as follows:

  • 17.04: samba 2:4.5.8 dfsg-0ubuntu0.17.04.2
  • 16.10: samba 2:4.4.5 dfsg-2ubuntu5.6
  • 16.04 LTS: samba 2:4.3.11 dfsg-0ubuntu0.16.04.7
  • 14.04 LTS: samba 2:4.3.11 dfsg-0ubuntu0.14.04.8

Finally, run the following command to verify that your Ubuntu has the correct version installed.

$ sudo apt-cache show samba

Fixing SambaCry in CentOS/RHEL 7

The patched Samba version in EL 7 is samba-4.4.4-14.el7_3. To install it, do these:

# yum makecache fast
# yum update samba

As before, make sure you have the patched version of Samba installed:

# yum info samba

Linux 系统中这样修复 SambaCry 漏洞

Fixing SambaCry in CentOS

Old supported CentOS and older versions of RHEL are also fixed. See RHSA-2017-1270 for more.

If you installed Samba from source

Note: The following procedure assumes you have previously built Samba from source. It is strongly recommended that you try it in a test environment before deploying to a production server.

Also, make sure you back up the smb.conf file before starting.

In this case, we will also compile and update Samba from source. However, before we begin, we must first ensure that all dependencies are installed. Note that this may take several minutes.

In Debian and Ubuntu:

# aptitude install acl attr autoconf bison build-essential /
debhelper dnsutils docbook-xml docbook-xsl flex gdb krb5-user /
libacl1-dev libaio-dev libattr1-dev libblkid-dev libbsd-dev /
libcap-dev libcups2-dev libgnutls28-dev libjson-perl /
libldap2-dev libncurses5-dev libpam0g-dev libparse-yapp-perl /
libpopt-dev libreadline-dev perl perl-modules pkg-config /
python-all-dev python-dev python-dnspython python-crypto xsltproc /
zlib1g-dev libsystemd-dev libgpgme11-dev python-gpgme python-m2crypto

In CentOS 7 or similar:

# yum install attr bind-utils docbook-style-xsl gcc gdb krb5-workstation /
libsemanage-python libxslt perl perl-ExtUtils-MakeMaker /
perl-Parse-Yapp perl-Test-Base pkgconfig policycoreutils-python /
python-crypto gnutls-devel libattr-devel keyutils-libs-devel /
libacl-devel libaio-devel libblkid-devel libxml2-devel openldap-devel /
pam-devel popt-devel python-devel readline-devel zlib-devel

Stop the service (LCTT translation: not necessary here):

# systemctl stop smbd

Download and unzip the source code (4.6.4 is the latest version at the time of writing):

# wget https://www.samba.org/samba/ftp/samba-latest.tar.gz 
# tar xzf samba-latest.tar.gz
# cd samba-4.6.4

For informational purposes, check the available configuration options with the following command.

# ./configure --help

If you have used some options in the previous version of the build, you may be able to include some options in the return of the above command, or you may choose to use the default value:

# ./configure
# make
# make install

Finally restart the service.

# systemctl restart smbd

And verify you are using the updated version:

# smbstatus --version

The returned value here should be 4.6.4.

Other situations

If you are using an unsupported distribution and for some reason cannot upgrade to the latest version, you may want to consider these suggestions:

  • If SELinux is enabled, you are protected!
  • Make sure the Samba share is mounted with the noexec option. This prevents binaries from being executed from the mounted file system.

There are also generals:

nt pipe support = no

Add to the [global] field of smb.conf. You might want to keep in mind that this "may disable certain features of the Windows client" according to the Samba Project.

Important: Note that the nt pipe support = no option disables the share list for Windows clients. For example: when you enter //10.100.10.2/ in Windows Explorer on a Samba server, you will see "permission denied". Windows clients have to manually execute the share, such as //10.100.10.2/share_name to access the share.

Summarize

In this post, we have described the SambaCry vulnerability and how to mitigate the impact. We hope you can use this information to protect the systems you are responsible for.

If you have any questions or comments about this article, please use the comment box below to let us know.


About the Author:

Gabriel Cánepa is a GNU/Linux system administrator and web developer at Villa Mercedes in San Luis, Argentina. He works for a large international consumer products company and has great fun using FOSS tools in his daily work to increase productivity.


The above is the detailed content of Application of methods to repair SambaCry vulnerabilities in Linux systems. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Linux就该这么学. If there is any infringement, please contact admin@php.cn delete
What are the main tasks of a Linux system administrator?What are the main tasks of a Linux system administrator?Apr 19, 2025 am 12:23 AM

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Is it hard to learn Linux?Is it hard to learn Linux?Apr 18, 2025 am 12:23 AM

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

What is the main purpose of Linux?What is the main purpose of Linux?Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment