亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sp_asn1_detect.c

?? 著名的入侵檢測系統snort的最新版本的源碼
?? C
字號:
/* $Id$ *//* ** Copyright (C) 2002-2006 Sourcefire, Inc. ** Author: Daniel Roelker ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License Version 2 as ** published by the Free Software Foundation.  You may not use, modify or ** distribute this program under any other version of the GNU General ** Public License. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//****  @file        sp_asn1_detect.c****  @author      Daniel Roelker <droelker@sourcefire.com>** **  @brief       Decode and detect ASN.1 types, lengths, and data.****  This detection plugin adds ASN.1 detection functions on a per rule**  basis.  ASN.1 detection plugins can be added by editing this file and**  providing an interface in the configuration code.**  **  Detection Plugin Interface:****  asn1: [detection function],[arguments],[offset type],[size]****  Detection Functions:****  bitstring_overflow: no arguments**  double_overflow:    no arguments**  oversize_length:    max size (if no max size, then just return value)****  alert udp any any -> any 161 (msg:"foo"; \**      asn1: oversize_length 10000, absolute_offset 0;)****  alert tcp any any -> any 162 (msg:"foo2"; \**      asn1: bitstring_overflow, oversize_length 500, relative_offset 7;)******  Note that further general information about ASN.1 can be found in**  the file doc/README.asn1.*/#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <sys/types.h>#include <stdlib.h>#include <ctype.h>#ifndef SF_SNORT_ENGINE_DLL#include "debug.h"#else/* Ignore debug statements */#include <stdint.h>#define DEBUG_WRAP(x)#endif#include "../sfutil/asn1.h"#include "sp_asn1_detect.h"#define BITSTRING_OPT  "bitstring_overflow"#define DOUBLE_OPT     "double_overflow"#define LENGTH_OPT     "oversize_length"#define DBL_FREE_OPT   "double_free"#define ABS_OFFSET_OPT "absolute_offset"#define REL_OFFSET_OPT "relative_offset"#define PRINT_OPT      "print"#define ABS_OFFSET 1#define REL_OFFSET 2#define DELIMITERS " ,\t\n"extern const u_int8_t *doe_ptr;/* * Check to make sure that p is less than or equal to the ptr range * pointers * * 1 means it's in bounds, 0 means it's not */static int inBounds(const u_int8_t *start, const u_int8_t *end, const u_int8_t *p){    if(p >= start && p < end)    {        return 1;    }        return 0;}/***  NAME**    BitStringOverflow::*//****  The neccessary info to detect possible bitstring overflows.  Thanks**  once again to microsoft for keeping us in business.****  @return integer****  @retval 0 failed**  @retval 1 detected*/static int BitStringOverflow(ASN1_TYPE *asn1, void * user){    if(!asn1)        return 0;    /*    **  Here's what this means:    **    **  If the ASN.1 type is a non-constructed bitstring (meaning that    **  there is only one encoding, not multiple encodings).  And    **  the number of bits to ignore (this is taken from the first byte)    **  is greater than the total number of bits, then we have an    **  exploit attempt.    */    if(asn1->ident.tag == SF_ASN1_TAG_BIT_STR && !asn1->ident.flag)    {        if(asn1->len.size && asn1->data &&            (((asn1->len.size - 1)<<3) < (unsigned int)asn1->data[0]))        {            return 1;        }    }    return 0;}/***  NAME**    DetectBitStringOverflow::*//****  This is just a wrapper to the traverse function.  It's important because**  this allows us to do more with individual nodes in the future.****  @return integer****  @retval 0 failed**  @rteval 1 detected*/static int DetectBitStringOverflow(ASN1_TYPE *asn1){    return asn1_traverse(asn1, NULL, BitStringOverflow);}/***  NAME**    DoubleOverflow::*//****  This is the info to detect double overflows.  This may not be a**  remotely exploitable (remote services may not call the vulnerable**  microsoft function), but better safe than sorry.****  @return integer****  @retval 0 failed**  @retval 1 detected*/static int DoubleOverflow(ASN1_TYPE *asn1, void *user){    if(!asn1)        return 0;    /*    **  Here's what this does.    **    **  There is a vulnerablity in the MSASN1 library when decoding    **  a double (real) type.  If the encoding is ASCII (specified by    **  not setting bit 7 or 8), and the buffer is greater than 256,    **  then you overflow the array in the function.    */    if(asn1->ident.tag == SF_ASN1_TAG_REAL && !asn1->ident.flag)    {        if(asn1->len.size && asn1->data &&           ((asn1->data[0] & 0xc0) == 0x00) &&            (asn1->len.size > 256))        {            return 1;        }    }    return 0;}/***  NAME**    DetectDoubleOverflow::*//****  This is just a wrapper to the traverse function.  It's important because**  this allows us to do more with individual nodes in the future.****  @return integer****  @retval 0 failed**  @rteval 1 detected*/static int DetectDoubleOverflow(ASN1_TYPE *asn1){    return asn1_traverse(asn1, NULL, DoubleOverflow);}/***  NAME**    OversizeLength::*//****  This is the most generic of our ASN.1 detection functionalities.  This**  will compare the ASN.1 type lengths against the user defined max**  length and alert if the length is greater than the user supplied length.**  **  @return integer****  @retval 0 failed**  @retval 1 detected*/static int OversizeLength(ASN1_TYPE *asn1, void *user){    unsigned int *max_size;    if(!asn1 || !user)        return 0;    max_size = (unsigned int *)user;    if(*max_size && *max_size <= asn1->len.size)        return 1;    return 0;}/***  NAME**    DetectOversizeLength::*//****  This is just a wrapper to the traverse function.  It's important because**  this allows us to do more with individual nodes in the future.****  @return integer****  @retval 0 failed**  @rteval 1 detected*/static int DetectOversizeLength(ASN1_TYPE *asn1, unsigned int max_size){    return asn1_traverse(asn1, (void *)&max_size, OversizeLength);}/***  NAME**    Asn1DetectFuncs::*//****  The main function for adding ASN.1 detection type functionality.****  @return integer****  @retval 0 failed**  @retval 1 detected*/static int Asn1DetectFuncs(ASN1_TYPE *asn1, ASN1_CTXT *ctxt, int dec_ret_val){    int iRet = 0;    /*    **  Print first, before we do other detection.  If print is the only    **  option, then we want to evaluate this option as true and continue.    **  Otherwise, if another option is wrong, then we     */    if(ctxt->print)    {        asn1_traverse(asn1, NULL, asn1_print_types);        iRet = 1;    }    /*    **  Let's check the bitstring overflow.    */    if(ctxt->bs_overflow)    {        iRet = DetectBitStringOverflow(asn1);        if(iRet)            return 1;    }    if(ctxt->double_overflow)    {        iRet = DetectDoubleOverflow(asn1);        if(iRet)            return 1;    }    if(ctxt->length)    {        iRet = DetectOversizeLength(asn1, ctxt->max_length);        /*        **  If we didn't detect any oversize length in the decoded structs,        **  that might be because we had a really overlong length that is        **  bigger than our data type could hold.  In this case, it's         **  overlong too.        */        if(!iRet && dec_ret_val == ASN1_ERR_OVERLONG_LEN)            iRet = 1;        /*        **  We add this return in here, so that we follow suit with the        **  previous detections.  Just trying to short-circuit any future        **  problems if we change the code flow here.        */        if(iRet)            return 1;    }    return iRet;}/***  NAME**    Asn1DoDetect::*//****  Workhorse detection function.  Does not depend on OTN.**  We check all the offsets to make sure we're in bounds, etc.****  @return integer****  @retval 0 failed**  @retval 1 detected*/int Asn1DoDetect(const u_int8_t *data, u_int16_t dsize, ASN1_CTXT *ctxt, const u_int8_t *rel_ptr){    ASN1_TYPE *asn1;    int iRet;    unsigned int size;    const u_int8_t *start;    const u_int8_t *end;    const u_int8_t *offset = NULL;    /*    **  Failed if there is no data to decode.    */    if(!data)        return 0;    start = data;    end   = start + dsize;    switch(ctxt->offset_type)    {        case REL_OFFSET:            if(!rel_ptr)            {                DEBUG_WRAP(DebugMessage(DEBUG_ASN1, "[*] No rel_ptr for "                           "relative offset, so we are bailing.\n"););                return 0;            }                                       /*            **  Check that it is in bounds first.            */            if(!inBounds(start, end, rel_ptr))            {                DEBUG_WRAP(DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "                           "check failed for rel_ptr.\n"););                return 0;            }            if(!inBounds(start, end, rel_ptr+ctxt->offset))            {                DEBUG_WRAP(DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "                           "check failed rel_ptr+offset.\n"););                return 0;            }            offset = rel_ptr+ctxt->offset;            break;        case ABS_OFFSET:        default:            if(!inBounds(start, end, start+ctxt->offset))            {                DEBUG_WRAP(DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "                           "check failed.\n"););                return 0;            }            offset = start+ctxt->offset;            break;    }    /*    **  Final Check.  We are good to go now.    */    if(!inBounds(start,end,offset))    {        DEBUG_WRAP(DebugMessage(DEBUG_ASN1, "[*] ASN.1 bounds "                   "check failed.\n"););        return 0;    }    /*    **  Set size for asn1_decode().  This should never be -1 since    **  we do the previous in bounds check.    */    size = end - offset;    iRet = asn1_decode(offset, size, &asn1);    if(iRet && !asn1)    {        DEBUG_WRAP(DebugMessage(DEBUG_ASN1, "[*] ASN.1 decode failed "                   "miserably.\n"););        return 0;    }    /*    **  Let's do detection now.    */    return Asn1DetectFuncs(asn1, ctxt, iRet);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线这里只有精品| 国产精品网友自拍| 中文字幕欧美国产| 五月天激情综合| 成人深夜视频在线观看| 555www色欧美视频| 亚洲欧美一区二区三区极速播放| 蜜臀99久久精品久久久久久软件| 一本一道综合狠狠老| 久久精品亚洲麻豆av一区二区 | 国产精品美女久久久久久久| 亚洲成人午夜电影| 色婷婷国产精品| 国产午夜三级一区二区三| 麻豆精品视频在线| 欧美日韩三级在线| 亚洲综合色丁香婷婷六月图片| 懂色av一区二区在线播放| 欧美va亚洲va在线观看蝴蝶网| 无吗不卡中文字幕| 欧美视频在线不卡| 亚洲欧美中日韩| 成人精品视频一区| 国产精品日产欧美久久久久| 国产老肥熟一区二区三区| 欧美大白屁股肥臀xxxxxx| 奇米在线7777在线精品 | 日韩成人免费在线| 99久久国产综合精品女不卡| 中文字幕免费在线观看视频一区| 国产真实乱子伦精品视频| 欧美一级免费大片| 久久99国产乱子伦精品免费| 日韩一级免费观看| 久久国产精品99久久久久久老狼| 日韩一二三四区| 久久精品二区亚洲w码| 精品国一区二区三区| 精品一区二区三区日韩| 久久久99久久| 成人av在线观| 亚洲午夜久久久久久久久电影网 | 日韩精品一区二区三区在线观看 | 91老司机福利 在线| 亚洲美女电影在线| 欧美丝袜自拍制服另类| 日韩av中文字幕一区二区| 欧美tk丨vk视频| 国产suv精品一区二区6| 亚洲区小说区图片区qvod| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 亚洲宅男天堂在线观看无病毒| 欧美日精品一区视频| 日产国产高清一区二区三区| 精品美女被调教视频大全网站| 极品销魂美女一区二区三区| 国产色婷婷亚洲99精品小说| 成人黄色软件下载| 亚洲一二三区视频在线观看| 精品久久久久久无| 91蝌蚪porny| 热久久国产精品| 国产精品欧美精品| 欧美电影在哪看比较好| 欧美性受xxxx| 裸体在线国模精品偷拍| 欧美国产一区视频在线观看| 欧美区视频在线观看| 成人一级片在线观看| 日日噜噜夜夜狠狠视频欧美人 | 欧美绝品在线观看成人午夜影视| 国产一区91精品张津瑜| 亚洲精品成a人| 久久久欧美精品sm网站| 欧美亚洲综合一区| 国产精品66部| 奇米四色…亚洲| 日韩美女视频一区二区| 日韩视频免费观看高清完整版| 粉嫩久久99精品久久久久久夜| 亚洲123区在线观看| 国产精品人人做人人爽人人添| 欧美精品18+| 91蜜桃在线观看| 国产一区激情在线| 婷婷成人激情在线网| 亚洲欧洲日本在线| 精品国产一区二区三区av性色| 99久精品国产| 成人手机在线视频| 精品制服美女久久| 视频在线观看91| 一区二区三区在线观看视频| 国产欧美日韩精品一区| 欧美一级高清大全免费观看| 欧美色男人天堂| 色美美综合视频| 成人激情视频网站| 色综合婷婷久久| 风流少妇一区二区| 日本不卡一区二区| 午夜欧美在线一二页| 一区二区三区四区五区视频在线观看| 国产日韩影视精品| 久久久久久电影| 精品国产髙清在线看国产毛片 | 91福利国产精品| www.日本不卡| jlzzjlzz欧美大全| 成人黄色片在线观看| 风流少妇一区二区| 岛国精品在线播放| 成人涩涩免费视频| 99re热这里只有精品免费视频| 成人亚洲一区二区一| 国产·精品毛片| 成人高清视频在线| 91在线视频观看| 91麻豆精品视频| 欧美色图在线观看| 欧美片网站yy| 日韩欧美一级二级三级久久久| 日韩欧美区一区二| 久久日一线二线三线suv| 国产婷婷色一区二区三区四区| 久久久久久久久久美女| 国产精品久久久久精k8| 亚洲人一二三区| 亚洲综合色成人| 久久精品久久精品| 国产精品一区二区在线观看网站| 成人午夜视频网站| 日本丶国产丶欧美色综合| 美女视频免费一区| 奇米影视一区二区三区小说| 韩国女主播成人在线观看| 成人免费高清视频在线观看| 91免费版pro下载短视频| 欧美在线|欧美| 日韩区在线观看| 国产精品三级av| 国产精品99久久久| 91美女片黄在线| 日韩一区二区三区视频在线观看| 国产欧美日本一区视频| 一区二区三区在线视频观看58| 免费不卡在线观看| 成人av在线一区二区| 51精品国自产在线| 国产精品丝袜久久久久久app| 国产精品成人免费在线| 日韩国产欧美三级| 成人激情小说乱人伦| 欧美三级电影在线看| 精品福利视频一区二区三区| 亚洲视频一区二区免费在线观看| 日韩精品91亚洲二区在线观看| 狠狠色综合色综合网络| 波波电影院一区二区三区| 欧美日韩在线播| 国产欧美久久久精品影院| 午夜精品久久久久久久蜜桃app| 国产精品一二二区| 欧美肥妇bbw| 亚洲免费在线观看视频| 精品亚洲欧美一区| 欧美日韩免费视频| 中文字幕一区免费在线观看 | 亚洲丝袜美腿综合| 韩国三级中文字幕hd久久精品| 91麻豆国产在线观看| 国产亚洲污的网站| 日韩高清不卡一区二区| 91国产成人在线| 国产精品日日摸夜夜摸av| 国模大尺度一区二区三区| 欧美日韩国产不卡| 亚洲日本一区二区三区| 国产成人欧美日韩在线电影 | 欧美日韩二区三区| 国产精品国产三级国产aⅴ入口 | 99久久国产免费看| 久久综合狠狠综合久久综合88 | 日韩欧美国产1| 午夜伦欧美伦电影理论片| 日本韩国精品一区二区在线观看| 中文字幕欧美激情| 国产成人午夜视频| 久久精品视频一区| 国产综合色视频| 久久综合五月天婷婷伊人| 麻豆传媒一区二区三区| 欧美电影在哪看比较好| 天堂在线一区二区| 欧美日本在线看| 三级久久三级久久| 日韩欧美国产综合在线一区二区三区 | 6080yy午夜一二三区久久| 亚洲一区二区视频| 欧美日韩免费一区二区三区|