A stack overflow vulnerability exists in the WebCam Server Login functionality of GeoVision GV-VMS V20 20.0.2. A specially crafted HTTP request can lead to an arbitrary code execution. An attacker can make an unauthenticated HTTP request to trigger this vulnerability. #### Stack-overflow via unconstrained sscanf The call to `sscanf` at [1] to split the `Buffer` variable into the `username` and `password` variables doesn't limit the size of the extracted content to match the destination buffers' sizes. In this case, if either the username or password decoded from the authorization string exceeds `40` characters (the size the stack variables `username` and `password`) then a stack overflow will occur. The data is controlled by an attacker, but sronger constraints (e.g. no null bytes) may make exploitation harder. A successful attack could lead to full code execution as SYSTEM on the machine running the service.
The vulnerability results from the use of the `sscanf` function without size restriction when reading data during HTTP authorization header parsing. If the username or password decoded from the authorization header exceeds 40 characters — the size of the stack buffers for the `username` and `password` variables — a stack overflow occurs (CWE-787). The attacker sends a specially crafted HTTP request without needing authentication, causing stack memory to be overwritten. Certain limitations (e.g., absence of null bytes) may hinder but not prevent successful exploitation.
Successful exploitation allows an attacker to execute arbitrary code remotely (RCE) with SYSTEM account privileges on the machine hosting the service, resulting in complete system takeover.
Apply patches available from the vendor according to the references. As an interim measure, it is recommended to restrict network access to the WebCam Server interface only to trusted IP addresses and monitor traffic for anomalous HTTP requests directed to the login endpoint.
GeoVision GV-VMS V20 version 20.0.2 (GV-VMS software and firmware)
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:HGeovision Gv Vms
HWGeovision20Geovision Gv Vms Firmware
OSGeovision< 21.0.0
Related vulnerabilities
Stack overflow w GeoVision GV-VMS — nieuwierzytelnione RCE przez WebCam Server
OS Command Injection w urządzeniach GeoVision — zdalne wykonanie poleceń bez uwierzytelnienia
Command injection w urządzeniach GeoVision EOL — zdalne wykonanie poleceń
Command injection w GeoVision LPC2011/LPC2211 via konfiguracja DDNS
Privilege escalation w interfejsie Web GeoVision LPC2011/LPC2211