Unsafe python sandbox

735Tesla
10 years ago

0

This code was inspired from a challenge I completed at CSAW:
http://pastebin.com/FPTgiFNs
Although it looks suspicious, the data variable is just the zipped file contents of the sandbox which it creates whenever it starts.
The replace statements randomize the names of variables and modules that would make solving the challenge much easier.

Code such as this is vulnerable by design and would have to be run in a virtual machine. I have working solutions that will execute shell commands and read files if that is required.

The code provided in the paste will first create a vulnerable python shell file in /tmp, then start a server on port 10000 which accepts connections and allows users to interact with the sandbox.

The challenge would be to escape the sandbox and read a file with the level password in it.

If there are any questions about the code or suggestions to improve it I would be happy to respond.

1reply
1voice
169views
735Tesla
10 years ago

0

I could rewrite the server in c and it would probably run more efficiently. The code I posted is quick and dirty.

You must be logged in to reply to this discussion. Login
1 of 2

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss