Skip to content

fix(security): load RIFE weights with weights_only - #35653

Closed
Snakinya wants to merge 1 commit into
sgl-project:mainfrom
Snakinya:fix/security-rife-safe-load
Closed

Snakinya wants to merge 1 commit into
sgl-project:mainfrom
Snakinya:fix/security-rife-safe-load

Conversation

@Snakinya

@Snakinya Snakinya commented Aug 20, 2026 •

Copy link
Copy Markdown

Motivation

The RIFE interpolator currently loads flownet.pkl with torch.load(..., weights_only=False).

Vulnerable code path:

  • python/sglang/multimodal_gen/runtime/postprocess/rife_interpolator.py

PoC shape:

  • A malicious checkpoint serialized with torch.save can execute pickle payloads when frame_interpolation_model_path points to attacker-controlled content

This keeps checkpoint-triggered code execution reachable on the current main branch.

Modifications

  • Add _load_rife_state_dict() to load checkpoints with weights_only=True
  • Reject non-mapping payloads before they reach load_state_dict
  • Keep normal state-dict loading behavior intact for valid RIFE weights
  • Add unit tests for valid state-dict loading, unsafe pickle rejection, and non-mapping payload rejection

Accuracy Tests

N/A. This change only affects checkpoint loading safety.

Speed Tests and Profiling

N/A. The change does not affect inference kernels or forward logic.

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

Validation run:

  • pytest --noconftest python/sglang/multimodal_gen/test/unit/test_rife_safe_load.py -q
  • python -m py_compile python/sglang/multimodal_gen/runtime/postprocess/rife_interpolator.py python/sglang/multimodal_gen/test/unit/test_rife_safe_load.py

CI States

Latest PR Test (Base): ❌ Run #32339082231
Latest PR Test (Extra): ❌ Run #32339081730
Latest PR Test (AMD ROCm 7.2): ❌ Run #32339082160

@Snakinya

Copy link
Copy Markdown
Author

/tag-and-rerun-ci extra

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Thanks @Snakinya. Closing this because you have 7 PRs open and none updated in 7 days, over our soft cap of 5 for idle PRs.

Reopen the two or three you most want reviewed - a short active set moves faster than a long idle one.

Some directories moved recently, so an older branch may need retargeting:
sgl-kernel/ -> python/sglang/kernels/aot/, python/sglang/jit_kernel/
-> python/sglang/kernels/jit/, docs/ -> docs/docs/ (.mdx),
bench_serving.py -> benchmark/serving.py, test/srt/ -> test/registered/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion SGLang Diffusion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant