19.04.2013 Views

2KKUU7ita

2KKUU7ita

2KKUU7ita

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 12: Linux<br />

✓ Block spoofed addresses at the firewall, as I outline in Chapter 8.<br />

✓ Set the read permissions for each file’s owner only.<br />

• .rhosts: Enter this command in each user’s home directory:<br />

chmod 600 .rhosts<br />

• hosts.equiv: Enter this command in the /etc directory:<br />

chmod 600 hosts.equiv<br />

You can also use Tripwire (http://sourceforge.net/projects/<br />

tripwire) to monitor these files and alert you when access is obtained or<br />

changes are made.<br />

Assessing the Security of NFS<br />

The Network File System (NFS) is used to mount remote file systems (similar<br />

to shares in Windows) from the local machine. Given the remote access<br />

nature of NFS, it certainly has its fair share of hacks. I cover additional storage<br />

vulnerabilities and hacks in Chapter 15.<br />

NFS hacks<br />

If NFS was set up improperly or its configuration has been tampered with —<br />

namely, the /etc/exports file containing a setting that allows the world<br />

to read the entire file system — remote hackers can easily obtain remote<br />

access and do anything they want on the system. Assuming no access control<br />

list (ACL) is in place, all it takes is a line, such as the following, in the /etc/<br />

exports file:<br />

/ rw<br />

This line says that anyone can remotely mount the root partition in a readwrite<br />

fashion. Of course, the following conditions must also be true:<br />

✓ The NFS daemon (nfsd) must be loaded, along with the portmap daemon<br />

that would map NFS to RPC.<br />

✓ The firewall must allow the NFS traffic through.<br />

✓ The remote systems that are allowed into the server running the NFS<br />

daemon must be placed into the /etc/hosts.allow file.<br />

This remote-mounting capability is easy to misconfigure. It’s often related to<br />

a Linux administrator’s misunderstanding of what it takes to share out the<br />

NFS mounts and resorting to the easiest way possible to get it working. After<br />

hackers gain remote access, the system is theirs.<br />

241

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!