![]() |
|
Stealth Port Scanning using Nmap - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Hacking (https://sinister.ly/Forum-Hacking) +--- Forum: Tutorials (https://sinister.ly/Forum-Tutorials) +--- Thread: Stealth Port Scanning using Nmap (/Thread-Stealth-Port-Scanning-using-Nmap) |
Stealth Port Scanning using Nmap - lady_godiva - 07-21-2014 Hi everybody,
Today i am going to show you how to perform a stealth port scan using Nmap Why: when performing a penetration test, we need to emulate the attacker as much as possible. Most of the attacker will use these stealth techniques for a lower detection rate chance or to bypass firewall. In order for our penetration test results to be accurate, these techniques should be used too when performing the Information Gathering step. Introduction: In order to perform stealthy port scan, we must violate the RFC (Request for comments), which means sending malformed TCP packets. Take a look at the TCP packet structure: ![]() What we are going to do is sending a TCP packet with particular combinations of URG, ACK, PSH, RST, SYN, FIN. These 6 fields are single bit fields and they are used when estabilishing a connection (3 way handshake) and when closing it (URG and PSH to manage connection). For those who don't know: URG = Urgent (not very used), ACK = Acknowledgment, PSH = Push (used to manage packets), RST = Reset, SYN = Synchronization packet (used to initiate the 3 way hanshake), FIN = Finish. Setting particular combinations of these flags, we can get the host to tell us wether a certain port is opened or not. Types of scans:
Bypass Firewall: different techniques can be used to ATTEMPT bypassing firewall. One of the best attempts would be to split the TCP packets in more packets, making detection harder as packets have to be reassembled. In order to perform this technique just use the -f option: Code: nmap -f "scan_type" "target_ip_address"This is a very long and complex topic, which i can't fully cover in a single post. This example is just to give a small idea. General Notes:
I hope you found this thread useful, if you have to thank me just use the thanks button so that i don't get notified about thanking posts and can stay focused on answering questions (if any). RE: Stealth Port Scanning using Nmap - Mst0P - 07-21-2014 Great thread! I think the fragmentation of packets will be caught by most modern firewalls(I know you used it as a simple example but I just wanted to point it out). As far as I know this method used to be quite effective some time ago. The topic of firewall evasion is complex and very interesting so I understand why you don't want to go into it here. I was wondering, though, do you have any plans on making a tutorial on firewall evasion? I find this topic very interesting but I couldn't find much about it while searching the forum. Firewall bypass could go extremely well with the information in here. RE: Stealth Port Scanning using Nmap - lady_godiva - 07-21-2014 (07-21-2014, 12:05 PM)Mst0P Wrote: Great thread! I think the fragmentation of packets will be caught by most modern firewalls(I know you used it as a simple example but I just wanted to point it out). As far as I know this method used to be quite effective some time ago. Yes, firewall evasion techniques keep changing, so it's really hard to find a technique that works no matter what. I was thinking about making a thread talking about firewall evasion so i think i'll soon begin to prepare this but i will probably be assuming that the reader knows different types of firewall and how they work as this would be too long to explain every single firewall. You are right about packet fragmentation, but just like all the other options it depends on firewall configuration. It's really common to find bad or outdated configuration so, depending on who you are pentesting, they might work or not! RE: Stealth Port Scanning using Nmap - h3r0 - 07-21-2014 Great tutorial and great explanation on SYN, ACK, FIN, and XMAS techniques. Only issue I have with the tut is in the general notes you used the word "namp" instead of "nmap". You have the same typo again in your "Bypass Firewall" section. s/namp/nmap/g |