Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Why Python Pickle is Insecure. Because pickle is essentially a stack-based interpreter, so you can put os.system on the stack and use it to execute arbitrary commands.

Tagged , ,

3 comments

  1. Which is documented very clearly here: http://docs.python.org/library/pickle.html

    Malthe - 10th September 2009 10:57 - #

  2. I think it's well worth talking about the reason for the warning. The docs just say: "The pickle module is not intended to be secure against erroneous or maliciously constructed data. Never unpickle data received from an untrusted or unauthenticated source." Explaining that this actually means you can execute arbitrary OS level commands makes it far more likely people will take that warning seriously.

    Simon Willison - 10th September 2009 15:21 - #

  3. You might want to look at json-pickle. It may have the same problems but it's at least easier to read.
    http://jsonpickle.googlecode.com/svn/docs/index.ht ml

    Paul Hildebrandt - 10th September 2009 21:36 - #

Sign in with OpenID

Auto-HTML: Line breaks are preserved; URLs will be converted in to links.

Manual XHTML: Enter your own, valid XHTML. Allowed tags are a, p, blockquote, ul, ol, li, dl, dt, dd, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, sub, sup, br, pre

A django site