Commit Graph

154 Commits (fff65c5e4013607adf8b464c37f2a7cb2228d532)

Author SHA1 Message Date
Jason Ish 482325e28b dns: add dns.query.name sticky buffer
This buffer is much like dns.query_name but allows for detection in both
directions.

Feature: #6497
2 years ago
Jason Ish 5f99abb0cb dns: add dns.answer.name keyword
This sticky buffer will allow content matching on the answer names.
While ansers typically only occur in DNS responses, we allow the buffer
to be used in request context as well as the request message format
allows it.

Feature: #6496
2 years ago
Victor Julien 53591702aa detect/bytemath: pass match ctx directly
Adjust includes to enable this.
2 years ago
Philippe Antoine 32cce122e1 detect: header_lowercase transform
Ticket: 6290
2 years ago
Sascha Steinbiss 0c55fe3515 detect: add mqtt.connect.protocolstring
Ticket:  OISF#6396
2 years ago
Jeff Lucovsky 1110a86cb9 detect/transform: Register case-change transforms
Issue: 6439
2 years ago
Philippe Antoine ab9b6e30b1 detect: adds flow integer keywords
Ticket: #6164

flow.pkts_toclient
flow.pkts_toserver
flow.bytes_toclient
flow.bytes_toserver
2 years ago
Jeff Lucovsky 2fd0025ede detect/file: Filehandler registration logic
Add file handler registration functions for consolidated file handling.

Issue: 4145
2 years ago
Victor Julien 9b09b29350 detect/fileext: reimplement based on file.name
Ticket: #6194.
2 years ago
Philippe Antoine 415b036dca http1: implement http.request_header
So that it is generic for HTTP1 and HTTP2

Ticket: #5780
2 years ago
Victor Julien b31ffde6f4 output: remove error codes from output 3 years ago
Jason Ish 8683154115 templates: remove C app-layer templates 3 years ago
Eric Leblond 7e516aad94 detect: add ip.src keyword
It is a sticky buffer matching on src_ip.

Feature: #5383
3 years ago
Eric Leblond 9cb06d4376 detect/smb: add smb.ntlmssp_domain keyword
Feature #5411.
3 years ago
Eric Leblond 69ef1bc194 detect/smb: add smb.ntlmssp_user keyword
Feature #5411.
3 years ago
Philippe Antoine 390cf9248f detect: adds flow.age keyword
Ticket: #5536
3 years ago
Victor Julien 682e2a07fe detect/tls: add tls.cert_chain_len keyword 3 years ago
Victor Julien e250ef6402 debug: remove empty header 3 years ago
Philippe Antoine 5ef259722b dhcp: adds renewal-time keyword
Ticket: #5507
3 years ago
Philippe Antoine 6faf6299e0 dhcp: adds rebinding-time keyword
Ticket: #5506
3 years ago
Shivani Bhardwaj 42c3f418c6 tls: add tls.random* keywords
Add tls.random keyword that matches on the 32 bytes of the TLS
random field for client as well as server.
Add tls.random_time keyword that matches on the first 4 bytes of the TLS
random field for client as well as server.
Add tls.random_bytes keyword that matches on the last 28 bytes of the TLS
random field for client as well as server.

All these are sticky buffers.

Feature 5190
3 years ago
Philippe Antoine 461725a9bf dhcp: adds leasetime keyword
As it is logged

Ticket: #5435
3 years ago
Philippe Antoine 5c7b5c5fb5 krb: detection for ticket encryption
As is done for logging.

Ticket: #5442
3 years ago
Philippe Antoine 02f2602dde src: rework includes as per cppclean 3 years ago
Philippe Antoine c7214be99b snmp: adds usm keyword
as is logged

Ticker: #5416
3 years ago
Victor Julien e02b52c895 quic: add quic.ua for matching user agent 4 years ago
Victor Julien da8b024b99 detect/quic: add quic.sni sticky buffer 4 years ago
Emmanuel Thompson 7e51987263 quic: Add QUIC App Layer
Parses quic and logs a CYU hash for gquic frames
4 years ago
Philippe Antoine 0cfdec1266 detect: xor transform
Ticket: 3285

The xor transform applies xor decoding to a buffer, with a key
specified as an option in hexadecimal. Arbitrary key sizes are
accepted.
4 years ago
Victor Julien a492d94826 detect/frames: implement 'frame' keyword
Implement a special sticky buffer to select frames for inspection.

This keyword takes an argument to specify the per protocol frame type:

    alert <app proto name> ... frame:<specific frame name>

Or it can specify both in the keyword:

    alert tcp ... frame:<app proto name>.<specific frame name>

The latter is useful in some cases like http, where "http" applies to
both HTTP and HTTP/2.

    alert http ... frame:http1.request;
    alert http1 ... frame:request;

Examples:

    tls.pdu
    smb.smb2.hdr
    smb.smb3.data

Consider a rule like:

    alert tcp ... flow:to_server; content:"|ff|SMB"; content:"some smb 1 issue";

this will scan all toserver TCP traffic, where it will only be limited by a port,
depending on how rules are grouped.

With this work we'll be able to do:

    alert smb ... flow:to_server; frame:smb1.data; content:"some smb 1 issue";

This rule will only inspect the data portion of SMB1 frames. It will not affect
any other protocol, and it won't need special patterns to "search" for the
SMB1 frame in the raw stream.
4 years ago
Sascha Steinbiss e2dbdd7fd5 ikev1: add ikev1 parser 4 years ago
Eric Leblond 0dba1b09de suricata: improve list keywords
Exit with error if a keyword is not supported or not existing
and display a message.
5 years ago
Jeff Lucovsky dabd50eeee detect: Register icmpv4 header 5 years ago
Philippe Antoine 1422b18a99 http2: initial support 5 years ago
Sascha Steinbiss c31360070b rust/mqtt: add MQTT parser 5 years ago
Philippe Antoine 1569f3e349 transform: adds url_decode keyword
Fixes https://redmine.openinfosecfoundation.org/issues/2689

Adds a new source file to handle this keyword.
And modifies documentation, Makefile, and registration accordingly.

url_decode decodes url-encoded data, ie replacing '+' with space
and '%HH' with its value.
5 years ago
Victor Julien 6ab323d323 detect: hide RegisterTests behind ifdef UNITTESTS
Update all callers to more aggressively use UNITTESTS guards as well.
5 years ago
Victor Julien 2145cf99a3 detect/config: initial version 5 years ago
Jeff Lucovsky fb409664d2 detect: byte_math support 5 years ago
Vadym Malakhatko 216a75c522 detect: add (mpm) hassh keywords
Match on Hassh using ssh.hassh, ssh.hassh.server, ssh.hassh.string, ssh.hassh.server.string keywords, e.g:

alert ssh any any -> any any (msg:"match SSH hash"; ssh.hassh; content:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; sid:1000010;)
alert ssh any any -> any any (msg:"match SSH hash-server"; ssh.hassh.server; content:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; sid:1000020;)
alert ssh any any -> any any (msg:"match SSH hash-string"; ssh.hassh.string; content:"none,zlib@openssh.com,zlib"; sid:1000030;)
alert ssh any any -> any any (msg:"match SSH hash-server-string"; ssh.hassh.server.string; content:"umac-64-etm@openssh.com,umac-128-etm@openssh.com,"; sid:1000040;)
5 years ago
Jeff Lucovsky a0b81b3c9d detect: Register pcrexform
This commit registers the `pcrexform` transform.
5 years ago
Victor Julien 26bcc97515 detect/keywords: dynamic version part of doc URL 5 years ago
Frank Honza 1c8943dedd add RFB parser
This commit adds support for the Remote Framebuffer Protocol (RFB) as
used, for example, by various VNC implementations. It targets the
official versions 3.3, 3.7 and 3.8 of the protocol and provides logging
for the RFB handshake communication for now. Logged events include
endpoint versions, details of the security (i.e. authentication)
exchange as well as metadata about the image transfer parameters.
Detection is enabled using keywords for:

 - rfb.name: Session name as sticky buffer
 - rfb.sectype: Security type, e.g. VNC-style challenge-response
 - rfb.secresult: Result of the security exchange, e.g. OK, FAIL, ...

The latter could be used, for example, to detect brute-force attempts
on open VNC servers, while the name could be used to map unwanted VNC
sessions to the desktop owners or machines.

We also ship example EVE-JSON output and keyword docs as part of the
Sphinx source for Suricata's RTD documentation.
5 years ago
Philippe Antoine 1cd314c500 detect: adds icmpv6.mtu keyword 5 years ago
Philippe Antoine 8396333493 detect: adds icmpv6.hdr keyword 5 years ago
Giuseppe Longo e06291922f detect/sip.response_line: add sticky buffer
Matches on response line field in SIP.
6 years ago
Giuseppe Longo 17de4a8023 detect/sip.request_line: add sticky buffer
Matches on request line field in SIP.
6 years ago
Giuseppe Longo 8939ece538 detect/sip.stat_msg: add sticky buffer
Matches on status msg field in SIP.
6 years ago
Giuseppe Longo bd2219cac6 detect/sip.stat_code: add sticky buffer
Matches on status code field in SIP.
6 years ago
Giuseppe Longo 8454122eb2 detect/sip.protocol: add sticky buffer
Matches on protocol field in SIP.
6 years ago
Giuseppe Longo 2661c5b298 detect/sip.uri: add sticky buffer
Matches on uri field in SIP.
6 years ago
Giuseppe Longo 424eead8c0 detect/sip.method: add sticky buffer
Matches on uri field in SIP.
6 years ago
Jason Ish d79c23baa3 dns/detect: dns.opcode keyword
Add a rule keyword, dns.opcode to match on the opcode flag
found in the DNS request and response headers.

Only exact matches are allowed with negation.

Examples:
  - dns.opcode:4;
  - dns.opcode:!1;
6 years ago
Jeff Lucovsky 7808b946e3 detect/transform: add dotprefix keyword 6 years ago
Victor Julien 317376f59d datasets: match on lists of data
Datasets are sets/lists of data that can be accessed or added from
the rule language.

This patch implements 3 data types:

1. string (or buffer)
2. md5
3. sha256

The patch also implements 2 new rule keywords:

1. dataset
2. datarep

The dataset keyword allows matching against a list of values to see if
it exists or not. It can also add the value to the set. The set can
optionally be stored to disk on exit.

The datarep support matching/lookups only. With each item in the set a
reputation value is stored and this value can be matched against. The
reputation value is unsigned 16 bit, so values can be between 0 and 65535.

Datasets can be registered in 2 ways:

1. through the yaml
2. through the rules

The goal of this rules based approach is that rule writers can start using
this without the need for config changes.

A dataset is implemented using a thash hash table. Each dataset is its own
separate thash.
6 years ago
Victor Julien 24f0092b72 detect: add ipv6.hdr sticky buffer
Inspects IPv6 header and extension headers.
6 years ago
Victor Julien 4ac327f5b5 detect/ipv4: add ipv4.hdr sticky buffer 6 years ago
Victor Julien ac694b089a detect: add udp.hdr sticky buffer 6 years ago
Victor Julien bdf53f449c detect/tcp: rename tcp keyword files 6 years ago
Victor Julien 35be8385eb detect: tcp.hdr sticky buffer
Sticky buffer to inspect the TCP header.
6 years ago
Victor Julien 66648df099 detect: add tcp.mss keyword
Allows matching on TCP option MSS.

Syntax:

    tcp.mss:<value>;
    tcp.mss:<value1>-<value2>;
    tcp.mss:<op><value>;

Operator can be: >, <.
6 years ago
Pierre Chifflier 9dfec7e734 SNMP: add the "snmp.pdu_type" detection keyword 6 years ago
Pierre Chifflier e1dd19a0eb SNMP: add the "snmp.community" detection keyword 6 years ago
Pierre Chifflier aa608e0ca2 SNMP: add the "snmp.version" detection keyword 6 years ago
Mats Klepsland 0b489f329c detect: add (mpm) keyword ja3s.string
Match on JA3S string using ja3s.string keyword, e.g:

  alert tls any any -> any any (msg:"ja3s.string test";
      ja3s.string; content:"10-11-12"; sid:1;)
6 years ago
Mats Klepsland 80cee50916 detect: add (mpm) keyword ja3s.hash
Match on JA3S hash using ja3s.hash keyword, e.g:

  alert tls any any -> any any (msg:"ja3s.hash test";
      ja3s.hash; content:"b26c652e0a402a24b5ca2a660e84f9d5"; sid:1;)
6 years ago
Mats Klepsland ba857e9739 detect: add tls.certs keyword
Add keyword to do "raw" matching on each of the certificates in the
TLS certificate sticky buffer.

Example:
  alert tls any any -> any any (msg:"tls.certs test"; tls.certs; \
          content:"|01 02 03 04|"; sid:1;)
6 years ago
Victor Julien 84da0376fb detect/http.host: rename file for consistency 6 years ago
Victor Julien ccdafe6697 detect/http-server-body: move tests to tests/ 7 years ago
Victor Julien 64987f36fb detect/file-data: move tests into tests/ 7 years ago
Victor Julien 9a8092249e detect/http-client-body: move tests into tests/ 7 years ago
Victor Julien 76fd666cad detect/http_raw_header: move tests into tests/ 7 years ago
Victor Julien ab027cb481 detect/http_cookie: move tests into tests/ 7 years ago
Victor Julien 2f342da048 detect/http_stat_code: move tests into tests/ 7 years ago
Victor Julien 5dfba01b2e detect/http_stat_msg: move tests to tests/ 7 years ago
Victor Julien b469938998 detect/http_raw_host: move raw into regular host logic 7 years ago
Victor Julien dc43f35427 detect/http_host: move tests into tests/ 7 years ago
Victor Julien cb332b4cda detect/http_method: move all tests into tests/ 7 years ago
Victor Julien 0a405e27a0 detect/http_raw_uri: code reorganization
Move registration into http_uri logic, move tests into the other uri
tests. Switch to v2 mpm/inspect APIs.
7 years ago
Victor Julien 10e2731f18 detect/http-uri: move tests into tests/ 7 years ago
Victor Julien 3111910fc6 detect/http_user_agent: move tests into tests/ 7 years ago
Victor Julien 33b81f7439 detect: add verbosity of --list-keywords
Add indicators of content modifier or sticky buffer, and also
allow registering an alternative to a keyword.
7 years ago
Victor Julien eb73008ccf detect/transform: add to_sha1 keyword 7 years ago
Victor Julien 75f9c1ae9f detect/transform: add to_md5 keyword 7 years ago
Victor Julien ecb5d6419b rules/transform: add to list-keywords 7 years ago
Jason Ish 35fd10bc2e rust: app-layer detect template for rust parsers 7 years ago
Victor Julien 486054595a detect/template2: template with prefilter (copy of ttl) 7 years ago
Victor Julien af6f52cc09 rules: hide 'template' from --list-keywords 7 years ago
Victor Julien b0577402b6 rules: hide internal keywords from --list-keywords 7 years ago
Pierre Chifflier 1076c7cd47 Add krb5_err_code detection keyword 7 years ago
Pierre Chifflier d6b9c0294a Add krb5_cname and krb5_sname detection keywords 7 years ago
Pierre Chifflier 0bd81ff838 Add krb5_msg_type detection keyword 7 years ago
Mats Klepsland 6e23ae230b detect: add (mpm) keyword ja3_string
Match on JA3 string using ja3_string keyword, e.g:

alert tls any any -> any any (msg:"JA3 string test";
        ja3_string; content:"65-68-69-102"; sid:1;)
7 years ago
Mats Klepsland 6c7aacce9e detect: add (mpm) keyword ja3_hash
Match on JA3 hash using ja3_hash keyword, e.g:

alert tls any any -> any any (msg:"JA3 hash test";
        ja3_hash;
        content:"e7eca2baf4458d095b7f45da28c16c34";
        sid:1;)
7 years ago
Victor Julien 75d7c9d64a rust/smb: initial support
Implement SMB app-layer parser for SMB1/2/3. Features:
- file extraction
- eve logging
- existing dce keyword support
- smb_share/smb_named_pipe keyword support (stickybuffers)
- auth meta data extraction (ntlmssp, kerberos5)
7 years ago
Victor Julien 4d1fa4aaf9 detect: bsize keyword
Allows matching on stickybuffers. Like dsize, it allows matching on
exact values, greater than and less than, and ranges.

For streaming buffers, such as HTTP bodies, the final size of the
body is only known at the end of the transaction.
8 years ago
Victor Julien 7f97fc40d5 detect/transform: initial to_sha256 implementation
Takes input buffer and replaces it with hash value for that buffer.
Hash value is in raw bytes.
8 years ago
Victor Julien 016d65fdf8 detect/transform: initial compress_whitespace implementation 8 years ago
Victor Julien 38ed6cd050 detect/transform: initial strip_whitespace implementation 8 years ago
Victor Julien a499a44f7a detect: move buffer type map into detect ctx
Move previously global table into detect engine ctx. Now that we
can register buffers at rule loading time we need to take concurrency
into account.

Move DetectBufferType to detect.h and update DetectBufferCtx API calls
to include a detect engine ctx reference.
8 years ago