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

NetAdapterCx.sys does not set BytesRead for OID Set operations #14

Open
dmiller-nmap opened this issue Apr 6, 2023 · 1 comment
Open
Assignees
Labels

Comments

@dmiller-nmap
Copy link

When an NDIS component such as a LWF originates an OID Set request such as OID_GEN_CURRENT_PACKET_FILTER, NetAdapterCx reads the NDIS_OID_REQUEST, extracts the necessary information from the InformationBuffer, and calls the client driver's EVT_NET_ADAPTER_SET_RECEIVE_FILTER callback. Even though it reads from InformationBuffer, it does not set the NDIS_OID_REQUEST.DATA.SET_INFORMATION.BytesRead member, which has been causing issues (i.e. nmap/npcap#628) for our NDIS LWF that was being strict about checking this member. We are relaxing our code to work around the issue, but NetAdapterCx ought to update it to avoid issues in the future.

NxTranslationApp::SetPacketFilter(
NDIS_OID_REQUEST const & Request
)
{
auto const buffer = reinterpret_cast<ULONG *>(Request.DATA.SET_INFORMATION.InformationBuffer);
auto const bufferLength = Request.DATA.SET_INFORMATION.InformationBufferLength;
CX_RETURN_NTSTATUS_IF(
STATUS_BUFFER_TOO_SMALL,
bufferLength < sizeof(ULONG));
CX_RETURN_NTSTATUS_IF_MSG(
STATUS_INVALID_PARAMETER,
! (buffer + bufferLength > buffer),
"InformationBuffer + InformationBufferLength results in integer overflow.");
m_packetFilter = *buffer;
auto addressList = m_multicastAddressList.count() > 0U
? &m_multicastAddressList[0]
: reinterpret_cast<IF_PHYSICAL_ADDRESS const *>(nullptr);
return m_adapterDispatch->SetReceiveFilter(
m_adapter,
m_packetFilter,
m_multicastAddressList.count(),
addressList);
}

@tylerretzlaff tylerretzlaff self-assigned this Apr 26, 2023
@tylerretzlaff
Copy link
Member

thank you for reporting the problem, i've created an internal bug to investigate. we'll report back when information is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants