Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyword to match on 'raw' TLS certificates #3542

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions doc/userguide/rules/tls-keywords.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@ Usage::

tls_cert_valid;

tls_cert
--------

Do a "raw" match on the TLS certificate. This keyword only matches on the
first certificate in the certificate chain.

Example::

alert tls any any -> any any (msg:"match bytes in TLS cert"; tls_cert; \
content:"|06||09||2a||86|"; sid:200070;)

``tls_cert`` is a 'Sticky buffer'.

``tls_cert`` can be used as ``fast_pattern``.

tls.version
-----------

Expand Down
1 change: 1 addition & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ detect-tls-cert-issuer.c detect-tls-cert-issuer.h \
detect-tls-cert-subject.c detect-tls-cert-subject.h \
detect-tls-cert-serial.c detect-tls-cert-serial.h \
detect-tls-cert-fingerprint.c detect-tls-cert-fingerprint.h \
detect-tls-cert.c detect-tls-cert.h \
detect-dsize.c detect-dsize.h \
detect-engine.c detect-engine.h \
detect-engine-address.c detect-engine-address.h \
Expand Down
2 changes: 2 additions & 0 deletions src/detect-engine-register.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "detect-engine-uri.h"
#include "detect-dns-query.h"
#include "detect-tls-sni.h"
#include "detect-tls-cert.h"
#include "detect-tls-cert-fingerprint.h"
#include "detect-tls-cert-issuer.h"
#include "detect-tls-cert-subject.h"
Expand Down Expand Up @@ -432,6 +433,7 @@ void SigTableSetup(void)
DetectTlsSubjectRegister();
DetectTlsSerialRegister();
DetectTlsFingerprintRegister();
DetectTlsCertRegister();

DetectTlsJa3HashRegister();
DetectTlsJa3StringRegister();
Expand Down
1 change: 1 addition & 0 deletions src/detect-engine-register.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ enum {

DETECT_AL_DNS_QUERY,
DETECT_AL_TLS_SNI,
DETECT_AL_TLS_CERT,
DETECT_AL_TLS_CERT_ISSUER,
DETECT_AL_TLS_CERT_SUBJECT,
DETECT_AL_TLS_CERT_SERIAL,
Expand Down
Loading