suricata http.request_body 和 http_client_body 的区别? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
hack2xia
V2EX    信息安全

suricata http.request_body 和 http_client_body 的区别?

  •  
  •   hack2xia 2023-01-03 16:39:29 +08:00 1373 次点击
    这是一个创建于 1015 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我现在的工作是写入侵检测规则,suricata 关于 http 协议关键字部分也好好看了,但依然有问题不太懂。 官方手册 v6.0.9 中章节 6.12.20 中指出: http.request_body replaces the previous keyword name: http_client_body. You may continue +to use the previous name, but it’s recommended that rules be converted to use +the new name. 实际上,我测试了一下,似乎不能直接替代:

    # 没问题 alert http any any -> any any (msg:"Victure WR1200 系统命令执行漏洞 (CVE-2021-43283)"; flow:to_server,established; content:"password="; http_client_body; nocase; sid:650013; rev:1; gid:879013; priority:4;) # 单纯只是把上面的 http_client_body 替换成了 http.request_body 报 error:nocase needs preceding content option # 翻译过来是:nocase 需要前面的内容选项 alert http any any -> any any (msg:"Victure WR1200 系统命令执行漏洞 (CVE-2021-43283)"; flow:to_server,established; content:"password="; http.request_body; nocase; sid:650014; rev:1; gid:879014; priority:4;) # 如果把 nocase 放到 content 的后面。报 error:rule 650015 setup buffer http_client_body but didn't add matches to it # 翻译过来是:规则 650015 设置缓冲区 http_client_body 但没有添加匹配项 alert http any any -> any any (msg:"Victure WR1200 系统命令执行漏洞 (CVE-2021-43283)"; flow:to_server,established; content:"password="; nocase; http.request_body; sid:650015; rev:1; gid:879015; priority:4;) # 如果把 http.request_body 放到 content 的前面,无报错 alert http any any -> any any (msg:"Victure WR1200 系统命令执行漏洞 (CVE-2021-43283)"; flow:to_server,established; http.request_body; content:"password="; nocase; sid:650016; rev:1; gid:879016; priority:4;) 

    所以,我感觉 http_client_body 是 content modifier ,而 http.request_body 是 sticky buffer 。 不知道我的理解对不对?

    5 条回复    2023-01-03 17:31:04 +08:00
    lambdaq
        1
    lambdaq  
       2023-01-03 17:01:13 +08:00
    盲猜一个解码了一个没解码
    daxin945
        2
    daxin945  
       2023-01-03 17:11:45 +08:00
    抛转引玉了
    我个人理解 是不同的 suricata 版本支持的 Snort 规则版本不同 本质上都是指的请求体 但是具体的细节没太抠过
    在实际写 Snort 的时候 我习惯于用 http_client_body suricata 版本 6.0.4
    hack2xia
        3
    hack2xia  
    OP
       2023-01-03 17:21:13 +08:00
    我也主要用的 http_client_body 。
    但有时候可能会有点问题,比如:
    content:"balabala";http_client_body;pcre:/<regex>/iPR;
    由于 R 的存在,它类似于 distance:0 ,pcre 这里要和前面在同一个 sticky buffer 。上面的规则会报错。
    http.request_body;content:"balabala";pcre:/<regex>/iPR;
    则不会报错。
    当然,不写 R 应该是没问题的。
    hack2xia
        5
    hack2xia  
    OP
       2023-01-03 17:31:04 +08:00   1
    上面链接的问题,看到有人回答:
    Removed 'http_client_body' because we have 'http.request_body' in Suricata 5.0. Also, if you did want to use 'http_client_body', it would come after the content in which you're hoping to match. 'http.request_body' is a sticky buffer so all content following it are considered to be part of that buffer
    从他的意思来看,我的理解应该没问题
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1041 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 29ms UTC 18:35 PVG 02:35 LAX 11:35 JFK 14:35
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86