Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix Path Truncation via Null Byte Injection#3515

Draft
EffortlessSteven wants to merge 1 commit intomainfrom
sentinel-null-byte-rejection-7879273047049324277
Draft

πŸ›‘οΈ Sentinel: [CRITICAL] Fix Path Truncation via Null Byte Injection#3515
EffortlessSteven wants to merge 1 commit intomainfrom
sentinel-null-byte-rejection-7879273047049324277

Conversation

@EffortlessSteven
Copy link
Copy Markdown
Member

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: The validate_model_request function in bitnet-server did not explicitly reject null bytes (\0) in the model_path argument. Because standard Rust string validation methods (like .ends_with(".gguf")) operate on bytes, an attacker could supply a path like test.gguf\0 which passes the extension check but is truncated when passed to underlying C/OS APIs (e.g., llama.cpp or POSIX file system APIs).
🎯 Impact: This could potentially allow an attacker to bypass file extension restrictions and access unauthorized files on the system, depending on how the path is utilized downstream.
πŸ”§ Fix: Added an explicit check model_path.contains('\0') in validate_model_request to return an InvalidFieldValue error if a null byte is detected. Also added a corresponding test case test_model_path_restriction to verify this behavior.
βœ… Verification:
Run cargo clippy -p bitnet-server -- -D warnings
Run cargo test -p bitnet-server --lib security::tests::test_model_path_restriction


PR created automatically by Jules for task 7879273047049324277 started by @EffortlessSteven

This commit explicitly rejects null bytes (`\0`) in the `model_path` argument within `validate_model_request`. Because standard Rust string methods like `.ends_with(".gguf")` operate on bytes, a path like `test.gguf\0` would pass validation but could be truncated when passed to underlying C/OS APIs, potentially allowing unauthorized file access or bypassing extension checks.
@google-labs-jules
Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c304ec4d-4008-4c4c-8dd6-4d2eea4a5dfe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • πŸ” Trigger review
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-null-byte-rejection-7879273047049324277

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant