# Spicy-http plugin returns protocol violation on WinRM traffic

**URL:** <https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359>\
**Category:** Zeek\
**Created:** [May 14, 2024, 12:50pm UTC](https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359 "2024-05-14T12:50:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![0x4A6F686E](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0x4A6F686E](https://community.zeek.org/u/0x4A6F686E)\
**Post date:** [May 14, 2024, 12:50pm UTC](https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359/1 "2024-05-14T12:50:20Z")

</div>

Hi there,

after upgrading from Zeek 6.0.1 to 6.0.3 on our test server last week, I also enabled some more spicy plugins with spicy\_http being one of them. It turns out that this spicy\_http plugin causes protocol violations on WinRM HTTP connections: _no matches found (/usr/local/zeek/var/lib/zkg/clones/package/spicy-http/analyzer/analyzer.spicy:102:58-103:68)_.

I have a very small pcap to reproduce this, but I do not want to file this in github because of the IP-addresses and names in it.

Can we handle this another way? Anyone interested?

Cheers, John

---

<div class="post-metadata">

**Author:** ![Benjamin\_Bannier](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/benjamin_bannier/32/595_2.png) [@Benjamin\_Bannier](https://community.zeek.org/u/Benjamin_Bannier)\
**Post date:** [May 15, 2024, 1:28pm UTC](https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359/2 "2024-05-15T13:28:55Z")

</div>

> I have a very small pcap to reproduce this, but I do not want to file this in github because of the IP-addresses and names in it.
> 
> Can we handle this another way? Anyone interested?

We are definitely interested. If you can identify an offending package from which you could extract the HTTP payload with e.g., Wireshark you might be able to share that. Alternatively reach out to us on Zeek Slack in `#spicy` or send me a private message here.

> I also enabled some more spicy plugins with spicy\_http being one of them.

Do you know why you are replacing Zeek’s built-in HTTP analyzer? I am asking since it is battle tested both in terms of robustness and performance, and the same is probably not true for spicy-http.

---

<div class="post-metadata">

**Author:** ![0x4A6F686E](https://avatars.discourse-cdn.com/v4/letter/0/b3f665/32.png) [@0x4A6F686E](https://community.zeek.org/u/0x4A6F686E)\
**Post date:** [May 16, 2024, 9:18am UTC](https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359/3 "2024-05-16T09:18:59Z")

</div>

Hi Benjamin,

thanks! I’ll contact you another way to give you the pcap.  
As for the spicy-http plugin, I was (apparently wrong) under the impression that the spicy plugins were the way to go. I already turned it off because I had the impression that I had way more worker crashes than before (compared to the builtin HTTP analyzer).

Cheers, John

---

<div class="post-metadata">

**Author:** ![Benjamin\_Bannier](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/benjamin_bannier/32/595_2.png) [@Benjamin\_Bannier](https://community.zeek.org/u/Benjamin_Bannier)\
**Post date:** [May 16, 2024, 9:38am UTC](https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359/4 "2024-05-16T09:38:23Z")

</div>

> [@0x4A6F686E](#):
>
> I had the impression that I had way more worker crashes than before (compared to the builtin HTTP analyzer).

That’s odd and definitely something we’d like to fix. Please feel free to open issues against the [repo for spicy-http](https://github.com/zeek/spicy-http). One of the goals of Spicy is to make writing parser for untrustworthy data safer by e.g., eliminating incorrect memory management which is a common source of problems in C or C++ code.

> [@0x4A6F686E](#):
>
> As for the spicy-http plugin, I was (apparently wrong) under the impression that the spicy plugins were the way to go.

We suggest defaulting to Spicy when implementing new custom parsers for above safety reasons. That safety however is not completely free in terms of runtime performance (part of this is intrinsic, and some of it could also come from not fully [optimizing the custom parser](https://docs.zeek.org/projects/spicy/en/latest/programming/guidelines.html)). For many more specialized protocols this is often not critical since the custom protocol might only make up a fraction of the full traffic volume. HTTP traffic on the other hand typically makes up a big part of the traffic volume a site sees, so while Zeek’s builtin HTTP analyzer is written in intrinsically less safe binpac/C++ it is much more optimized and refined from years of experience in parsing production traffic. Currently Zeek still uses the binpac/C++ HTTP parser as a default, so this is what we suggest.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Bannier](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.zeek.org/benjamin_bannier/32/595_2.png) [@Benjamin\_Bannier](https://community.zeek.org/u/Benjamin_Bannier)\
**Post date:** [May 22, 2024, 9:56am UTC](https://community.zeek.org/t/spicy-http-plugin-returns-protocol-violation-on-winrm-traffic/7359/5 "2024-05-22T09:56:50Z")

</div>

Just to close the loop, this is now tracked as

> <https://github.com/zeek/spicy-http/issues/10>
>
> If HTTP traffic contains Kerberos encrypted traffic it would have a \[header\](htt…ps://learn.microsoft.com/en-us/openspecs/windows\_protocols/ms-wsmv/b79927c2-96be-4801-aa68-180db95593f9) like
> 
> \`\`\`
> Content-Type: multipart/encrypted;protocol="application/HTTP-Kerberos-session-encrypted";boundary="Encrypted Boundary"
> \`\`\`
> 
> Our current parsing does not handle this. After stripping away the multipart prefix we end up with \`Message.content\_type\_parameter = b"protocol=\\"application/HTTP-Kerberos-session-encrypted\\";boundary=\\"Encrypted Boundary\\","\`. When trying to handle this in https://github.com/zeek/spicy-http/blob/48ce0b75dd615ae197050865a0d2cc8604f0ad89/analyzer/analyzer.spicy#L96-L104 we do not anticipate to see something before \`boundary\` so we match nothing; this cause a protocol violation when dereferencing \`boundary\` which has no value, https://github.com/zeek/spicy-http/blob/48ce0b75dd615ae197050865a0d2cc8604f0ad89/analyzer/analyzer.spicy#L103
> 
> Zeek's builtin HTTP analyzer does not handle this either and instead reports a weird
> 
> \`\`\`
> \#separator \\x09
> \#set\_separator ,
> \#empty\_field (empty)
> \#unset\_field -
> \#path weird
> \#open 2024-05-22-09-05-24
> \#fields name addl notice peer source
> \#types string string bool string string
> line\_terminated\_with\_single\_CR - F zeek CONTENTLINE
> \#close 2024-05-22-09-05-24
> \`\`\`
