Commit Graph

12853 Commits (053b2b3b5b1197064bba5d59d4731c5789ff7239)
 

Author SHA1 Message Date
Eloy Pérez González 333db3b385 smb/dce_opnum: move range if to outer context
The smb dce_opnum matches all the opnums that are higher that the
indicated opnum. This is due the range comparison if was put in the
exact comparison context, and in case the opnum doesn't match exactly,
then the range comparison is triggered (the upper limit is always true).

Move the erroneus if to the outer context, as else option of the block
checks if comparison should be exact or range.

Ticket: 4767
3 years ago
Eloy Pérez González 8dca3d0416 smb/dce_opnum: use DCERPC_TYPE_REQUEST
The smb dce_opnum keyword doesn't match the dcerpc requests/responses.
This occurs because in the rs_smb_tx_match_dce_opnum function, the
x.req_cmd is matched against the erroneous code 1. Fix this by using
DCERPC_TYPE_REQUEST for the comparison instead.

Ticket: 4767
3 years ago
Eloy Pérez González 15f493f516 dcerpc: remove prev_tx_call_id and clear_bind_cache from DCERPCState
remove those fields since are not used because of the removal of
handle_bind_cache.
3 years ago
Eloy Pérez González 1aca2676a6 dcerpc: avoid delete the rpc state interface context
The bug:
The dcerpc dce_iface keyword just match the packet following the bind. Only the
next request after the rpc is sent will match. However the expected behaviour it
that all the rpc requests/responses sent under the context of the given
interface would match.

In the Open Group c706 the following is indicated:

In 2.2.1 Binding-related Operations, indicates that one category of binding
operations are those that "operations that establish internal call routing
information for the server." (The other are to establish the protocol which is
not relevant here). And the following statement can be found:

Operations in the second category establish a set of mappings that the server
can use to route calls internally to the appropriate manager routine. This
routing is based on the interface and version, operation and any object
requested by the call.

It indicates that server routes (to call methods) are based on the operation,
interface and object.

- Operation: To indicate the method to call, and operation number is
             specified as indicated in the second step of 2.3.3.2 (Client
             Binding Steps).
- Interface: An interface is a set of remotely callable operations offered by a
             server and invokable by clients. (2.1.1.1)
- Object: Is the manager that implements the interface, as stated in section
          Interface and Manager Selection of 2.3.3.3. It is not mandatory, can
          be nil.

To call a method, a client must send a request message as defined in 2.6.4.9,
that contains these identifiers:

- opnum: The opnum field identifies the operation being invoked within the
         interface.
- p_cont_id (Context ID in Wireshark): The p_cont_id field holds a presentation
                                       context identifier that identifies the
                                       data representation and interface, as
                                       defined in 12.6.3.4 (Context Identifiers).
- object: The object field is contained if the PFC_OBJECT_UUID is set. (Could be
          interesting to create a keyword dce_object for matching this UUID)

Therefore, to get the correct method to invoke, the server must map the context
to the correct interface. This is negotiated by the bind request

Interfaces are first negotiated using the bind message (12.6.4.3), contained in
the p_context_elem array. Then they are accepted or rejected using the bind_ack
message (12.6.4.4).

Once these contexts are established, both client and server can use the context
id, which is the index of the p_context_elem array, to refer the interface they
are using.

Moreover, in the middle of the connection, the context can be changed with the
alter_context message.

This is way suricata shouldn't delete the bindack attribute, that contains
the contexts, used by match_backuuid. This is the only way to know the interface
a request message is referring to.

ticket: 4769
https://redmine.openinfosecfoundation.org/issues/4769
3 years ago
Juliana Fajardini 0bf1227f0f pgsql: fix defect found by coverity
Pgsql was using bitwise operations to assign password output config to
its context flags, but mixing that with logic negation of the default
value, resulting in the expressions having a constant value as result.

Bug: #5007
3 years ago
Jason Ish 59ac1fe277 logging: change ownership of application log if needed
When running with privilege dropping, the application log file
is opened before privileges are dropped resulting in Suricata
failing to re-open the file for file rotation.

If needed, chown the application to the run-as user/group after
opening.

Ticker #4523
3 years ago
Jason Ish 08518df373 startup: initialize run as user info sooner
Initialize the run-as user info after loading the config, but
before setting up logging (previously it was done while initializing
signal handlers). This will allow the log file to be given the
correct permissions if Suricata is configured to run as a non-root
user.
3 years ago
Lukas Sismis f668524731 dpdk: adjust setting of MTU to the new DPDK API (21.11) 3 years ago
Jason Ish 7b44485b3b github-ci: use curl -L for npcap: follow redirects 3 years ago
Pierre Chifflier ce9efc34c7 rust/pgsql: convert parsers to nom7 functions 3 years ago
Philippe Antoine e8060990d1 detect: fix possible leak found by coverity
Conditions to create the leak are likely not reachable,
but this is still a bad pattern.
3 years ago
Catena cyber cc746b4594
ci: adds scorecard analysis GitHub workflow 3 years ago
Juliana Fajardini 579d7dcc01 pgsql: add initial support
- add nom parsers for decoding most messages from StartupPhase and
SimpleQuery subprotocols
- add unittests
- tests/fuzz: add pgsql to confyaml

Feature: #4241
3 years ago
Juliana Fajardini 4c743b809c rust/applayer: add function for upgrading to TLS 3 years ago
Shivani Bhardwaj 8918f53f6b smtp: use AppLayerResult instead of buffering
Also, remove tests that check for the removed buffers and any middle
states while parsing and buffering.

Ticket 4907
3 years ago
Victor Julien e02b52c895 quic: add quic.ua for matching user agent 3 years ago
Victor Julien 4c13b73c4d quic: log user agent when available 3 years ago
Victor Julien da8b024b99 detect/quic: add quic.sni sticky buffer 3 years ago
Victor Julien 7b836af1b2 quic: log sni; reduce number of transactions
Only create transactions for long headers.

Store SNI in tx, log it.
3 years ago
Victor Julien cf4ddab6f4 doc/quic: update for new quic.version logic 3 years ago
Victor Julien ccab28aad3 quic: log version as string
Log as Q043, Q044, Q045, Q046. If the version is not supported/recognized,
log the 4 bytes as hex.

Only log for txs based on long headers.
3 years ago
Victor Julien 24a21af4ab quic: redo quic.version; parser cleanups
Reimplement quic.version as sticky buffer.

Removed unused parts of the parser.

Set unidirectional tx flag to fix double matching.
3 years ago
Emmanuel Thompson 6641efb74f doc/quic: Add documentation for QUIC keywords 3 years ago
Emmanuel Thompson 9ad60e7661 doc/quic: Add quic to eve json format 3 years ago
Emmanuel Thompson 7e51987263 quic: Add QUIC App Layer
Parses quic and logs a CYU hash for gquic frames
3 years ago
Andreas Dolp f714484591 Doc: Fix typos in documentation of suricata.yaml. 3 years ago
Sam Muhammed c4bd3cd70e nfs4_records: add unittests
Add unittests for setclientid, readdir records
Task #4866
3 years ago
Pierre Chifflier c61cbd9b35 rust: simplify bits parser annotations 3 years ago
Pierre Chifflier 1b25bcbb13 rust/smb: simplify bits parser annotations 3 years ago
Pierre Chifflier 4d6aa6d532 rust: add 'bits' combinator to simplify nom bits parsers
Add a specialized version of the 'bits' nom combinator so adding
bits-level parsers does not require type annotations.
3 years ago
Philippe Antoine 23fb139e00 detect: do not upgrade base64 decode when fuzzing
As fuzzing will put a very big value, and then
ThreadCtxDoInit will try to allocate it,
ending in out of memory
3 years ago
Victor Julien ca29d33c69 proto-detect: set flags in packet direction for UDP 3 years ago
Victor Julien 449cc82943 proto-detect: fix UDP not setting alproto_ts/tc
This would lead to the `app-layer-protocol` keyword not matching correctly.
3 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.
3 years ago
Philippe Antoine 1d4fe38ccb detect: adds test with invalid uint mode << 3 years ago
Philippe Antoine 2012b14470 detect: use generic functions for icode parsing 3 years ago
Philippe Antoine e2370d6861 fuzz: cleans all flow after one run
Makes the fuzz target more stateless

And manages to find bugs on the FlowFree path
3 years ago
Philippe Antoine add1a0f561 fuzz: use parsed rules in sigpcap target
Ticket: 4125

As commit d21a252238
But for sigpcap target as well
3 years ago
Philippe Antoine 529678d501 dns: wrap with HAVE_LUA
This is just code style, to minimize the compiled code.
3 years ago
Philippe Antoine 6885b66883 fuzz: enable template protocols
Ticket: 4125
3 years ago
Philippe Antoine ed11e32076 enip: fix too restrictive check in probing parser
As is shown later in the code, enip_len can be
ENIP_LEN_REGISTER_SESSION which is 4, which is
smaller than sizeof(ENIPEncapHdr) which is 24
3 years ago
Philippe Antoine 09c84d0c26 fuzz: use fuzzing confyaml for protodetect target
As is done for other targets,
so that all app-layer protocols are enabled,
even the ones disabled by default such as enip

And resets protocol detection every time we try
so that probing_parser_toserver_alproto_masks are fresh.
3 years ago
Jason Ish cda11b8d97 doc/update: mention change of default rule path 3 years ago
Jason Ish 8071d8239e doc: update rule section to current default
Update the rule section to better describe whats seen in a default
install of Suricata including a link to the rule management section.
3 years ago
Jason Ish 9d7a497cc1 rule-path: always use $localstatedir/lib/suricata/rules
Always use the same path for default-rule-path whether or not
Suricata-Update will be installed as part of the Suricata install or
not.

This provides consistency, and maps better to our recommendation that
Suricata-Update be used to manage rules.

Probably should have been done as part of
55852d0de3.

Ticket #4912.
3 years ago
Victor Julien 44c9241b6a telnet: initial support with frames
Bootstrapped using setup script. Basic option parsing for purpose
of tagging frames.
3 years ago
Victor Julien fc4279de85 htp: improve request/response size accuracy 3 years ago
Victor Julien 52ad906d31 htp: implement basic request/response frames 3 years ago
Victor Julien af797b5926 ssl: implement frames for SSLv3 and TLS 3 years ago
Jason Ish 3cdefd5f8b smb: use derive AppLayerFrameType 3 years ago