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 Apache Thrift detection #1914

Closed
wants to merge 3 commits into from
Closed

Add Apache Thrift detection #1914

wants to merge 3 commits into from

Conversation

0xA50C1A1
Copy link
Contributor

Apache Thrift is a commonly used RPC framework.

This detector is quite simple and only checks the HTTP content-type field or looks for the Thrift strict or compact header in TCP or UDP packets. This can give false-positive results in theory, but I guess such accuracy is enough in practice.

@IvanNardi
Copy link
Collaborator

@0xA50C1A1 , I didn't look at your code yet, but could you attached a trace with also an example of detection over HTTP, please?
BTW: you need to add the new .c file to the VisualStudio configuration file....

@0xA50C1A1
Copy link
Contributor Author

@0xA50C1A1 , I didn't look at your code yet, but could you attached a trace with also an example of detection over HTTP, please? BTW: you need to add the new .c file to the VisualStudio configuration file....

I don't have a PCAP sample with Thrift-over-HTTP traffic yet, but I'm looking for.

@sonarcloud
Copy link

sonarcloud bot commented Mar 24, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Copy link
Collaborator

@IvanNardi IvanNardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even ignoring the HTTP change, it seems there a lots of false positives....

static void ndpi_search_thrift_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &ndpi_struct->packet;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try, at least, something like that:

/* As a HTTP sub-protocol */
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP ||
   flow->detected_protocol_stack[1] == NDPI_PROTOCOL_HTTP) {
  /* Content line stuff */
} else  { /* Standard dissector */
  if (packet->payload_packet_len > 5) {

  }
}
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);

@0xA50C1A1 0xA50C1A1 marked this pull request as draft March 25, 2023 09:29
@0xA50C1A1
Copy link
Contributor Author

0xA50C1A1 commented Mar 25, 2023

Sorry, I was too hasty with a pull request, so I'll change it to a draft until I fix this dissector.

@utoni
Copy link
Collaborator

utoni commented Apr 12, 2023

@0xA50C1A1 please rebase to the current dev branch

@utoni utoni self-assigned this May 31, 2023
@utoni
Copy link
Collaborator

utoni commented Jun 21, 2023

Superseeded by #2007.

@utoni utoni closed this Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants