PluginProbe
The WP Remote WordPress Plugin / 5.65
The WP Remote WordPress Plugin v5.65
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
← All changes | callback/request.php +22 -4 5.225.65 View file →
@@ -11,8 +11,9 @@
11 11 public $is_debug;
12 12 public $account;
13 13 public $settings;
14 14 public $sig;
15 + public $sighshalgo;
15 16 public $time;
16 17 public $version;
17 18 public $is_sha1;
18 19 public $bvb64stream;
@@ -20,8 +21,9 @@
20 21 public $checksum;
21 22 public $error = array();
22 23 public $pubkey_name;
23 24 public $bvprmsmac;
25 + public $bvboundry;
24 26
25 27 public function __construct($account, $in_params, $settings) {
26 28 $this->params = array();
27 29 $this->account = $account;
@@ -31,8 +33,9 @@
31 33 $this->is_afterload = array_key_exists('afterload', $in_params);
32 34 $this->is_admin_ajax = array_key_exists('adajx', $in_params);
33 35 $this->is_debug = array_key_exists('bvdbg', $in_params);
34 36 $this->sig = $in_params['sig'];
37 + $this->sighshalgo = !empty($in_params['sighshalgo']) ? $in_params['sighshalgo'] : null;
35 38 $this->time = intval($in_params['bvTime']);
36 39 $this->version = $in_params['bvVersion'];
37 40 $this->is_sha1 = array_key_exists('sha1', $in_params);
38 41 $this->bvb64stream = isset($in_params['bvb64stream']);
@@ -40,8 +43,9 @@
40 43 $this->checksum = array_key_exists('checksum', $in_params) ? $in_params['checksum'] : false;
41 44 $this->pubkey_name = !empty($in_params['pubkeyname']) ?
42 45 WPRAccount::sanitizeKey($in_params['pubkeyname']) : 'm_public';
43 46 $this->bvprmsmac = !empty($in_params['bvprmsmac']) ? WPRAccount::sanitizeKey($in_params['bvprmsmac']) : "";
47 + $this->bvboundry = !empty($in_params['bvboundry']) ? $in_params['bvboundry'] : "";
44 48 }
45 49
46 50 public function isAPICall() {
47 51 return array_key_exists('apicall', $this->params);
@@ -133,9 +137,13 @@
133 137 }
134 138 }
135 139
136 140 if (array_key_exists('bvprms', $in_params) && isset($in_params['bvprms'])) {
137 - $calculated_mac = hash_hmac('SHA1', $in_params['bvprms'], $this->account->secret);
141 + if (!empty($in_params['bvprmshshalgo']) && $in_params['bvprmshshalgo'] === 'sha256') {
142 + $calculated_mac = hash_hmac('SHA256', $in_params['bvprms'], $this->account->secret);
143 + } else {
144 + $calculated_mac = hash_hmac('SHA1', $in_params['bvprms'], $this->account->secret);
145 + }
138 146
139 147 if ($this->compare_mac($this->bvprmsmac, $calculated_mac) === true) {
140 148
141 149 if (array_key_exists('b64', $in_params)) {
@@ -224,9 +232,9 @@
224 232 return false;
225 233 }
226 234
227 235 $data = $this->method.$this->account->secret.$this->time.$this->version.$this->bvprmsmac;
228 - if (!$this->verify($data, base64_decode($this->sig))) {
236 + if (!$this->verify($data, base64_decode($this->sig), $this->sighshalgo)) {
229 237 return false;
230 238 }
231 239 $this->settings->updateOption('bvLastRecvTime', $this->time);
232 240
@@ -232,9 +240,9 @@
232 240
233 241 return 1;
234 242 }
235 243
236 - public function verify($data, $sig) {
244 + public function verify($data, $sig, $sighshalgo) {
237 245 if (!function_exists('openssl_verify') || !function_exists('openssl_pkey_get_public')) {
238 246 $this->error["message"] = "OPENSSL_FUNCS_NOT_FOUND";
239 247 return false;
240 248 }
@@ -250,9 +258,13 @@
250 258 $this->error["message"] = "UNABLE_TO_LOAD_PUBLIC_KEY";
251 259 return false;
252 260 }
253 261
254 - $verify = openssl_verify($data, $sig, $public_key);
262 + if ($sighshalgo === 'sha256') {
263 + $verify = openssl_verify($data, $sig, $public_key, OPENSSL_ALGO_SHA256);
264 + } else {
265 + $verify = openssl_verify($data, $sig, $public_key);
266 + }
255 267 if ($verify === 1) {
256 268 return true;
257 269 } elseif ($verify === 0) {
258 270 $this->error["message"] = "INCORRECT_SIGNATURE";
@@ -276,8 +288,9 @@
276 288
277 289 public function authFailedResp() {
278 290 $api_public_key = WPRAccount::getApiPublicKey($this->settings);
279 291 $default_secret = WPRRecover::getDefaultSecret($this->settings);
292 + $default_account_pubkey = WPRAccount::getDefaultPublicKey();
280 293 $bvinfo = new WPRInfo($this->settings);
281 294 $resp = array(
282 295 "request_info" => $this->info(),
283 296 "bvinfo" => $bvinfo->info(),
@@ -282,10 +295,15 @@
282 295 "request_info" => $this->info(),
283 296 "bvinfo" => $bvinfo->info(),
284 297 "statusmsg" => "FAILED_AUTH",
285 298 "api_pubkey" => substr($api_public_key, 0, 8),
299 + "def_key_status" => WPRRecover::getSecretStatus($this->settings),
286 300 "def_sigmatch" => substr(hash('sha1', $this->method.$default_secret.$this->time.$this->version), 0, 8)
287 301 );
302 +
303 + if (is_string($default_account_pubkey) && strlen($default_account_pubkey) >= 32) {
304 + $resp["default_account_pubkey"] = substr($default_account_pubkey, 0, 8);
305 + }
288 306
289 307 if ($this->account) {
290 308 $resp["account_info"] = $this->account->info();
291 309 $resp["sigmatch"] = substr(hash('sha1', $this->method.$this->account->secret.$this->time.$this->version), 0, 6);