-
Notifications
You must be signed in to change notification settings - Fork 23
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 QUIC token parsing and QUIC packet type support #36
Conversation
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.
Hi, thanks for submitting! Excited to get this merged.
When I tried to test this on our traffic, I got a panic here:
Initializing Retina runtime...
thread '<unnamed>' panicked at core/src/protocols/stream/quic/parser.rs:225:44:
range end index 2675 out of range for slice of length 26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted
I'm guessing that there are length/offset validations missing, but I haven't looked into it deeply.
Separately, could you clarify what testing you've done in the PR? It's helpful to have this documented for PRs since we don't have automated live traffic tests.
Thank you!
Hi @thearossman, apologies for that. Would you be able to provide the pcap you were testing with? I have tested with all of the pcaps currently in the |
nw! Unfortunately, we're running it on live traffic and can't capture traffic (or write data to disk) for privacy reasons. It sounds like you have access to separate live traffic and can repro? |
Yes, the issue is intermittent, and I've been able reproduce once, so I am unable to determine exactly what packets are causing this. Regardless, I am making some changes to the length validation and will update the PR once they are done. Thanks! |
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.
Thanks!
I ran this for a while and eventually got a start > end slice index error at L263. Super weird, but looks like slice indices may need to be validated too (for overflow/underflow?)
thread '<unnamed>' panicked at core/src/protocols/stream/quic/parser.rs:263:44:
slice index starts at 27 but ends at 15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted
and on a different core --
thread '<unnamed>' panicked at core/src/protocols/stream/quic/parser.rs:263:44:
slice index starts at 8 but ends at 6
Those panics were caused due to the way retry packets are being parsed, the length of the token is unknown so you must work backwards and subtract the fixed length of the integrity tag. I've reworked how the |
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.
Thanks, that's subtle. I just ran this for about 10 minutes with no panics and what looks like reasonable/correct output, and it LGTM. Going to merge. Thanks again.
Changes
QuicLongHeader
struct:token_len
,token
, andretry_tag
. These are optional fields populated based on the packet type as outlined in RFC 9000 17.2.packet_type
field to be an enum instead of u8, improving error handling for malformed packets.data
slice access validation by creating access functionoffset
for tracking parse depthTesting
traces
, including new pcap for QUIC Retry packets (traces/quic_retry.pcapng
)