Commit graph

513 commits

Author SHA1 Message Date
Ivan Nardi
ae48c8df7a Workaround for big-endian builds
Fix CI tests on big-endian builds.
We have a long-standing issue on big-endian archs: it might be related
to utash or about how we use utash in ndpiReader
2025-07-19 16:44:56 +02:00
Adrian Pekar
5f312c0cd6
Fix JA4 fingerprinting (#2915)
* Fix JA4 ALPN fingerprint to use first and last characters

According to the JA4 specification (line 2139), the ALPN field should
contain the first and last characters of the first ALPN extension value.

Currently, nDPI uses the first and second characters (alpn[0] and alpn[1]),
which produces incorrect fingerprints that don't match other JA4
implementations like Wireshark.

For example, with ALPN 'http/1.1':
- Current (incorrect): 'ht' (first + second char)
- Fixed (correct):     'h1' (first + last char)

This change ensures nDPI's JA4 implementation conforms to the official
specification and maintains interoperability with other JA4 tools.

Fixes: Incorrect JA4 ALPN fingerprint generation

* Fix JA4 ALPN implementation to correctly parse first ALPN protocol

The previous fix attempted to use strlen(ja->client.alpn)-1 but this was
insufficient because nDPI modifies the ALPN string by:
1. Adding null terminators that truncate the last character
2. Converting semicolons to dashes, affecting multi-protocol ALPNs

This complete fix:
- Adds alpn_original_last field to store the true last character
- Captures the last character of the FIRST ALPN protocol only (before ;/,)
- Preserves the original character before nDPI's string modifications

Now correctly implements JA4 spec: first + last characters of first ALPN protocol
Examples:
- ALPN 'h2;http/1.1' -> 'h2' (not 'h.' or 'h1')
- ALPN 'http/1.1' -> 'h1' (not 'ht' or 'h.')

Fixes: #2914

* Fix JA4 SNI detection to properly handle missing SNI extensions

Previously, nDPI incorrectly set JA4 SNI flag to 'd' (domain present) for
flows without any SNI extension. This was because the logic only checked
for NDPI_NUMERIC_IP_HOST risk (set when SNI contains IP) but didn't
distinguish between missing SNI and domain SNI.

Now properly detects:
- No SNI extension → 'i' flag
- SNI with IP address → 'i' flag
- SNI with domain → 'd' flag

This matches the JA4 specification.
2025-07-10 14:03:27 +02:00
Luca Deri
f8e1c6f346 Results update 2025-07-08 17:51:09 +02:00
kalinda
9efd3cfb33
Add Blacknut ,Boosteroid and Rumble protocol(SNI detection WIP) (#2907)
Co-authored-by: Ivan Nardi <nardi.ivan@gmail.com>
2025-07-03 21:41:17 +02:00
Toni
a913e914e5
Added EasyWeather protocol dissector (#2912)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2025-07-03 12:28:48 +02:00
Ivan Nardi
81ca06b0c7 websocket: ndpi_set_detected_protocol() should be called only once
Fix: b07a910dc
2025-07-02 08:28:11 +02:00
Ivan Nardi
43b60e3d7a
Rework classification in ndpi_match_host_subprotocol()-like functions (#2910) 2025-07-01 17:01:59 +02:00
Ivan Nardi
e5dbe83ecf Jabber: proper subclassification of TruPhone 2025-07-01 12:35:35 +02:00
Ivan Nardi
eb50750a3b Remove some hack for Google traffic in ndpi_reconcile_protocols() 2025-07-01 12:35:35 +02:00
Ivan Nardi
898135b2f7 Fix ndpi_reconcile_protocols with classification by port/ip 2025-07-01 12:35:35 +02:00
Ivan Nardi
ed1e6e2a39 Fix classification with nBPF rules 2025-07-01 12:35:35 +02:00
Ivan Nardi
86c591af6a
Bittorrent: update default ports (#2902) 2025-06-23 19:38:31 +02:00
Ivan Nardi
e0b14cc3fb
STUN: don't check NDPI_KNOWN_PROTOCOL_ON_NON_STANDARD_PORT flow risk (#2901) 2025-06-23 18:15:48 +02:00
Ivan Nardi
06a49b4086 ndpiReader: fix check on max number of packets per flow 2025-06-23 17:27:39 +02:00
Ivan Nardi
64ea82ce28 Viber: fix category 2025-06-23 17:15:24 +02:00
Ivan Nardi
5db40f7598
Classify Tracking/ADS/Analytics traffic only via category (#2900)
See 3a243bb40 for similar work about porn and LLM
2025-06-23 16:03:44 +02:00
Ivan Nardi
aa6dcad15e
ndpiReader: print categories summary (#2895) 2025-06-21 12:41:00 +02:00
Luca Deri
3a243bb40d Merged protocols (now free to use) into existing categories
- AdultContent -> Category Adult Content
- LLM          -> Category Artificial Intelligence
2025-06-17 23:57:15 +02:00
Vladimir Gavrilov
aba60ac354
Add GLBP dissector (#2879)
GLBP is a Cisco proprietary first-hop redundancy protocol similar to HSRP and VRRP, but with additional load balancing capabilities.
2025-06-10 15:26:10 +02:00
Ivan Nardi
30ebb91a3b
Simplify ndpi_internal_detection_process_packet() (#2877)
Simplify process of each packet
2025-06-10 13:41:27 +02:00
Vladimir Gavrilov
75395cb264
Add category and breed support for custom rules (#2872)
Close #2594
2025-06-08 17:34:21 +02:00
Luca Deri
38fe9859b3 Fixes invalid SSH client/server detection based on stage and not on packet direction 2025-06-08 16:12:41 +02:00
Ivan Nardi
5e895f91ea
Sync unit tests results and fix NDPI_HTTP_SUSPICIOUS_HEADER (#2874) 2025-06-08 14:01:10 +02:00
Ivan Nardi
cc99039e1f Sync unit tests results 2025-06-08 13:04:05 +02:00
Luca Deri
2a77c58ebe Improved HTTP risk report
PCRE2 is now enabled (if present) by default as necessary to report some HTTP risks
2025-06-08 07:33:19 +02:00
Vladimir Gavrilov
6d0a891d1e
Normalize breed/category names: use _ instead of spaces and slashes (#2873) 2025-06-07 12:38:14 +02:00
Luca Deri
38cc4ac22b Added IMO and Badoo files 2025-06-06 16:48:41 +02:00
Ivan Nardi
a8ad57bab2 Sync unit tests results 2025-06-05 14:37:53 +02:00
Ivan Nardi
a4b1a14149 Sync unit tests results 2025-06-05 13:42:43 +02:00
Luca Deri
ed6f257f1d Improved HTTP risk message report 2025-06-05 13:19:13 +02:00
Vladimir Gavrilov
40fe26b2f1
Add Hamachi protocol detection support (#2860) 2025-06-02 14:00:31 +02:00
Luca Deri
c36e4bd5de Updated bots and scanners list
Improved lists file parsing
2025-05-29 10:38:24 +02:00
Ivan Nardi
651daeb01a
Fix configuration of ip lists of flow risks (#2859)
Add some new tests about these configuration parameters.

Close #2858
2025-05-28 20:19:19 +02:00
Luca Deri
9e5a67f369 Improved detection of TCP scanners 2025-05-27 22:17:38 +02:00
Ivan Nardi
1f5378efb8
Allow to specify default ports also via range (#2856)
Ad a trivial example, update SIP configuration to use range
2025-05-27 19:11:35 +02:00
Ivan Nardi
1e3cc3938b Sync unit tests results 2025-05-27 10:26:10 +02:00
Ivan Nardi
8350cc68d4
BFCP: fix check on payload length and extract metadata (#2854)
We should be able to identified this protocol on the first packet,
without keeping any state

Close #2745
2025-05-26 15:08:53 +02:00
Ivan Nardi
03e1e593d1
Dofus: update detection to version 3.X (#2852)
See #2827
2025-05-25 20:06:12 +02:00
Luca Deri
c1d3728602 Added the support for multiple TCP fingerprint format
- default (0) is the native nDPI format
- MuonOF (1) has been added

The format can be changed using metadata.tcp_fingerprint_format

Added ability to identify mass scanners using TCP fingerprint
2025-05-24 10:30:33 +02:00
Vladimir Gavrilov
afc0da6468
Simplify ZeroMQ detection (#2847) 2025-05-23 16:09:16 +02:00
Vladimir Gavrilov
74cb03eb4c
Add MELSEC protocol support (#2846) 2025-05-23 11:13:52 +02:00
Ivan Nardi
cd03cca679
IPP: fix selection bitmask (#2845)
IPP is identified *only* as HTTP subprotocol, so it can't be over UDP
(HTTP is only over TCP...)
2025-05-22 22:08:24 +02:00
Vladimir Gavrilov
90b5f681c6
Improve BFCP detection (#2844)
Co-authored-by: Ivan Nardi <nardi.ivan@gmail.com>
2025-05-22 12:23:05 +02:00
Ivan Nardi
2c9ed8faaa
ospf, ipsec: use different ids for protocols at layer3 (#2838)
Don't use the same id for the same protocol identified via L3 info or
via standard TCP/UDP detection (example: ospf ip_proto 0x59 or TCP port
2604)

Before:
```
ivan@ivan-Precision-3591:~/svnrepos/nDPI(dev)$ ./example/ndpiReader -H | grep -wE 'OSPF|IPSec|AH|ESP|IP_OSPF'
 79       79 IPSec                  UDP        X        Safe         VPN                500,4500                        500
 85       85 OSPF                              X        Acceptable   Network            -                               2604
```

After:
```
ivan@ivan-Precision-3591:~/svnrepos/nDPI(ospf-ipsec)$ ./example/ndpiReader -H | grep -wE 'OSPF|IPSec|AH|ESP|IP_OSPF'
 79       79 IPSec                  UDP        X        Safe         VPN                500,4500                        500
 85       85 IP_OSPF                           X        Acceptable   Network            -                               -
116      116 AH                                X        Safe         VPN                -                               -
117      117 ESP                               X        Safe         VPN                -                               -
184      184 OSPF                   TCP        X        Safe         Network            -                               2604
```
2025-05-21 16:43:50 +02:00
Ivan Nardi
ed29a8f963
Fix isAppProtocol for GTP_U (#2837)
See: c590dc495
2025-05-21 14:30:36 +02:00
Vladimir Gavrilov
0a3c8f2464
Drop GW1 support and add basic GW2 detection (#2836) 2025-05-21 11:45:31 +02:00
Vladimir Gavrilov
8b84192cad
CrossFire: update code (#2834) 2025-05-21 08:36:58 +02:00
Ivan Nardi
896c9ffef1
Remove ProtonVPN address lists (#2831)
Proton doesn't provide anymore the list of egress and ingress addresses.
Remove the (stale) lists and the relative configuration parameters.

See: https://www.reddit.com/r/ProtonVPN/comments/1k3lrl5/great_the_httpsapiprotonvpnchvpnlogicals_api_has/
See also 470a479eb
2025-05-20 17:25:09 +02:00
Ivan Nardi
0e0f35c99a
Gnutella: avoid false positives (#2832) 2025-05-20 16:58:53 +02:00
Ivan Nardi
0d2213f7ff
Gnutella: simplify code, to support only gtk-gnutella client (#2830)
Close #2818
2025-05-20 15:48:56 +02:00