Bug 2183161 (CVE-2021-36156)

Summary: CVE-2021-36156 loki: Path traversal in Grafana Loki
Product: [Other] Security Response Reporter: Avinash Hanwate <ahanwate>
Component: vulnerabilityAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: dfreiber, gparvin, grafana-maint, jburrell, jcantril, jkurik, jwendell, nathans, njean, owatkins, pahickey, periklis, rcernich, rogbas, scox, stcannon, teagle, twalsh, vkumar
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Grafana loki 2.3.0 Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in Grafana Loki that could allow a remote attacker to traverse directories on the system, caused by improper input validation by the X-Scope-OrgID header value. An attacker could send a specially-crafted URL request containing "dot dot" sequences (/../) to view some of the contents in the error message.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2183163, 2183165, 2183176    
Bug Blocks: 2180566    

Description Avinash Hanwate 2023-03-30 13:22:27 UTC
An issue was discovered in Grafana Loki through 2.2.1. The header value X-Scope-OrgID is used to construct file paths for rules files, and if crafted to conduct directory traversal such as ae ../../sensitive/path/in/deployment pathname, then Loki will attempt to parse a rules file at that location and include some of the contents in the error message.

https://github.com/grafana/loki/pull/4020#issue-694377133
https://github.com/grafana/loki/releases/tag/v2.3.0

Comment 1 Avinash Hanwate 2023-03-30 13:27:21 UTC
Created grafana tracking bugs for this issue:

Affects: fedora-all [bug 2183163]