From 167e33dac0e98e59e6ecb4fc0ee701152f4eaba3 Mon Sep 17 00:00:00 2001 From: Alexandre ZANNI <16578570+noraj@users.noreply.github.com> Date: Fri, 25 Jun 2021 17:09:20 +0200 Subject: [PATCH] safe navigation operator on res --- .../unix/webapp/wp_wpdiscuz_unauthenticated_file_upload.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/exploits/unix/webapp/wp_wpdiscuz_unauthenticated_file_upload.rb b/modules/exploits/unix/webapp/wp_wpdiscuz_unauthenticated_file_upload.rb index 8ab6f1fe4f..3a16bb2eec 100644 --- a/modules/exploits/unix/webapp/wp_wpdiscuz_unauthenticated_file_upload.rb +++ b/modules/exploits/unix/webapp/wp_wpdiscuz_unauthenticated_file_upload.rb @@ -69,7 +69,7 @@ class MetasploitModule < Msf::Exploit::Remote def find_wmusecurity_id res = send_request_cgi({ 'uri' => normalize_uri(target_uri.path, blogpath) }) - wmusecurity_id = res.body.match(/wmuSecurity":"(\w+)/)&.captures + wmusecurity_id = res&.body.match(/wmuSecurity":"(\w+)/)&.captures unless wmusecurity_id fail_with(Failure::NotFound, 'Failed to retrieve the wmusecurity id') end