Metadata over network

Hi all,

Recently gotten into Zeek and throughly enjoying all the learning all that comes with it bit-by-bit.

I have an unusual problem I am trying to solve and haven’t figured it out over a couple of days of testing - forgive me if this is basic stuff.

I want to send network traffic that contains some meta-data that I can populate into a Zeek log and parse on my SIEM. I have a couple of options I think would make sens:

HTTP Post and use the data in the headers

DNS Query with the data in each of the levels: info1.info2.info3.info4.something.net

What I’m struggling to do is the following:

Log the client side of the http headers

Capture any failed DNS Queries

Now, these will always be produced from a specific IP address / subnet, but there are many constraints such as VLAN segregation etc, so I can’t simply use port 514 to direct the logs easily to a “collector” so hence why I am trying to capture this data on the wire and have Zeek send it.

Any thoughts on how I might achieve this, whether it’s even catching this data via a custom script, it would be much appreciated.

Hi!

That’s a fun use case. If I may ask — what’s the purpose of the information you’re trying to send?Are you trying to “annotate” other activity in Zeek logs? Or perhaps drop some general notes, like network admin steps taken at a given point in time?

Regarding your questions:

  • The client side of HTTP headers is visible in http.log’s id fields, via id.orig_h and id.orig_p. Is that what you mean, or do you mean fuller logging of the headers? Take a look at policy/protocols/http/header-names.zeek, which might get you closer to that.

  • Failed DNS queries are visible in dns.log — look for the rcode and rcode_name fields. A nonexistent name will yield 3 / NXDOMAIN, for example.

If you’re mainly looking for a way to make your “annotations” easier to spot in the logs, I’d pick a unique TLD in DNS, or perhaps a unique user-agent in HTTP.

There are also ways to do this more “properly”. With a websocket client that talks to Zeek and a bit of scripting you could push messages to your own log. The reporter_info event might actually suffice for that if you’d be okay with consuming the existing reporter.log for that purpose. We’d need to understand a little better what you’re trying to do.

Let us know if that’s heading in the right direction,
Christian

For arbitrary HTTP request headers, the built-in HTTP log only records a fixed set such as host, URI, method, user agent and referrer; custom headers need a script that handles the http_header event and writes selected name/value pairs to a dedicated log stream. For DNS, filter on the sender’s id.orig_h and check rcode/rcode_name for NXDOMAIN. Also be aware that DNS caching or middleboxes can prevent every query from appearing on the wire, so HTTP may be more reliable for per-event metadata.