libnids在有些机器上无法审计

参考文档:

http://blog.csdn.net/xieqb/article/details/7676839

http://blog.csdn.net/zhoujunyi/article/details/1710953

http://gaozhongliang328.blog.163.com/blog/static/98539492008592234752/

http://www.360doc.com/content/11/0124/10/1317564_88646459.shtml

http://www.cnpaf.net/Class/winpcap/200810/23011.html

网上能找到的文档就这几篇。在此做一下参考。


我的机器无线审计tcp协议没有问题,有线审计有问题,跟踪代码是ip和tcp校验出了问题。

libnids.c287行和tcp.c608行校验的时候如果不是0就直接返回,如果是第一个包,校验值为0,所以校验后肯定不是0。

增加代码判断如下

if (len < (int)sizeof(struct ip) || iph->ip_hl < 5 || iph->ip_v != 4 ||
ip_fast_csum((unsigned char *) iph, iph->ip_hl) != 0 ||
len < ntohs(iph->ip_len) || ntohs(iph->ip_len) < iph->ip_hl << 2) {
if (iph->ip_sum != 0 ){
nids_params.syslog(NIDS_WARN_IP, NIDS_WARN_IP_HDR, iph, 0);
return;
}
}

if (my_tcp_check(this_tcphdr, iplen - 4 * this_iphdr->ip_hl,
this_iphdr->ip_src.s_addr, this_iphdr->ip_dst.s_addr)) {
if ( this_iphdr->ip_sum != 0 )
{
nids_params.syslog(NIDS_WARN_TCP, NIDS_WARN_TCP_HDR, this_iphdr,this_tcphdr);
return;
}
}

在我本机调试没有问题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值