Skip to content

Workaround for pickle load #48

@spaceone

Description

@spaceone

https://github.com/ebranca/owasp-pysec/wiki/Unrestricted-code-execution-using-pickle
(→ This article should also mention that cPickle is also affected!)

As a workaround I implemented this solution:

fd = StringIO(data)
unpickler = cPickle.Unpickler(fd)
unpickler.find_global = None
return unpickler.load()

It could be suggested as an hotfix for currently vulnerable projects which need to support the current API's. This is probably not 100% save (I can't proove), but increases security a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions