Comments (3)
Should the target be _pickle
or pickle
(no underscore)?
I setup a repro using this:
class Malicious13:
def __reduce__(self):
return pickle.loads, (b'I12345\n.',) # Loads the value 12345
This gets serialized (Pickle version 0, on Windows) as:
cpickle
loads
p0
(c_codecs
encode
p1
(VI12345\u000a.
p2
Vlatin1
p3
tp4
Rp5
tp6
Rp7
.
This has cpickle
instead of _pickle
in the serialized data.
Without the fix, this gets detected as pickle.loads
and reported as Suspicious
. The fix I am currently testing raises that to Dangerous
.
from picklescan.
Not sure why in some cases it serializes as __pickle
and others as pickle
/cpickle
. Can't find the repo anymore, but pretty sure the global was __pickle
.
from picklescan.
That looks like a Python 2 - Python 3 compatibility feature. It sounds like in Python 2 the C implementation of pickle
was called cPickle
and in Python 3 _pickle
. When I pickle with version 0, cPickle
is written, and with version 4, _pickle
is written. Updating the fix to handle both.
from picklescan.
Related Issues (9)
- Handle old PyTorch non-zip format
- Pickle is file extension agnostic HOT 2
- EICAR Test HOT 2
- Dangerous global detection bypass with `inst` instruction HOT 6
- Dangerous global detection bypass with memo dict confusion HOT 2
- ValueError: at position 2, opcode b'\x03' unknown HOT 4
- Add logs to cli for download
- Possible vulnerability in picklescan==0.0.12 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picklescan.