Skip to content

fix:Unauthenticated Remote Code Execution (RCE) vulnerability - #10209

Open
z0o0ey wants to merge 1 commit into
modelscope:mainfrom
z0o0ey:fix/security-rce-v2
Open

z0o0ey wants to merge 1 commit into
modelscope:mainfrom
z0o0ey:fix/security-rce-v2

Conversation

@z0o0ey

@z0o0ey z0o0ey commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

PR type

  • Bug Fix
  • New Feature
  • Document Updates
  • More Models or Datasets Support

Security fix for GHSA-9g2v-fgfh-65rx (Snyk Security Labs report):

Fix 1 - validate_cmd in save_cmd (swift/ui/llm_train/utils.py):
Add shared validate_cmd() function that rejects control characters
(\x00-\x1f excluding \t \n \r) and ZIP signature bytes (PK\x03\x04,
PK\x01\x02, PK\x05\x06) in command strings. Applied to all three
save_cmd variants (SFT/RLHF/GRPO) to prevent ZIP archive embedding
in .sh files via --logging_dir parameter injection.

Fix 2 - blocklist for model_kwargs env vars (base_args.py):
Add _BLOCKED_MODEL_KWARGS blocklist of 19 known-dangerous environment
variables (PYTHONPATH, LD_PRELOAD, PYTHONSTARTUP, DYLD_INSERT_LIBRARIES,
BASH_ENV, etc.) that enable code execution, library injection, or
interpreter hijacking. _init_model_kwargs now skips blocked vars with
a warning log instead of blindly setting os.environ.

…e + model_kwargs PYTHONPATH injection""

This reverts commit 1112622.
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