ID

VAR-202208-1369


CVE

CVE-2022-37063


TITLE

FLIR Systems, Inc.  of  flir ax8  Cross-site scripting vulnerability in firmware

Trust: 0.8

sources: JVNDB: JVNDB-2022-014923

DESCRIPTION

All FLIR AX8 thermal sensor cameras versions up to and including 1.46.16 are vulnerable to Cross Site Scripting (XSS) due to improper input sanitization. An authenticated remote attacker can execute arbitrary JavaScript code in the web management interface. A successful exploit could allow the attacker to insert malicious JavaScript code. FLIR Systems, Inc. of flir ax8 Firmware has a cross-site scripting vulnerability.Information may be obtained and information may be tampered with. # FLIR AX8 vulnerabilities. ### Product description: The FLIR AX8 is a thermal sensor with imaging capabilities, combining thermal and visual cameras that provides continuous temperature monitoring and alarming for critical electrical and mechanical equipment. ### Summary of the 4 vulnerabilities found / What we were able to find: * [CVE-2022-37061] - Unauthenticated OS Command Injection. FLIR AX8 is affected by an unauthenticated remote command injection vulnerability. This can be exploited to inject and execute arbitrary shell commands as the root user through the `id` HTTP POST parameter in `res.php` endpoint. * [CVE-2022-37060] - Unauthenticated Directory Traversal. FLIR AX8 is affected by a directory traversal vulnerability due to an improper access restriction. An unauthenticated, remote attacker can exploit this, by sending a URI that contains directory traversal characters, to disclose the contents of files located outside of the server's restricted path. * [CVE-2022-37062] - Improper Access Control. FLIR AX8 is affected by an insecure design vulnerability due to an improper directory access restriction. An unauthenticated, remote attacker can exploit this, by sending a URI that contains the path of the SQLite users database, and download it. ### Step by Step Example (How to Reproduce and verify) the vulnerabilities: 1. Unauthenticated Remote Command Injection. The endpoint `/res.php` can be called remotely without user authentication as there is no cookie verification `Cookie: PHPSESSID=ID` to check if the request is legitimate. The second problem is that the POST parameter `id` can be injected to execute any Linux command. In the example below we create a crafted query that displays the contents of the `/etc/shadow` file. The server returns a JSON response containing the contents of the `/etc/shadow` file. This command injection is due because there no sanitization check on the variable `$_POST["id"]`, line 65, and can therefore take advantage of the `shell_exec()` function to execute unexpected arbitrary shell commands. 2. Unauthenticated Directory Traversal. The endpoint `/download.php` can be called remotely without user authentication as there is no cookie verification `Cookie: PHPSESSID=ID` to check if the request is legitimate. The second problem is that the GET parameter `file` can be injected with a relative file paths and download any files in the system. In the example below we create a crafted query that download the contents of the `/etc/passwd` file. The error is due to the fact that there is no sanitization of the `$file_path` variable, line 26, when the `fopen()` function is called, line 39. However a comment in the code, line 24, and the use of the function `pathinfo()`, line 28, suggests that the developer thought about this problem and therefore created the variable `$path_parts` which is sanitized. But for some reasons the developer does not use the sanitizer variable `$path_parts` when the function `fopen()` is used. Probably an oversight. 3. Improper Access Control. The endpoint `/FLIR/db/users.db` can be called remotely without user authentication as there is no cookie verification `Cookie: PHPSESSID=ID` to check if the request is legitimate and let any malicious actor to download the `users.db` SQLite database. 4. In the settings tab, if a file with a filename that contains JavaScript code is selected via the update firmware file input the JavaScript code will be triggered and executed. In our example, we created a file call <img src=x onerror=alert(String.fromCharCode(97,108,101,114,116,40,39,116,101,115,116,39,41,59));>.run ### Recommendations for how to fix the 4 vulnerabilities: * Vulnerability 1: The variable `$_POST["id"]`, line 65 in the file `/FLIR/usr/www/res.php`, must be sanitized using the function `intval()` and will remove any character other than integer value. `escapeshellcmd()` and `escapeshellarg()` must be also used to escapes any characters in a string that might be used to execute arbitrary commands. More info: https://www.php.net/intval https://www.php.net/manual/en/function.escapeshellcmd https://www.php.net/manual/en/function.escapeshellarg * Vulnerability 2: The variable `$file_path`, line 39 in the file `/FLIR/usr/www/download.php`, must be sanitized using the function `pathinfo()` but also use a hard coded directory path, in case you need to manage several directories set a whitelist of all allowed directories and use multiple conditions. More info: https://www.php.net/manual/en/function.pathinfo * Vulnerability 3: Define a whitelist of all directories that a user is allowed to access. This can be added to the Lighttpd server configuration file, in `/etc/lighttpd.conf`. More info: https://www.cyberciti.biz/tips/howto-lighttpd-enable-disable-directory-listing.html * Vulnerability 4: To protect against filename XSS attack you can use a regex that will parse the filename to leave only numbers and letters. More info: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html ### Reference: https://www.flir.com/products/ax8-automation/ ### Security researchers: * [Thomas Knudsen] (https://www.linkedin.com/in/thomasjknudsen) * [Samy Younsi] (https://www.linkedin.com/in/samy-younsi)

Trust: 1.71

sources: NVD: CVE-2022-37063 // JVNDB: JVNDB-2022-014923 // PACKETSTORM: 168116

IOT TAXONOMY

category:['camera device']sub_category:camera

Trust: 0.1

sources: OTHER: None

AFFECTED PRODUCTS

vendor:flirmodel:ax8scope:lteversion:1.46.16

Trust: 1.0

vendor:flirmodel:ax8scope:eqversion: -

Trust: 0.8

vendor:flirmodel:ax8scope: - version: -

Trust: 0.8

vendor:flirmodel:ax8scope:lteversion:flir ax8 firmware 1.46.16 and earlier

Trust: 0.8

sources: JVNDB: JVNDB-2022-014923 // NVD: CVE-2022-37063

CVSS

SEVERITY

CVSSV2

CVSSV3

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

Trust: 1.0

NVD: CVE-2022-37063
value: MEDIUM

Trust: 0.8

CNNVD: CNNVD-202208-3376
value: MEDIUM

Trust: 0.6

nvd@nist.gov: CVE-2022-37063
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

NVD: CVE-2022-37063
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-014923 // CNNVD: CNNVD-202208-3376 // NVD: CVE-2022-37063

PROBLEMTYPE DATA

problemtype:CWE-79

Trust: 1.0

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

Trust: 0.8

sources: JVNDB: JVNDB-2022-014923 // NVD: CVE-2022-37063

THREAT TYPE

remote

Trust: 0.6

sources: CNNVD: CNNVD-202208-3376

TYPE

XSS

Trust: 0.6

sources: CNNVD: CNNVD-202208-3376

EXTERNAL IDS

db:NVDid:CVE-2022-37063

Trust: 3.4

db:PACKETSTORMid:168116

Trust: 1.7

db:JVNDBid:JVNDB-2022-014923

Trust: 0.8

db:CXSECURITYid:WLB-2022080059

Trust: 0.6

db:CNNVDid:CNNVD-202208-3376

Trust: 0.6

db:OTHERid:NONE

Trust: 0.1

sources: OTHER: None // JVNDB: JVNDB-2022-014923 // PACKETSTORM: 168116 // CNNVD: CNNVD-202208-3376 // NVD: CVE-2022-37063

REFERENCES

url:https://www.flir.com/products/ax8-automation/

Trust: 2.5

url:https://gist.github.com/nwqda/9e16852ab7827dc62b8e44d6180a6899

Trust: 2.4

url:http://packetstormsecurity.com/files/168116/flir-ax8-1.46.16-traversal-access-control-command-injection-xss.html

Trust: 2.2

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

Trust: 0.9

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

Trust: 0.6

url:https://cxsecurity.com/issue/wlb-2022080059

Trust: 0.6

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

Trust: 0.1

url:https://cheatsheetseries.owasp.org/cheatsheets/cross_site_scripting_prevention_cheat_sheet.html

Trust: 0.1

url:https://www.php.net/intval

Trust: 0.1

url:https://www.linkedin.com/in/thomasjknudsen)

Trust: 0.1

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

Trust: 0.1

url:https://www.php.net/manual/en/function.pathinfo

Trust: 0.1

url:https://www.php.net/manual/en/function.escapeshellcmd

Trust: 0.1

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

Trust: 0.1

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

Trust: 0.1

url:https://www.linkedin.com/in/samy-younsi)

Trust: 0.1

url:https://www.cyberciti.biz/tips/howto-lighttpd-enable-disable-directory-listing.html

Trust: 0.1

url:https://www.php.net/manual/en/function.escapeshellarg

Trust: 0.1

sources: OTHER: None // JVNDB: JVNDB-2022-014923 // PACKETSTORM: 168116 // CNNVD: CNNVD-202208-3376 // NVD: CVE-2022-37063

CREDITS

Samy Younsi

Trust: 0.6

sources: CNNVD: CNNVD-202208-3376

SOURCES

db:OTHERid: -
db:JVNDBid:JVNDB-2022-014923
db:PACKETSTORMid:168116
db:CNNVDid:CNNVD-202208-3376
db:NVDid:CVE-2022-37063

LAST UPDATE DATE

2025-01-30T22:05:23.991000+00:00


SOURCES UPDATE DATE

db:JVNDBid:JVNDB-2022-014923date:2023-09-22T08:25:00
db:CNNVDid:CNNVD-202208-3376date:2022-08-22T00:00:00
db:NVDid:CVE-2022-37063date:2022-10-26T17:01:39.490

SOURCES RELEASE DATE

db:JVNDBid:JVNDB-2022-014923date:2023-09-22T00:00:00
db:PACKETSTORMid:168116date:2022-08-19T19:24:22
db:CNNVDid:CNNVD-202208-3376date:2022-08-18T00:00:00
db:NVDid:CVE-2022-37063date:2022-08-18T18:15:08.403