GHSA-fpq5-4vwm-78x4

Suggest an improvement
Source
https://github.com/advisories/GHSA-fpq5-4vwm-78x4
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/11/GHSA-fpq5-4vwm-78x4/GHSA-fpq5-4vwm-78x4.json
JSON Data
https://api.test.osv.dev/v1/vulns/GHSA-fpq5-4vwm-78x4
Aliases
Published
2023-11-17T21:51:57Z
Modified
2023-11-20T22:33:43.569372Z
Severity
  • 4.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N CVSS Calculator
Summary
LibreNMS has Broken Access control on Graphs Feature
Details

Summary

This vulnerability occurs when application is not checking access of each type of users as per their role and it autorizing the users to access any feature. When user access his Device dashboard in librenms, one request is going to graph.php to access image of graphs generated on the particular Device. This request can be accessed by lower privileged users as well and they can enumerate devices on librenms with their id or hostname.

Details

Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer.

PoC

  1. Login with Lower privilege user
  2. Go to /graph.php?width=150&height=45&device=1&type=devicepingperf&from=1699022192&legend=no&bg=FFFFFF00&popup_title=ICMP+Response
  3. If its showing image with "device*ping_perf" which confirms that there is device with id 1
  4. Now you can change device parameter in above URL with hostname to check if that Hostname/IP exist or not like http://127.0.0.1:8000/graph.php?width=150&height=45&device=127.0.0.1&type=devicepingperf&from=1699022192&legend=no&bg=FFFFFF00&popup_title=ICMP+Response

  5. If device hostname doesn't exist then it should show 500 error

Check attached screenshots for more info

Vulnerable code: https://github.com/librenms/librenms/blob/fa93034edd40c130c2ff00667ca2498d84be6e69/html/graph.php#L19C1-L25C2

Above is vulnerable line of code from Line number 19-25 This is not checking privilege of users to access any device hostname, its just checking if user is authenticated or not

Impact

Low privilege users can see all devices registered by admin users by using this method

Solution

Implement privilege access control feature to check if low privilege user have access or not.

Screenshots:-

<img width="967" alt="Screenshot 2023-11-04 at 8 31 15 PM" src="https://user-images.githubusercontent.com/31764504/281085588-1c5d81b9-83d7-4ba8-baf3-03c95a99cefe.png"> <img width="973" alt="Screenshot 2023-11-04 at 8 31 36 PM" src="https://user-images.githubusercontent.com/31764504/281085614-7a4d13b0-d316-4d24-bdd2-05c3a80ffd59.png"> <img width="955" alt="Screenshot 2023-11-04 at 8 31 48 PM" src="https://user-images.githubusercontent.com/31764504/281085629-43aa2b6f-7b18-415f-8001-519bda45f918.png">

Database specific
{
    "nvd_published_at": "2023-11-17T22:15:08Z",
    "cwe_ids": [
        "CWE-200"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2023-11-17T21:51:57Z"
}
References

Affected packages

Packagist / librenms/librenms

Package

Name
librenms/librenms
Purl
pkg:composer/librenms/librenms

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
23.11.0

Affected versions

1.*

1.19
1.20
1.20.1
1.21
1.22
1.22.01
1.23
1.24
1.25
1.26
1.27
1.28
1.29
1.30
1.30.01
1.31
1.31.01
1.31.02
1.31.03
1.32
1.32.01
1.33
1.33.01
1.34
1.35
1.36
1.36.01
1.37
1.38
1.39
1.40
1.41
1.42
1.42.01
1.43
1.44
1.45
1.46
1.47
1.48
1.48.1
1.49
1.50
1.50.1
1.51
1.52
1.53
1.53.1
1.54
1.55
1.56
1.57
1.58
1.58.1
1.59
1.60
1.61
1.62
1.62.1
1.62.2
1.63
1.64
1.64.1
1.65
1.65.1
1.66
1.67
1.68
1.69
1.70.0
1.70.1

21.*

21.1.0
21.2.0
21.3.0
21.4.0
21.5.0
21.5.1
21.6.0
21.7.0
21.8.0
21.9.0
21.9.1
21.10.0
21.10.1
21.10.2
21.11.0
21.12.0
21.12.1

22.*

22.1.0
22.2.0
22.2.1
22.2.2
22.3.0
22.4.0
22.4.1
22.5.0
22.6.0
22.7.0
22.8.0
22.9.0
22.10.0
22.11.0
22.12.0

23.*

23.1.0
23.1.1
23.2.0
23.4.0
23.4.1
23.5.0
23.6.0
23.7.0
23.8.0
23.8.1
23.8.2
23.9.0
23.9.1
23.10.0