Skip to content

Added 1rtt fuzzing#5727

Open
gaurav2699 wants to merge 10 commits intomainfrom
user/gaurasingh/1rtt-fuzz
Open

Added 1rtt fuzzing#5727
gaurav2699 wants to merge 10 commits intomainfrom
user/gaurasingh/1rtt-fuzz

Conversation

@gaurav2699
Copy link
Contributor

@gaurav2699 gaurav2699 commented Jan 19, 2026

Description

Implemented 1rtt fuzzing in recvfuzz tool

Fixes #5712.

Purpose

Fuzzing is done to find vulnerabilites

Testing

Locally

Documentation

No

@gaurav2699 gaurav2699 requested a review from a team as a code owner January 19, 2026 19:32
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.56%. Comparing base (43959b6) to head (91b1490).
⚠️ Report is 36 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5727      +/-   ##
==========================================
- Coverage   86.21%   84.56%   -1.66%     
==========================================
  Files          60       60              
  Lines       18712    18729      +17     
==========================================
- Hits        16133    15838     -295     
- Misses       2579     2891     +312     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@guhetier guhetier left a comment

Choose a reason for hiding this comment

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

Please expend the PR description to explain more specifically what you added / what is not implemented for now.

@gaurav2699 gaurav2699 requested a review from guhetier February 18, 2026 12:34
Copy link
Collaborator

@guhetier guhetier left a comment

Choose a reason for hiding this comment

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

Some nitpicks, but the logic seems largely good to me.

0,
1
};
PacketParams.PacketType = QUIC_INITIAL_V1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I would avoid mixing an init list and direct member initialization, it makes it hard to know what is initialized.

ClientContext.CreateContext(PacketParams.SourceCid);
CXPLAT_FRE_ASSERT(ClientContext.ProcessData() & CXPLAT_TLS_RESULT_DATA);

if (CompleteHandshake(Binding, Route, StartTimeMs, &PacketParams, &ClientContext)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Consider returning early instead of nesting if blocks.
It will make the flow easier to understand: if we didn't get to complete the handshake, we do
nothing. If we don't get 1 RTT write keys, we do nothing. Then, if we have all we need, we get to
the actual body

//
do {
BuildAndSendPackets(Binding, Route, &PacketParams, &ClientContext, false); // Don't fuzz this one
BuildAndSendLongHeaderPackets(Binding, Route, PacketParams, ClientContext, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please keep / improve the comment here.
Even better if you clarify which packet this is (I assume this is meant to be the INITIAL?)

PacketParams.NumFrames = 1;
PacketParams.FrameTypes[0] = QUIC_FRAME_CRYPTO;
PacketParams.NumPackets = 1;
BuildAndSendLongHeaderPackets(Binding, Route, &PacketParams, &ClientContext, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am slightly confused by this, why isn't CompleteHandshake taking care of it?

// Use the provided frame type (which encodes FIN, LEN, and OFF bits)
bool HasOffset = (FrameType & 0x04) != 0;
bool HasLength = (FrameType & 0x02) != 0;
bool HasFin = (FrameType & 0x01) != 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Dead variable.

_Out_writes_to_(BufferLength, *Offset) uint8_t* Buffer
)
{
CXPLAT_FRE_ASSERT(*Offset < BufferLength);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: The AI review pointed out that this assert won't prevent writing out of bounds.
While the assert is true and makes sense, a bit more validation could help avoid memory corruption issues (at least asserting the final offset is still smaller than BufferLength, if you assume the caller knowns what it does.

Same for all Write* functions below.

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.

2 participants