FLIR Systems FLIR AX8 Thermal Camera 1.32.16 Remote Root Exploit

Title: FLIR Systems FLIR AX8 Thermal Camera 1.32.16 Remote Root Exploit
Advisory ID: ZSL-2018-5491
Type: Local/Remote
Impact: System Access, DoS
Risk: (5/5)
Release Date: 14.10.2018
Summary
Thermal Imaging Camera For Continuous Condition and Safety Monitoring FLIR AX8 is a thermal sensor with imaging capabilities. Combining thermal and visual cameras in a small, affordable package, the AX8 provides continuous temperature monitoring and alarming capabilities to protec critical electrical and mechanical equipment. The AX8 helps you guard against unplanned outages, service interruptions, and equipment failure.

The FLIR AX series camera/sensor also has built-in support to connect to industrial control equipment such as programmable logic controllers (PLCs), and allows the sharing of analysis and alarm results and simple control using the Ethernet/IP and Modbus TCP field bus protocols. Compact and easy to install, the AX8 provides continuous monitoring of electrical cabinets, process and manufacturing areas, data centers, energy generation and distribution, transportation and mass transit, storage facilities and refrigeration warehouses.
Description
The FLIR AX8 thermal sensor camera suffers from two unauthenticated command injection vulnerabilities. The issues can be triggered when calling multiple unsanitized HTTP GET/POST parameters within the shell_exec function in res.php and palette.php file. This can be exploited to inject arbitrary system commands and gain root remote code execution.

--------------------------------------------------------------------------------

/FLIR/usr/www/res.php:
----------------------
1. <?php
2. if (isset($_POST["action"])) {
3. switch ($_POST["action"]) {
4. case "get":
5. if(isset($_POST["resource"]))
6. {
7. switch ($_POST["resource"]) {
8. case ".rtp.hflip":
9. if (!file_exists("/FLIR/system/journal.d/horizontal_flip.cfg")) {
10. $result = "false";
11. break;
12. }
13. $result = file_get_contents("/FLIR/system/journal.d/horizontal_flip.cfg") === "1" ? "true" : "false";
14. break;
15. case ".rtp.vflip":
16. if (!file_exists("/FLIR/system/journal.d/vertical_flip.cfg")) {
17. $result = "false";
18. break;
19. }
20. $result = file_get_contents("/FLIR/system/journal.d/vertical_flip.cfg") === "1" ? "true" : "false";
21. break;
22. default:
23. $result = trim(shell_exec("LD_LIBRARY_PATH=/FLIR/usr/lib /FLIR/usr/bin/rls -o ".$_POST["resource"]));
24. }
25. }

--------------------------------------------------------------------------------
/FLIR/usr/www/palette.php:
--------------------------
1. <?php
2. if(isset($_POST["palette"])){
3. shell_exec("LD_LIBRARY_PATH=/FLIR/usr/lib /FLIR/usr/bin/palette ".$_POST["palette"]);
4. echo json_encode(array("success"));
5. }
6. ?>

--------------------------------------------------------------------------------

Vendor
FLIR Systems, Inc. - https://www.flir.com
Affected Version
Firmware: 1.32.16, 1.17.13
OS: neco_v1.8-0-g7ffe5b3
Hardware: Flir Systems Neco Board
Tested On
GNU/Linux 3.0.35-flir+gfd883a0 (armv7l)
lighttpd/1.4.33
PHP/5.4.14
Vendor Status
[26.07.2018] Vulnerability discovered.
[17.08.2018] Vendor contacted.
[17.08.2018] Vendor replied forwarding message to appropriate team.
[21.08.2018] Vendor responds asking more details.
[22.08.2018] Replied to the vendor requesting PGP key.
[23.08.2018] Vendor sends PGP key.
[27.08.2018] Sent details to the vendor.
[29.08.2018] Vendor confirms the issues developing patches.
[29.08.2018] Working with the vendor.
[10.10.2018] Vendor updating folowing cyber security guide.
[14.10.2018] Coordinated public security advisory released.
PoC
flir_ax8_root.py
Credits
Vulnerability discovered by Gjoko Krstic - <gjoko@zeroscience.mk>
References
[1] https://www.flir.com/security/best-practices-for-cybersecurity/
[2] https://www.flir.com/globalassets/security/flir-pro-security-cyber-hardening-guide.pdf
[3] https://www.flir.com/globalassets/security/cybersecurity-bulletin-10-12-18.pdf
[4] https://www.exploit-db.com/exploits/45602/
[5] https://packetstormsecurity.com/files/149789
[6] https://exchange.xforce.ibmcloud.com/vulnerabilities/151286
[7] http://vfocus.net/art/20181016/14873.html
[8] https://fortiguard.com/encyclopedia/ips/47031
[9] https://www.flir.com/globalassets/industrial/security/cybersecurity-bulletin-10-12-18.pdf
[10] https://www.flir.com/globalassets/industrial/security/flir-pro-security-cyber-hardening-guide.pdf
[11] https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-37061
[12] https://flir.custhelp.com/app/answers/detail/a_id/5763
Changelog
[14.10.2018] - Initial release
[15.10.2018] - Added reference [4] and [5]
[17.10.2018] - Added reference [6]
[18.10.2018] - Added reference [7]
[20.11.2018] - Added reference [8]
[04.11.2022] - Added reference [9], [10] and [11]
[05.11.2022] - Added reference [12]
Contact
Zero Science Lab

Web: http://www.zeroscience.mk
e-mail: lab@zeroscience.mk