CVE-2024-39227

Missing Access Controls and Path Traversal in Various GL.INet Devices

Missing Access Controls and Path Traversal in Various GL.INet Devices

Missing Access Controls and Path Traversal in Various GL.INet Devices

CVE ID
CVE-2024-39227
CVE Link
https://nvd.nist.gov/vuln/detail/CVE-2024-39227
Vendor
GL.iNet
Affected Product & Version

MT6000: 4.5.8
A1300/X300B: 4.5.16
AX1800/AXT1800/MT2500/MT3000: 4.5.16
X3000/XE3000: 4.4.8
XE300: 4.3.16
E750: 4.3.12
X750/SFT1200/AR300M/AR300M16/AR750/AR750S/B1300/MT1300/MT300N-V2
AP1300: 3.217
B2200/MV1000/MV1000W/USB150/SF1200/N300/S1300: 3.216

Vulnerability Type
Missing Access Controls and Path Traversal
CVSS Base Score / CVSS Vector

NVD: 9.8 Critical  / CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

BDO: 5.9 Medium  / CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N

Author
Patrick Walker
Date
2024-08-06

CVE Details

Description:

Due to missing access controls, direct access to the /cgi-bin/glc endpoint is possible via HTTP on the GL-iNet firmware. Additionally, due to an improper input validation inside the glc binary, it is possible to inject path traversal sequences and thus call functions from arbitrary shared objects, potentially leading to arbitrary code execution.

The main function inside the glc binary inside the /www/cgi-bin directory does not properly sanitize the JSON data it gets sent. Thus, it is possible to send a path traversal sequence (i.e., ../) inside the object parameter. The application parses the received JSON and performs the following steps:

1.    Use sprintf() to concatenate the string /usr/lib/oui-http/rpc with the received object value and the string .so.

2.    Perform a dlopen() call to dynamically load the specified library.

3.    Perform a dlsym() call to get the address of the function name specified via the method JSON parameter.

4.    Call the resolved function, providing the args JSON parameter’s value as first argument.

Since the value is taken “as is” in step 1, any arbitrary library can be loaded and any method inside that library can be called. It is, of course, necessary that this function knows how to process the supplied JSON object/struct in order to be useful. So, the exploitability is quite limited in this case.

The missing access controls can be combined with CVE-2024-39226  to gain unauthenticated remote code execution on the GL-iNet devices.


Remediation:

Update firmware to the latest available version, at least to (depending on model):
3.2.18, 4.3.17, 4.4.9, 4.5.17, 4.6.2



References:


Timeline:

2024-05-05: Vulnerability reported to GL-iNet

2024-05-30: Vulnerability was fixed

2024-08-01: GL-iNet published vendor security advisory

2024-08-06: CVE published