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

JA4SSH: Look for bare ACK flags when counting ACK packets #38

Merged
merged 1 commit into from
Dec 24, 2023
Merged
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
10 changes: 9 additions & 1 deletion rust/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.16.1] - 2023-12-22

### Fixed

- JA4SSH: When counting ACK packets, look for bare ACK flags only, skipping SYN-ACK,
PSH-ACK, FIN-ACK, etc. (#36)

## [0.16.0] - 2023-12-12

### Changed
Expand Down Expand Up @@ -41,7 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add Rust sources of `ja4` and `ja4x` CLI tools.

[unreleased]: https://github.com/FoxIO-LLC/ja4/compare/v0.16.0...HEAD
[unreleased]: https://github.com/FoxIO-LLC/ja4/compare/v0.16.1...HEAD
[0.16.1]: https://github.com/FoxIO-LLC/ja4/compare/v0.16.0...v0.16.1
[0.16.0]: https://github.com/FoxIO-LLC/ja4/compare/v0.15.2...v0.16.0
[0.15.2]: https://github.com/FoxIO-LLC/ja4/compare/v0.15.1...v0.15.2
[0.15.1]: https://github.com/FoxIO-LLC/ja4/compare/v0.15.0...v0.15.1
Expand Down
4 changes: 2 additions & 2 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["ja4", "ja4x"]
resolver = "2"

[workspace.package]
version = "0.15.2"
version = "0.16.1"
license = "LicenseRef-FoxIO-Proprietary"
repository = "https://github.com/FoxIO-LLC/ja4"

Expand Down
2 changes: 1 addition & 1 deletion rust/ja4/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ expression: output
ja4l_c: 179_128
ja4l_s: 38_64
ja4ssh:
- c112s80_c52s107_c35s5
- c112s80_c52s107_c35s4
- c0s1460_c0s174_c26s0
- c112s1460_c13s150_c37s0
- c0s1460_c0s178_c22s0
Expand Down
2 changes: 1 addition & 1 deletion rust/ja4/src/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ expression: output
ja4l_c: 77_128
ja4l_s: 12897_50
ja4ssh:
- c36s36_c55s87_c51s6
- c36s36_c55s87_c51s5
- c36s36_c49s90_c59s2
- c36s36_c14s23_c15s0
ssh_extras:
Expand Down
4 changes: 3 additions & 1 deletion rust/ja4/src/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ struct PacketCounts {

impl PacketCounts {
fn update(&mut self, pkt: &Packet, sender: Sender) -> Result<()> {
const BARE_ACK_FLAG: &str = "0x0010";

// SAFETY: We would not reach this point if the packet didn't have a "tcp" layer;
// see `Streams::update` and `StreamId2::new`. It's safe to unwrap.
let tcp = pkt.find_proto("tcp").unwrap();
Expand All @@ -223,7 +225,7 @@ impl PacketCounts {
self.nr_ssh_server_packets += 1;
}
}
} else if ["1", "True"].contains(&tcp.first("tcp.flags.ack")?) {
} else if tcp.first("tcp.flags")? == BARE_ACK_FLAG {
match sender {
Sender::Client => self.nr_tcp_client_acks += 1,
Sender::Server => self.nr_tcp_server_acks += 1,
Expand Down
Loading