Skip to content

fix: patch CVE-2026-26220#1217

Open
lucrbvi wants to merge 4 commits intoModelTC:mainfrom
lucrbvi:fix_CVE-2026-26220
Open

fix: patch CVE-2026-26220#1217
lucrbvi wants to merge 4 commits intoModelTC:mainfrom
lucrbvi:fix_CVE-2026-26220

Conversation

@lucrbvi
Copy link

@lucrbvi lucrbvi commented Mar 3, 2026

This pull request aims to fix the CVE-2026-26220 vulnerability (score of 9.3) by replacing pickle with json when using websockets.

The PR focus on replacing pickle but it is recommended to add an authentication layer with secrets when using websockets to prevent bad actors to send malicious data.

I have also replaced the use of pickle in lightllm/distributed/pynccl.py when we send and receive data from the torch TCPStore. I would like feedback on this change.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical security vulnerability by systematically replacing the pickle serialization module with ujson wherever data is transmitted or received, particularly over websockets and within the torch TCPStore communication. The change aims to prevent malicious code execution through deserialization, thereby significantly improving the application's security. It also standardizes the serialization mechanism, contributing to more robust and maintainable code.

Highlights

  • Security Vulnerability Fix (CVE-2026-26220): Replaced the insecure pickle serialization module with ujson across various components to mitigate CVE-2026-26220, which had a high severity score of 9.3. This change enhances the security posture of the application by preventing potential deserialization attacks.
  • Serialization Standardisation: Standardized data serialization to ujson for inter-process communication, including websocket messages and data exchange via torch TCPStore, ensuring consistent and safer data handling throughout the system.
  • Improved Data Handling: Updated data encoding and decoding logic to correctly handle ujson's string output and byte input requirements, ensuring seamless transition from pickle's byte-oriented serialization.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • lightllm/distributed/pynccl.py
    • Imported ujson for JSON serialization.
    • Replaced pickle.dumps(obj) with json.dumps(obj).encode() when sending objects.
    • Replaced pickle.loads(data) with json.loads(data.decode()) when receiving objects.
  • lightllm/server/api_http.py
    • Replaced pickle.loads(data) with json.loads(data.decode()) for deserializing websocket messages in register_and_keep_alive.
    • Replaced pickle.loads(data) with json.loads(data.decode()) for deserializing upkv_status in kv_move_status.
  • lightllm/server/config_server/api_http.py
    • Imported ujson for JSON serialization.
    • Replaced pickle.loads(await websocket.receive_bytes()) with json.loads(await websocket.receive_bytes().decode()) for registered objects.
    • Replaced pickle.dumps(registered_pd_master_objs) with json.dumps(registered_pd_master_objs).encode() for serializing registered objects.
  • lightllm/server/httpserver/manager.py
    • Imported ujson for JSON serialization.
    • Replaced pickle.dumps(...) with json.dumps(...).encode() for sending NIXL_UPLOAD_NP_PROMPT_IDS.
    • Replaced pickle.dumps(decode_node_info) with json.dumps(decode_node_info).encode() for setting nixl_params.
  • lightllm/server/httpserver/pd_loop.py
    • Replaced pickle.loads(recv_bytes) with json.loads(recv_bytes.decode()) for deserializing received objects.
    • Replaced pickle.loads(base64.b64decode(base64data)) with json.loads(base64.b64decode(base64data.decode())) for deserializing pd_master_obj.
    • Replaced pickle.dumps(...) with json.dumps(...).encode() for sending TOKEN_PACKS.
  • lightllm/server/httpserver_for_pd_master/manager.py
    • Replaced pickle.dumps(...) with json.dumps(...).encode() for sending ObjType.REQ messages.
    • Replaced pickle.dumps(...) with json.dumps(...).encode() for sending ObjType.ABORT messages.
    • Replaced pickle.loads(nixl_params) with json.loads(nixl_params.decode()) for deserializing decode_node_info.
  • lightllm/server/httpserver_for_pd_master/register_loop.py
    • Removed pickle import and imported ujson for JSON serialization.
    • Replaced pickle.dumps(pd_master_obj) with json.dumps(pd_master_obj).encode() for sending registration objects.
  • lightllm/server/router/model_infer/infer_batch.py
    • Removed pickle import and imported ujson for JSON serialization.
    • Replaced pickle.loads(self.shm_param.nixl_params.get()) with json.loads(self.shm_param.nixl_params.get().decode()) for nixl_decode_node.
  • lightllm/server/router/model_infer/mode_backend/continues_batch/pd_mode/decode_node_impl/up_status.py
    • Replaced json import with ujson as json for JSON serialization.
    • Replaced pickle.dumps(upkv_status) with json.dumps(upkv_status).encode() for sending status updates.
  • lightllm/server/router/model_infer/mode_backend/pd_nixl/decode_node_impl/decode_trans_process.py
    • Removed pickle import and imported ujson for JSON serialization.
    • Replaced pickle.dumps(decode_node_info) with json.dumps(decode_node_info).encode() for nixl_params.
    • Replaced pickle.loads(notify) with json.loads(notify.decode()) for deserializing notifications.
    • Replaced pickle.dumps(remote_trans_task.createRetObj()) with json.dumps(remote_trans_task.createRetObj()).encode() for sending notifications.
  • lightllm/server/router/model_infer/mode_backend/pd_nixl/decode_node_impl/up_status.py
    • Replaced pickle.dumps(upkv_status) with json.dumps(upkv_status).encode() for sending status updates.
  • lightllm/server/router/model_infer/mode_backend/pd_nixl/nixl_kv_transporter.py
    • Imported ujson for JSON serialization.
    • Replaced pickle.dumps(new_trans_task) with json.dumps(new_trans_task).encode() for sending notifications.
    • Replaced pickle.dumps(notify_obj) with json.dumps(notify_obj).encode() for make_prepped_xfer.
  • lightllm/server/router/model_infer/mode_backend/pd_nixl/prefill_node_impl/prefill_trans_process.py
    • Removed pickle import and imported ujson for JSON serialization.
    • Replaced pickle.loads(notify) with json.loads(notify) for deserializing notifications.
Activity
  • The pull request was created by lucrbvi to address CVE-2026-26220 by replacing pickle with json for serialization.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces pickle with json for data serialization, which is a great security improvement. The changes are widespread across the codebase, touching websocket communication, TCPStore, and inter-process communication. The overall direction is correct.

However, I've found a few critical bugs where the new json deserialization code is incorrect and would lead to runtime errors. These are mainly due to incorrect handling of bytes vs str and incorrect await syntax.

Please address the critical issues to ensure the application runs correctly after these changes.

lucrbvi and others added 3 commits March 3, 2026 11:50
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…l_node_impl/prefill_trans_process.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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