Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Dec 3, 2025

Proposed commit message

When the NFS protocol is enabled in Packetbeat, crafted ONC RPC/NFS traffic can cause the application to panic and exit due to unchecked XDR length fields and undersized RPC records. This affects both request and reply parsing paths.

This PR adds bounds checking and ignores malformed fragments via new error propagation.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Author's Checklist

  • Thoroughly examine this PR because the first commit is a directly applied external patch. I examined it very closely myself, but more harsh scrutiny would be appreciated.

How to test this PR locally

There is a new test included in this PR, could revert the changes of the first commit and run the tests and see things go sideways.


This is an automatic backport of pull request #47803 done by [Mergify](https://mergify.com).

* nfs xdr sanitization

* Add integration test

This test caused a crash prior to this PR
pcap captured when running the following:
```bash
nc -l 12049 >/dev/null
```
and in a different shell
```python
import socket, struct, time

dest = ("127.0.0.1", 12049)
frag_header = struct.pack("!I", 0x80000001)
payload = b"\x00"

with socket.create_connection(dest, timeout=5) as sock:
    sock.sendall(frag_header + payload)
    time.sleep(0.2)
```

* Add changelog fragment

* Update changelog/fragments/1764181634-rpc_fragment_sanitization.yaml

Co-authored-by: Mykola Kmet <[email protected]>

* review suggestions

 - add return for consistency
 - add failure case unit tests

* Appease the linter

---------

Co-authored-by: Mykola Kmet <[email protected]>
(cherry picked from commit afbccd1)
@mergify mergify bot added the backport label Dec 3, 2025
@mergify mergify bot requested review from a team as code owners December 3, 2025 16:40
@mergify mergify bot added the backport label Dec 3, 2025
@mergify mergify bot requested review from belimawr and rdner and removed request for a team December 3, 2025 16:40
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions github-actions bot added bug bugfix Team:Security-Linux Platform Linux Platform Team in Security Solution labels Dec 3, 2025
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Dec 3, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform)

@nicholasberlin nicholasberlin merged commit 6ef0e27 into 9.2 Dec 3, 2025
47 checks passed
@nicholasberlin nicholasberlin deleted the mergify/bp/9.2/pr-47803 branch December 3, 2025 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug bugfix Team:Security-Linux Platform Linux Platform Team in Security Solution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants