-
Notifications
You must be signed in to change notification settings - Fork 91
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
tests: add test for pgsql probe bug 6080 - v1 #1501
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Test Description | ||
|
||
The probing function for PGSQL, in some scenarios, could identify any TCP message | ||
sent to the standard PGSQL port - 5432 - as PGSQL traffic, leading to false | ||
positives. | ||
|
||
## PCAP | ||
|
||
This pcap was created using the Scapy script included in the test directory, | ||
to reproduce a non-shareable traffic capture. | ||
|
||
## Related issues | ||
|
||
Bug report on Redmine: | ||
https://redmine.openinfosecfoundation.org/issues/6080 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
%YAML 1.1 | ||
--- | ||
|
||
app-layer: | ||
protocols: | ||
pgsql: | ||
enabled: yes | ||
stream-depth: 0 | ||
|
||
outputs: | ||
- eve-log: | ||
enabled: yes | ||
filetype: regular | ||
filename: eve.json | ||
types: | ||
- pgsql | ||
- flow | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
args: | ||
- -k none | ||
|
||
checks: | ||
- filter: | ||
count: 0 | ||
match: | ||
dest_ip: 172.16.4.19 | ||
dest_port: 5432 | ||
event_type: pgsql | ||
pgsql.tx_id: 1 | ||
proto: TCP | ||
src_ip: 172.16.1.1 | ||
src_port: 1050 | ||
- filter: | ||
count: 0 | ||
match: | ||
app_proto: pgsql | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not want the flow to be recognized as pgsql, do we ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, it should be there is 1 event_type flow, and 0 with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right! 🙇🏽 |
||
dest_ip: 172.16.4.19 | ||
dest_port: 5432 | ||
event_type: flow | ||
flow.age: 0 | ||
flow.alerted: false | ||
flow.bytes_toclient: 229 | ||
flow.bytes_toserver: 288 | ||
flow.pkts_toclient: 5 | ||
flow.pkts_toserver: 7 | ||
flow.reason: shutdown | ||
flow.state: closed | ||
proto: TCP | ||
src_ip: 172.16.1.1 | ||
src_port: 1050 | ||
tcp.ack: true | ||
tcp.fin: true | ||
tcp.psh: true | ||
tcp.rst: true | ||
tcp.state: closed | ||
tcp.syn: true | ||
tcp.tc_gap: true | ||
tcp.tc_max_regions: 1 | ||
tcp.tcp_flags: 1f | ||
tcp.tcp_flags_tc: 1a | ||
tcp.tcp_flags_ts: 1f | ||
tcp.ts_max_regions: 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python | ||
from scapy.all import * | ||
|
||
pkts = [] | ||
'''packet 1''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='S', window=65535, seq=0, options=[('MSS', 1460), ('SAckOK', '')]) | ||
'''packet 2''' | ||
pkts += IP(src='172.16.4.19', dst='172.16.1.1')/TCP(dport=1050, sport=5432, | ||
flags='S''A', ack=1, window=5840, seq=0, options=[('MSS', 1460), ('SAckOK', '')]) | ||
'''packet 3''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='A', ack=1, window=65535, seq=1) | ||
'''packet 4''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='P''A', ack=1, window=65535, seq=98080856) | ||
'''packet 5''' | ||
pkts += IP(src='172.16.4.19', dst='172.16.1.1')/TCP(dport=1050, sport=5432, flags='A', ack=37, window=5840, seq=1) | ||
'''packet 6''' | ||
pkts += IP(src='172.16.4.19', dst='172.16.1.1')/TCP(dport=1050, sport=5432, flags='P''A', ack=37, window=5840, seq=1)/":" | ||
'''packet 7''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='A', ack=37, window=65534, seq=2) | ||
'''packet 8''' | ||
pkts += IP(src='172.16.4.19', dst='172.16.1.1')/TCP(dport=1050, sport=5432, flags='P''A', ack=37, window=5840, seq=2)/"p1r473.server.org\x01\n" | ||
'''packet 9''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='P''A', ack=1363, window=64173, seq=37) | ||
'''packet 10''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='F''P''A', ack=1363, window=64173, seq=53) | ||
'''packet 11''' | ||
pkts += IP(src='172.16.4.19', dst='172.16.1.1')/TCP(dport=1050, sport=5432, flags='P''A', ack=200, window=6432, seq=1363)/":" | ||
'''packet 12''' | ||
pkts += IP(dst='172.16.4.19', src='172.16.1.1')/TCP(sport=1050, dport=5432, flags='R''A', ack=1364, window=0, seq=200) | ||
|
||
wrpcap('input.pcap', pkts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add min-version check.