• Stars
    star
    325
  • Rank 129,350 (Top 3 %)
  • Language
  • Created almost 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Nmap&Zmap特征识别,绕过IDS探测

Nmap_Bypass_IDS

扫描参数:nmap -sS -sV -O -vv 1.1.1.1

nmap 系统识别绕过ids检测

nmap使用-O参数扫描时会发送tcp,udp,icmp 然后在根据响应的tcp window,TTL,IPID等对比指纹库识别操作系统,IDS识别nmap扫描一般都是根据UDP data区域填充的'C'字符串,ICMP填充的是0(正常windows下是a-z,Linux下是0-9)

alert udp $EXTERNAL_NET 10000: -> $HOME_NET 10000: (msg:"ET SCAN NMAP OS Detection Probe"; dsize:300; content:"CCCCCCCCCCCCCCCCCCCC"; fast_pattern:only; content:"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"; depth:255; content:"CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"; within:45; classtype:attempted-recon; sid:2018489; rev:3; metadata:created_at 2014_05_20, updated_at 2014_05_20;)

https://raw.githubusercontent.com/nmap/nmap/master/osscan2.cc

static u8 patternbyte = 0x43; /* character 'C' / 替换为 static u8 patternbyte = 0x46; / character 'F' */

nmap UA 修改

alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"ET SCAN Nmap Scripting Engine User-Agent Detected (Nmap Scripting Engine)"; flow:to_server,established; content:"Mozilla/5.0 (compatible|3b| Nmap Scripting Engine"; nocase; http_user_agent; depth:46; reference:url,doc.emergingthreats.net/2009358; classtype:web-application-attack; sid:2009358; rev:5; metadata:created_at 2010_07_30, updated_at 2010_07_30;)

修改nselib/http.lua

USER_AGENT = stdnse.get_script_args('http.useragent') or "Mozilla/5.0 (compatible; )"

TCP window 修改tcp window 窗口大小

nmap 默认扫描的tcp window size 大小是1024,将其修改为10240来绕过ids

alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"ET SCAN NMAP -sS window 1024"; fragbits:!D; dsize:0; flags:S,12; ack:0; window:1024; threshold: type both, track by_dst, count 1, seconds 60; reference:url,doc.emergingthreats.net/2009582; classtype:attempted-recon; sid:2009582; rev:3; metadata:created_at 2010_07_30, updated_at 2010_07_30;)

tcpip.cc:729: tcp->th_win = htons(1024); /* Who cares */

if (window)

tcp->th_win = htons(10240); /* Who cares */

修改nmap-service-probes

alert tcp $EXTERNAL_NET any -> $HOME_NET $HTTP_PORTS (msg:"ET SCAN NMAP SIP Version Detect OPTIONS Scan"; flow:established,to_server; content:"OPTIONS sip|3A|nm SIP/"; depth:19; classtype:attempted-recon; sid:2018317; rev:1; metadata:created_at 2014_03_25, updated_at 2014_03_25;)

-Probe TCP SIPOptions q|OPTIONS sip:nm SIP/2.0\r\nVia: SIP/2.0/TCP nm;branch=foo\r\nFrom: sip:nm@nm;tag=root\r\nTo: sip:nm2@nm2\r\nCall-ID: 50000\r\nCSeq: 42 OPTIONS\r\nMax-Forwards: 70\r\nContent-Length: 0\r\nContact: sip:nm@nm\r\nAccept: application/sdp\r\n\r\n|

去掉OPTIONS sip

修改3389 cookie

nmap-service-probes
Probe TCP TerminalServerCookie q|\x03\0\0*%\xe0\0\0\0\0\0Cookie: mstshash=nmap\r\n\x01\0\x08\0\x03\0\0\0|
nselib/rdp.lua
local cookie = "mstshash=nmap"

Zmap识别

很多网络扫描器会使用固定的tcp window或者ipid,这些都可以作为特征识别的一部分。
例如在使用zmap扫描时,通过抓包分析发现zmap使用了固定的IPID 54321以及固定的window值 65535,那么我可以写一个IDS规则来检测它

alert tcp any any -> any any (msg:"Detect ZMAP scan"; dsize:0; flags:S; window:65535; id:54321; threshold: type both, track by_src, count 60, seconds 60; sid:19010201; rev:1; metadata:created_at 2019_01_02, by al0ne;)

alert 是记录告警日志, tcp $EXTERNAL_NET any -> $HOME_NET any 这些对应着协议 源ip 源端口 方向 目标ip 目标端口,这里是匹配任意ip和任意端口, dsize代表tcp data区大小扫描时没有附加其他数据所以为0,flags:S 是指tcp的flags为s即三次握手时syn请求,并且计算阀值60秒内出现60才告警

修改绕过
src/probe_modules/packet.c

tcp_header->th_win = htons(65535);
iph->ip_id = htons(54321);

More Repositories

1

Vxscan

python3写的综合扫描工具,主要用来存活验证,敏感文件探测(目录扫描/js泄露接口/html注释泄露),WAF/CDN识别,端口扫描,指纹/服务识别,操作系统识别,POC扫描,SQL注入,绕过CDN,查询旁站等功能,主要用来甲方自测或乙方授权测试,请勿用来搞破坏。
Python
1,731
star
2

LinuxCheck

Linux应急处置/信息搜集/漏洞检测工具,支持基础配置/网络流量/任务计划/环境变量/用户信息/Services/bash/恶意文件/内核Rootkit/SSH/Webshell/挖矿文件/挖矿进程/供应链/服务器风险等13类70+项检查
Shell
1,726
star
3

suricata-rules

Suricata IDS rules 用来检测红队渗透/恶意行为等,支持检测CobaltStrike/MSF/Empire/DNS隧道/Weevely/菜刀/冰蝎/挖矿/反弹shell/ICMP隧道等
1,102
star
4

nginx_log_check

Nginx日志安全分析脚本
Shell
430
star
5

suricata_optimize

Suricata安装部署&丢包优化&性能调优&规则调整&Pfring设置
138
star
6

MacCheck

一个Mac下信息搜集小脚本 主要用于信息搜集/应急响应/检测挖矿进程/异常进程/异常启动项
Shell
74
star
7

init.sh

Linux 环境部署脚本,一键配置系统设置,安装常用工具/开发环境/渗透测试工具等
Shell
50
star
8

cloud-audit

cloud-audit (云安全审计助手)是检测公有云厂商AK/SK泄漏被利用的工具,通过定期调用云平台接口审计日志,基于异常行为/黑特征/基线发现疑似入侵行为。
Python
27
star
9

PyReverseShell

Python3 Reverse Shell
Python
13
star
10

suricata-script

ids状态监控的一个小脚本 主要是查看丢包,告警等
10
star
11

Bro-ELK

将bro日志输出到elk里面
9
star
12

fuck_honeypot

识别Mysql/Redis蜜罐并获取Mysql蜜罐读取的文件
3
star
13

al0ne

2
star