37. Enumeration: NetBIOS, SMB, SNMP, LDAP, SMTP, NFS and DNS
37.6 NFS Enumeration
NFS (Network File System) – Linux file shares over the network. Portmapper 111, NFS 2049. Misconfigured export = remote folder mount, sometimes with write / root rights.
# What is exported? (Metasploitable classic finding)
showmount -e 192.168.56.20
rpcinfo -p 192.168.56.20
# If an export allows your IP – mount read-only first in lab
sudo mkdir -p /mnt/nfs-lab
sudo mount -t nfs -o ro,vers=3 192.168.56.20:/ /mnt/nfs-lab
ls -la /mnt/nfs-lab
sudo umount /mnt/nfs-lab
Risk: * world-readable exports, no_root_squash (remote root = local root – khup kharab). Sensitive keys/configs share madhe asu shaktat.
Defence: /etc/exports madhe specific IPs only; root_squash (default – theva); read-only where possible; firewall 111/2049; NFSv4 + Kerberos where needed; never export / or /etc to *. He lakshat theva.
Ravindra Bagale's Tip
Students see showmount -e succeed and directly mount the no_root_squash share and delete files. Even in the lab, mount read-only (-o ro) first. If it's a production finding, report + fix – don't destroy. Memorise the name root_squash – an interview favourite.
Ravindra Bagale's Tip – मराठी
Students showmount -e success बघून थेट no_root_squash mount करतात आणि files delete करतात. Lab मध्ये पण read-only (-o ro) आधी. Production finding असेल तर report + fix – destroy नको. root_squash नाव लक्षात ठेवा – interview favourite.
Ravindra Bagale's Tip – हिंदी
Students showmount -e success देखकर सीधे no_root_squash mount करते हैं और files delete कर देते हैं. Lab में भी read-only (-o ro) पहले. Production finding हो तो report + fix – destroy नहीं. root_squash नाम याद रखो – interview favourite.
Lab
showmount -e 192.168.56.20 chalaa. Export list note kara. Jar mount allow asel tar read-only mount karun 3 interesting files/folders note kara, mag umount. Aaplya notes madhe ek safe /etc/exports example liha: specific subnet + root_squash + ro.
Extended teaching notes
Why this lesson matters
Enumeration maps what a network exposes. Defenders use the same ideas to close shares, fix SNMP community strings, restrict LDAP binds and stop zone transfers.
Hardening related services
[('SSH', 'Key auth, no root login, Fail2ban or equivalent, SG limited to your IP/VPN.', '', ''), ('SMB / NFS / LDAP / SNMP', 'Do not expose to the internet; patch; strong auth; disable unused versions (e.g. SMBv1).', '', ''), ('SMTP', 'Authenticated relay only; SPF/DKIM/DMARC for your domains.', '', ''), ('DNS', 'Restrict zone transfers; monitor for unexpected records (crt.sh for certs).', '', ''), ('Firewalls', 'Host firewall + cloud SG/NSG; default deny; document every allow.', '', '')]
Lab rule
Run enumeration only against host-only lab VMs you own. Then write the defensive fix for each open service you found.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.