GV-VMS V20 is a Video Monitoring Software used to gather the feeds of many surveillance cameras and manage other security devices. It is a native application accessed locally, but it is also possible to enable remote access via the "WebCam Server" feature. Once enabled, it is possible to access to the management and monitoring feature via a regular Web interface. This webersever is another native application, compiled without ASLR, which makes exploitation much easier and more likely. Most of the features require authentication before being reachable and leverage a standard login page to grant access. However the `gvapi` endpoint uses its own authentication mechanism via an `HTTP Authorization` header. It supports both `Basic` authentication and the `Digest` modes of authentication. #### Stack-overflow via unbound copy of base64 decoded string The `b64decoder` string is sized dynamically, but it is then copied to the `Buffer` stack variable one character at the time at [0], and there's no bound-check. As such, if the decoded string is bigger than 256 characters (the size of the `Buffer` variable) then a stack overflow occurs. Because the data can be fully controlled by an attacker and lack of ASLR, this vulnerability can easily be exploited to gain full code execution as SYSTEM on the machine running the service.
The built-in WebCam Server (available after enabling remote access) handles the `gvapi` endpoint with its own authentication mechanism via the HTTP Authorization header in Basic and Digest modes. While processing this header, data encoded in Base64 is decoded into a dynamically allocated buffer `b64decoder`, and then copied character by character to a stack variable `Buffer` with a size of 256 bytes — without any boundary checks. If the decoded string exceeds 256 characters, a stack buffer overflow occurs. Since the attacker has full control over the transmitted data, and the server is compiled without ASLR, the vulnerability enables precise control flow hijacking and execution of arbitrary code.
An unauthenticated remote attacker can obtain full code execution (RCE) with SYSTEM privileges on the machine running the GV-VMS service, which means complete takeover of the operating system.
Patches available from the manufacturer should be applied according to the references (GeoVision security page: https://www.geovision.com.tw/cyber_security.php). Until the patch is implemented, it is recommended to disable the WebCam Server function or restrict access to it exclusively to trusted IP addresses at the firewall level.
GeoVision GV-VMS V20 with WebCam Server function enabled allowing remote access through the web interface
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H