Cyber Security Explained, How-To Guides

File Share Security: How Hackers Break In and How to Stop It

Hackers break in through shared drives by reaching a file share (an SMB or NFS share, a NAS storage box or a...

Written by Catharsis · 4 min read >

Hackers break in through shared drives by reaching a file share (an SMB or NFS share, a NAS storage box or a file server) that is exposed to the internet or to too much of your network, then exploiting a bug, a weak setting or one infected computer. Often nobody clicks a link and nobody gives away a password: the attacker only needs to be able to reach the door.

The good news is that a few changes close almost every one of those doors. This guide explains what a file share really is, the three ways attackers get in, why file-sharing bugs can hide for years, and the fixes that matter most.

What is a file share?

A file share is a folder on one machine that other computers can open over the network, like the shared “S: drive” or “Projects” folder most offices use. Two languages do almost all of this work:

  • SMB (Server Message Block) is what Windows file sharing speaks. It listens on TCP port 445.
  • NFS (Network File System) is the usual choice on Linux and Unix servers. It listens on TCP port 2049.

NAS boxes, the small storage appliances many businesses keep in a cupboard, usually speak both. That makes them convenient, and it also means one box can expose two doors at once.

How do hackers get in?

The cases in our video all needed the same thing: someone able to reach the share. From there, attackers use one of three routes:

  • A bug in the file-sharing software. A flaw in the code that handles SMB or NFS can let an attacker run commands on the machine before any login happens.
  • A weak setting. Old protocol versions left switched on, shares open to everyone, or a storage box with “remote access” turned on so it can be reached from the internet.
  • One infected machine. Ransomware that lands on one computer can use the shares that computer can reach to spread and encrypt files across the business.

Why file-sharing bugs hide for years

File-sharing code is old, complex and almost never replaced, because everything depends on it. Bugs can sit unnoticed for years. SambaCry (CVE-2017-7494), a 2017 flaw in Samba, the software that gives Linux and NAS devices Windows-style file sharing, let an attacker who could reach a writable share make the server run their code.

Patching is also harder than it looks. Fixes for file servers often live in the operating system’s kernel or in NAS firmware, and they only take effect once the box restarts. A server that “installed the update” but never rebooted is still running the old, vulnerable code.

How one machine can infect every folder you own

WannaCry is the best-known example. In May 2017 it spread between computers through a flaw in the old SMBv1 protocol that Microsoft had already fixed two months earlier in security update MS17-010. Europol said the attack hit around 200,000 victims in 150 countries, and the UK National Audit Office investigated its impact on the NHS.

The lesson is that file sharing is a highway between machines. Every computer that can open a share is a possible starting point, and every folder it can write to is a possible target. That is also why backups that sit on the same shared drive are so easily lost.

Is your storage box on the internet?

In 2022, the DeadBolt ransomware encrypted files on QNAP NAS devices that were reachable from the internet. QNAP’s advice was blunt: stop exposing your NAS to the internet and update to the latest firmware.

Storage boxes end up online in quiet ways: a router port-forwarding rule someone added years ago, UPnP (a feature that lets devices open router ports by themselves), or a “remote access” option switched on during setup so files could be reached from home.

What to do now

Close the street doors

  • Make sure no file share, NAS or file server can be reached from the internet: turn off router port forwarding, UPnP and NAS “remote access”.
  • Block TCP 445 (SMB) and 2049 (NFS) at the firewall.
  • Have someone test your public IP address from outside the office to prove those ports are closed.
  • Give remote staff access through a VPN or a managed cloud drive, never straight across the internet.

Remove the weak settings

  • Turn off SMBv1. Newer versions of Windows no longer install it by default, but older machines and NAS boxes may still use it.
  • On Linux, disable NFS versions you don’t use.
  • Keep NFS root_squash on, so the administrator account on a client machine is not treated as the administrator on the server.

Limit the damage

  • Keep automatic updates on, and make sure servers and NAS boxes actually restart so kernel and firmware fixes are running.
  • Give each team only the folders it needs.
  • Keep backups somewhere the shared drive can’t reach.
  • Turn on NAS and server sign-in alerts and send them to a person who reads them. If you suspect a break-in, take the box off the network first.

A recent example: NFS2ROOT (November 2026)

In November 2026, researchers disclosed NFS2ROOT (CVE-2026-99362), a critical flaw rated CVSS 9.8 in the Linux kernel’s NFS server, nfsd. The bug had been in the kernel since version 3.16 in 2014. It affects servers offering NFS 4.1 or 4.2 on TCP port 2049, and it triggers before any login, so passwords, root_squash and Kerberos don’t stop it. No attacks in the wild had been reported as of late November 2026 and the researchers’ exploit was not public, but they did turn it into root access on a lab server. The fix is your distribution’s updated kernel plus a reboot; until then, allow port 2049 only from known client machines or turn off NFS 4.1 and 4.2.

Watch the 60-second version

FAQ

Which ports should never be open to the internet?

For file sharing, TCP 445 (SMB) and TCP 2049 (NFS). Microsoft’s own guidance is to block SMB at the network edge. If staff need files from outside the office, use a VPN or a managed cloud drive instead.

How do I know if my NAS is exposed?

Check your router for port-forwarding rules and UPnP, check the NAS settings for any “remote access” or cloud relay feature, then have someone scan your public IP address from outside your network to confirm nothing answers.

Is SMBv1 still dangerous?

Yes. SMBv1 is the protocol WannaCry spread through. Modern Windows doesn’t need it, so turn it off on every computer, server and NAS that still has it.

How Catharsis Cyber Security can help

Catharsis Cyber Security is an ISO 27001:2022-certified MSP/MSSP helping businesses stay secure. We find exposed services like open file shares, lock down file servers and backups, and monitor for attacks around the clock.

Learn more about our vulnerability management service, or contact us to check what your network is exposing.

Sources

Leave a Reply

Your email address will not be published. Required fields are marked *