Commit graph

45 commits

Author SHA1 Message Date
Ivan Nardi
3e5491fa10
Add detection of OCSP (#1370)
This protocol is detected via HTTP Content-Type header.

Until 89d548f9, nDPI had a dedicated automa (`content_automa`) to
classify a HTTP flow according to this header. Since then, this automa has
been useless because it is always empty.
Re-enable it to match only a string seems overkilling.

Remove all `content_automa` leftovers.
2021-11-11 12:36:55 +01:00
Ivan Nardi
55880e4ae4
TLS: fix two warnings (#1365)
Disable unit tests on CI for big-endian target. We know we have multiple
issues on big-endian architectures (see #1312) and so the unit tests
always fail there. Ignore this error for the time being and let the CI
pass if we don't have other issues.

Remove an unused automa definition
2021-11-02 22:08:15 +01:00
Ivan Nardi
8db8c8ae34
Fix QUIC log and remove SoulSeek leftovers after b97dc6ba (#1351)
Update .gitignore file
Fix a function prototype
Close #1349
2021-10-19 21:42:55 +02:00
Ivan Nardi
730c2360bd
Remove struct ndpi_packet_struct from struct ndpi_flow_struct (#1319)
There are no real reasons to embed `struct ndpi_packet_struct` (i.e. "packet")
in `struct ndpi_flow_struct` (i.e. "flow"). In other words, we can avoid
saving dissection information of "current packet" into the "flow" state,
i.e. in the flow management table.

The nDPI detection module processes only one packet at the time, so it is
safe to save packet dissection information in `struct ndpi_detection_module_struct`,
reusing always the same "packet" instance and saving a huge amount of memory.
Bottom line: we need only one copy of "packet" (for detection module),
not one for each "flow".

It is not clear how/why "packet" ended up in "flow" in the first place.
It has been there since the beginning of the GIT history, but in the original
OpenDPI code `struct ipoque_packet_struct` was embedded in
`struct ipoque_detection_module_struct`, i.e. there was the same exact
situation this commit wants to achieve.

Most of the changes in this PR are some boilerplate to update something
like "flow->packet" into something like "module->packet" throughout the code.
Some attention has been paid to update `ndpi_init_packet()` since we need
to reset some "packet" fields before starting to process another packet.

There has been one important change, though, in ndpi_detection_giveup().
Nothing changed for the applications/users, but this function can't access
"packet" anymore.
The reason is that this function can be called "asynchronously" with respect
to the data processing, i.e in context where there is no valid notion of
"current packet"; for example ndpiReader calls it after having processed all
the traffic, iterating the entire session table.

Mining LRU stuff seems a bit odd (even before this patch): probably we need
to rethink it, as a follow-up.
2021-10-05 15:49:52 +02:00
Nardi Ivan
017c1a4239 FTP: fix support for START-TLS sessions
When TLS-over-FTP is used, the credentials are encrypted. So we must not
wait for the username and the password commands, otherwise we elaborate a
lot of packets for nothing.
2021-09-21 20:53:04 +02:00
Ivan Nardi
227e586e63
A (tiny) effort to reduce memory usage per flow (#1304)
Follow-up of 22241a1d
Only trivial changes:
* remove completely unused fields
* remove fields only written (but never read)
* CSGO protocol only handles UDP traffic
2021-09-18 09:29:45 +02:00
deboracerretini
8f113c1d37
Progetto esame Gestione di Reti - Debora Cerretini (#1290)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
2021-09-17 11:01:50 +02:00
Vitaly Lavrov
22241a1d36
Removing unused fields from the id_struct structure. (#1293)
Reduced by 40 bytes.
2021-09-13 18:19:09 +02:00
Luca Deri
00857abf2c Added new risk for clear text credentials 2021-09-10 22:00:04 +02:00
Ivan Nardi
9e0f0ce3df
Fix access to some TLS fields in flow structure (#1277)
Fields 'tls.hello_processed` and `tls.subprotocol_detected` are used by
QUIC (i.e UDP...), too.
2021-08-20 18:11:37 +02:00
Luca Deri
0df8aa19ec Clode cleanup (after last merge) 2021-08-08 17:10:08 +02:00
Luca Deri
4183718952 Added TLS fatal alert flow risk 2021-08-07 19:40:44 +02:00
Toni
29ec34f66d
Improved TFTP detection. Fixes #1242, #1256 (#1262)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-07-25 21:54:19 +02:00
Luca Deri
bf318e0b86 Added NDPI_DESKTOP_OR_FILE_SHARING_SESSION flow risk 2021-04-11 14:42:27 +02:00
Toni
b040407683
Refactored nDPI subprotocol handling and aimini protocol detection. (#1156)
* Refactored and merged callback buffer routines for non-udp-tcp / udp / tcp / tcp-wo-payload.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Try to detect one subprotocol if a detected protocol can have one.

 * This adds a performance overhead due to much more protocol detection routine calls.
   See #1148 for more information.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Refactor subprotocol handling (1/2).

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Refactor subprotocol handling (2/2).

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Prevent some code duplication by using macros for ndpi_int_one_line_struct string comparision.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Refactored aimini HTTP detection parts (somehow related to #1148).

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Added aimini client/server test pcap.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>

* Removed master protocol as it was only used for STUN and via also removed API function ndpi_get_protocol_id_master_proto

 * Adjusted Python code to conform to the changes made during the refactoring process.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-03-23 11:46:12 +01:00
Ivan Nardi
8c0ea694f8
HTTP: fix user-agent parsing (#1124)
User-agent information is used to try to detect the user OS; since the
UA is extracted for QUIC traffic too, the "detected_os" field must be
generic and not associated to HTTP flows only.

Otherwise, you might overwrite some "tls_quic_stun" fields (SNI...) with
random data.

Strangely enough, the "detected_os" field is never used: it is never
logged, or printed, or exported...
2021-02-03 11:54:11 +01:00
Luca Deri
aa5486f5f8 Added missing library 2021-01-22 09:31:37 +01:00
Luca Deri
05d76525b0 Added HTTP suspicious content securirty risk (useful for tracking trickbot) 2021-01-02 21:11:42 +01:00
Toni
656323c334
Added missing files to `make dist' target which are not required to build nDPI but still somehow essential. (#1024)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-29 17:58:33 +02:00
Luca Deri
60a9f6610d Added risks for checking
- invalid DNS traffic (probably carrying exfiltrated data)
- TLS traffic with no SNI extension
2020-09-21 19:57:23 +02:00
aouinizied
4cc4efa228 Update example. 2020-09-14 16:42:33 +02:00
Luca Deri
638624869a Added new risk for NDPI_UNSAFE_PROTOCOL that identifies protocols that are not condidered safe/secure 2020-08-30 20:48:58 +02:00
aouinizied
8c2c388d54 Add Connectivity check category and blacklisted host risk. 2020-08-10 21:19:17 +02:00
Nardi Ivan
79b89d2866 Add risk flag about suspicious ESNI usage
In a Client Hello, the presence of both SNI and ESNI may obfuscate the real
domain of an HTTPS connection, fooling DPI engines and firewalls, similarly
to Domain Fronting.

Such technique is reported in a presentation at DEF CON 28:
"Domain Fronting is Dead, Long Live Domain Fronting: Using TLS 1.3 to evade
censors, bypass network defenses, and blend in with the noise"
Full credit for the idea must go the original author

At the moment, the only way to get the pdf presention and related video is via
https://forum.defcon.org/node/234492
Hopefully a direct link (and an example pcap) will be available soon
2020-08-05 17:13:23 +02:00
aouinizied
57e28e03ee Sync TLS definitions. 2020-08-01 01:27:29 +02:00
aouinizied
c4b19fd6c5 Update CFFI definitions. 2020-07-29 12:31:21 +02:00
MrRadix
88dd3ebd62 added modified risks 2020-07-22 12:41:59 +02:00
MrRadix
53b2b08aeb added new risks to ndpi_risk_enum 2020-07-22 10:56:59 +02:00
aouinizied
e2e0303099 Add ssl_version_str to flow structure. 2020-07-13 12:48:35 +02:00
aouinizied
ce02359953 Add NDPI_MALFORMED_PACKET risk. 2020-07-09 00:56:44 +02:00
aouinizied
4247dd8322 Synchronize type definitions. 2020-06-12 22:58:58 +02:00
aouinizied
e5c2c400ef Update APIs and structures. 2020-05-22 23:48:54 +02:00
Zied Aouini
1bee9d85a4
Fix flow_printer example. 2020-04-15 08:05:03 +02:00
Zied Aouini
dcb6fde0c9 Update Python cffi bindings. 2020-02-21 17:28:44 +01:00
MrTiz9
daa1171593 nDPI now detect RCE in HTTP GET requests 2020-01-24 17:16:18 +01:00
Zied Aouini
cffb11fbc9 Update ndpi_flow_struct definition. 2019-12-23 11:22:23 +01:00
aouinizied
a95cfcc989 Implement cffi bindings. 2019-11-28 03:09:13 +01:00
aouinizied
82a186e096 Polish. 2019-11-15 19:30:50 +01:00
aouinizied
e467fe9aa6 Improve python bindings. 2019-11-15 19:18:30 +01:00
Luca Deri
f2a5bbef17 Reworked categories handling
Removed GenericProtocol and replaced with categories
Removed ndpi_pref_enable_category_substring_match option: substring matching is now default
2019-09-29 21:46:41 +02:00
bohmax
02609114d3
Add files via upload 2019-09-29 11:10:46 +02:00
Luca Deri
19dbcaa3a9 Fixes #777 2019-09-23 18:04:55 +02:00
bohmax
8246467022
Add files via upload 2019-09-23 17:40:34 +02:00
bohmax
90c28e9d63
Delete ndpi_typestruct.py 2019-09-23 17:40:16 +02:00
Luca Deri
f0013e826e Added python bindings for nDPI 2019-09-15 22:32:18 +02:00