<div dir="ltr">I applied the patch in the source code directory patch < 0001-Add-support-for-a-new-keyword-to-inspect-http_host-h.patch<div><br></div><div>and ran the tests with the new alert rules and the following wireshark filter:</div>
<div><br></div><div style>http.host contains "<a href="http://businessweek.com">businessweek.com</a>" && ip.src == 192.168.32.136</div><div style><br></div><div style>and after visiting the website, I had 28 results in wireshark</div>
<div style><br></div><div style>fast.log had 56 lines</div><div style>28 were from the http_host rule</div><div style>28 were from the pcre rule</div><div style><br></div><div style>so far everything looks good. From Brian's response, if it's true that hostname can appear elsewhere and not in the http header, that would be a problem but unfortunately I do not know enough on that field and will be reading up on it. All I can say for now is the patch appears to work as intended.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 25, 2013 at 8:19 AM, Anoop Saldanha <span dir="ltr"><<a href="mailto:anoopsaldanha@gmail.com" target="_blank">anoopsaldanha@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Try this patch out(you can apply the patch using "git am -3 <patch>")<br>
<br>
It introduces a new keyword + pcre modifier that would inspect just<br>
the host header.<br>
<br>
The keyword being "http_host" and the pcre modifier being "W"<br>
<br>
You can now use it in a rule like this -<br>
<div class="im"><br>
alert ip $HOME_NET any -> any any (msg:"pcre version rule fired";<br>
</div>pcre:"/\.<a href="http://businessweek.com/W" target="_blank">businessweek.com/W</a>"; sid:1;)<br>
<div class="im">alert ip $HOME_NET any -> any any (msg:"http header rule fired";<br>
</div>content:".<a href="http://businessweek.com" target="_blank">businessweek.com</a>"; http_host; sid:2;)<br>
<br>
Let me know how it works with the above rules.<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Jan 25, 2013 at 8:47 AM, Anoop Saldanha <<a href="mailto:anoopsaldanha@gmail.com">anoopsaldanha@gmail.com</a>> wrote:<br>
> On Thu, Jan 24, 2013 at 10:29 PM, Vincent Fang <<a href="mailto:vincent.y.fang@gmail.com">vincent.y.fang@gmail.com</a>> wrote:<br>
>> Here's the new results, I will run the tests again to see if it's consistent<br>
>> but using the wireshark filter<br>
>><br>
>> http contains "<a href="http://businessweek.com" target="_blank">businessweek.com</a>"<br>
>><br>
>> there were 75 matches<br>
>><br>
>> and in the fast.log there were 138 total alerts from the two new rules you<br>
>> specified<br>
>> grep -c "http header" fast.log -> 69 lines<br>
>> grep -c "pcre version" fast.log -> 69 lines<br>
>><br>
>> so they're both the same. Ran suricata in offline mode and the results were<br>
>> the same so that's good since they're consistent.<br>
>><br>
>> Here's a copy of the two rules<br>
>><br>
>> alert ip $HOME_NET any -> any any (msg:"pcre version rule fired";<br>
>> pcre:"/\s.*?\.<a href="http://businessweek.com/H" target="_blank">businessweek.com/H</a>"; sid:1;)<br>
>><br>
>> alert ip $HOME_NET any -> any any (msg:"http header rule fired";<br>
>> content:".<a href="http://businessweek.com" target="_blank">businessweek.com</a>"; http_header; sid:2;)<br>
>><br>
>> In the next few runs I also plan to change the protocol to http instead of<br>
>> ip, and I technically should get the same numbers yes?<br>
>><br>
><br>
> Yes, you should.<br>
><br>
> Keep in mind that the above rules can also match on other headers<br>
> containing <a href="http://businessweek.com" target="_blank">businessweek.com</a>, for example the referer header.<br>
><br>
>><br>
>> On Thu, Jan 24, 2013 at 9:44 AM, Anoop Saldanha <<a href="mailto:anoopsaldanha@gmail.com">anoopsaldanha@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Sound good. Will open a feature request for "http_host" keyword;<br>
>>><br>
>>> On Thu, Jan 24, 2013 at 7:45 PM, Matt <<a href="mailto:matt@somedamn.com">matt@somedamn.com</a>> wrote:<br>
>>> > I would find that useful, especially if it increases efficiency in the<br>
>>> > same<br>
>>> > way as http_user_agent. Among other things, I use Suricata to match<br>
>>> > blacklists of known bad URLs, and all those rules include a content<br>
>>> > match<br>
>>> > for the HTTP Host.<br>
>>> ><br>
>>> > Matt<br>
>>> ><br>
>>> > On 1/24/2013 3:13 AM, Peter Manev wrote:<br>
>>> ><br>
>>> ><br>
>>> ><br>
>>> > On Thu, Jan 24, 2013 at 9:11 AM, Anoop Saldanha<br>
>>> > <<a href="mailto:anoopsaldanha@gmail.com">anoopsaldanha@gmail.com</a>><br>
>>> > wrote:<br>
>>> >><br>
>>> >> On Thu, Jan 24, 2013 at 1:37 PM, Peter Manev <<a href="mailto:petermanev@gmail.com">petermanev@gmail.com</a>><br>
>>> >> wrote:<br>
>>> >> ><br>
>>> >> >> However, any of the techniques mentioned above isn't a foolproof way<br>
>>> >> >> to match on the host header. The right way would be to provide a<br>
>>> >> >> new<br>
>>> >> >> keyword called "http_host".<br>
>>> >> >><br>
>>> >> > Anoop or Vincent would you please put in feature request for that?<br>
>>> >> ><br>
>>> >><br>
>>> >> We should probably consult users/rule-writers if such a keyword would<br>
>>> >> be useful to them?<br>
>>> >><br>
>>> >> --<br>
>>> >> Anoop Saldanha<br>
>>> ><br>
>>> > sure<br>
>>> ><br>
>>> ><br>
>>> > --<br>
>>> > Regards,<br>
>>> > Peter Manev<br>
>>> ><br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Suricata IDS Users mailing list: <a href="mailto:oisf-users@openinfosecfoundation.org">oisf-users@openinfosecfoundation.org</a><br>
>>> > Site: <a href="http://suricata-ids.org" target="_blank">http://suricata-ids.org</a> | Support:<br>
>>> > <a href="http://suricata-ids.org/support/" target="_blank">http://suricata-ids.org/support/</a><br>
>>> > List:<br>
>>> > <a href="https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-users" target="_blank">https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-users</a><br>
>>> > OISF: <a href="http://www.openinfosecfoundation.org/" target="_blank">http://www.openinfosecfoundation.org/</a><br>
>>> ><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Anoop Saldanha<br>
>>> _______________________________________________<br>
>>> Suricata IDS Users mailing list: <a href="mailto:oisf-users@openinfosecfoundation.org">oisf-users@openinfosecfoundation.org</a><br>
>>> Site: <a href="http://suricata-ids.org" target="_blank">http://suricata-ids.org</a> | Support: <a href="http://suricata-ids.org/support/" target="_blank">http://suricata-ids.org/support/</a><br>
>>> List: <a href="https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-users" target="_blank">https://lists.openinfosecfoundation.org/mailman/listinfo/oisf-users</a><br>
>>> OISF: <a href="http://www.openinfosecfoundation.org/" target="_blank">http://www.openinfosecfoundation.org/</a><br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> Anoop Saldanha<br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Anoop Saldanha<br>
</font></span></blockquote></div><br></div>