by DoingIsLearning · 3y ago · 0 comments
Is there a standard/agreed way in which models are shared in the ML community?
Is there some agreed model integrity check or signature when pulling random files?
So if someone is offering you a large model, you can be fairly sure whoever is offering it has substantial compute resources.
Turns out most bad guys don't yet have access to compute on the necessary scale.
That in turn means you can be fairly sure most big models you find online are in fact made by a trustworthy party, even if you download them from a random WeTransfer link...
If you want to embed some sort of sneaky backdoor into a model, sure I buy this logic, but most malicious actors just want to take over your machine or something. No need to actually train a model to do that.
That malicious code in turn, when pulled and installed by another developer does the same - so it's a worm that spreads via npm, makefiles, requirements.txt, etc.
No reason it couldn't also spread by pickle files.
There are ways to verify the safety of these models but I doubt most users will go through the effort.
Could you expand on this? I assume it's some sort of serialization format, other than parsing it what can you do to inspect?
There are tools to check the format for suspicious behaviour: https://github.com/mmaitre314/picklescan seems to be the most developed one.
You can also check the format manually (being careful not to call into it), like demonstrated by this more rudimentary scanner: https://github.com/zxix/stable-diffusion-pickle-scanner
It you do check for security issues yourself, you'll need to read up on what magical methods/variables may cause code execution. Simple demonstrations of dangerous code can be found all over the web (https://stackoverflow.com/questions/47705202/pickle-exploiti...) but I'm sure there are obfuscation tricks that simple scans won't catch.