์ทจ์ฝ์ ์ค๋ช
parserLib.pas ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ์ผ์ ๋ด์ฌ๋์ด ์๋ findMacroMarker ํจ์๊ฐ %00(NULL) ๊ฐ ์ดํ์ ์ค๋ ๊ฐ์ ์ฝ์ด๋ด์ง ๋ชปํ์ฌ ํ์ผ ์คํ, ์ ์ฅ๊ณผ ๊ฐ์ ๋งคํฌ๋ก ๋ช ๋ น์ด๋ฅผ ๊ฑธ๋ฌ๋ด์ง ๋ชปํ์ฌ ๊ณต๊ฒฉ์๊ฐ ์ํ๋ ํ์๊ฐ ๊ฐ๋ฅํ ์ทจ์ฝ์ ์ ๋๋ค.
hfs2.3~hfs2.3c์ ํด๋น CVE ์ทจ์ฝ์ ์ด ์์ต๋๋ค.
*HFS(HTTP File Server) : HTTP ๊ธฐ๋ฐ ํ์ผ ๊ณต์ ์๋ฒ
*์คํฌ๋ฆฝํ (๋งคํฌ๋ก) ๋ช ๋ น์ด ๋ชจ์ : https://www.rejetto.com/wiki/index.php/HFS:_scripting_commands
์ฝ๋ ๋ถ์
// parserLib.pas
function findMacroMarker(s:string; ofs:integer=1):integer;
begin result:=reMatch(s, '\{[.:]|[.:]\}|\|', 'm!', ofs) end;
findMacroMarker ํจ์๋ฅผ ํตํด ์ฌ์ฉ์๊ฐ ์ ๋ ฅํ๋ ๋ด์ฉ(URL)์ ๋งคํฌ๋ก ๋ช ๋ น์ด๊ฐ ์กด์ฌํ๋์ง๋ฅผ ๊ฒ์ฆํฉ๋๋ค.
์ฌ๊ธฐ์ ๋งคํฌ๋ก๋ ์ธ์ฝ๋ฉ&๋์ฝ๋ฉ, ๋๋ค ์ ํ ์ฌ์ง์ด๋ ์์คํ ๋ช ๋ น์ด ์คํ์ด ๊ฐ๋ฅํ ๋ช ๋ น์ด ์งํฉ์ ๋๋ค.
์๋ฅผ ๋ค์ด ์ฌ์ฉ์๊ฐ ๋ค์๊ณผ ๊ฐ์ URL์ ์ ๋ ฅํ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
http://target-server.com/search?={.exec|notepad.}
๊ทธ๋ผ ์ ๊ท ํํ์์ ์ํด์ ๋งคํฌ๋ก ๋ช ๋ น์ด๋ฅผ ๊ฐ์งํ๊ณ ์คํํ์ง ๋ชปํ๊ฒ ๋ฐฉ์ง๋ฅผ ํ ์ ์์ง๋ง, ์ค๊ฐ์ NULL ๊ฐ(%00)์ด ์ค๊ฒ ๋๋ฉด NULL ๊ฐ ๋ค์ ๊ฐ๋ค์ ๋ฌด์ํด ๋ฒ๋ฆฌ๊ฒ ๋ฉ๋๋ค.
ex) http://target-server.com/search?=%00{.exec|notepad.}
๊ฒฐ๊ตญ ํจ์์ ๋ฆฌํด ๊ฐ์ false๊ฐ ๋์ค๊ณ ๋งคํฌ๋ก ๋ช ๋ น์ด ๊ฐ์ง์ ์คํจํ๊ฒ ๋ฉ๋๋ค.
์ฝ๋ ์ถ์ฒ:
https://github.com/rejetto/hfs2/blob/master/parserLib.pas#L244
์ค์ต
[๊ณต๊ฒฉ ๋์ ํ๊ฒฝ]
OS : Microsoft Windows [Version 10.0.19045.3803]
IP Address : 192.168.56.102
hfs Version : 2.3
[๊ณต๊ฒฉ์ ํ๊ฒฝ]
OS : Linux kali 6.5.0-kali3-amd64
IP Address : 192.168.56.101
์ฐ์ hfs ์๋ฒ๊ฐ ์ด๋ฆฌ๋์ง ํ์ธํ๊ณ ๊ณต๊ฒฉ์์ ๊ณต๊ฒฉ ๋์์ด ํต์ ์ด ๊ฐ๋ฅํ์ง๋ฅผ ํ์ ํฉ๋๋ค.
๊ณต๊ฒฉ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ ๋ค์ ์ต์คํ๋ก์์ ํฉ๋๋ค.
ํผํด์์ PC๋ฅผ ํ์ธํ๋ฉด ๋ก๊ทธ์๋ ํ๋ผ๋ฏธํฐ ๊ฐ์ด ์๋ ์์ฒญ์ด ๋จ๊ฒจ์ ธ ์์ผ๋ฉฐ, ๊ณต๊ฒฉ์๊ฐ ์๋ํ๋๋ก ๊ณ์ฐ๊ธฐ๋ฅผ ์คํํ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
๊ณต๊ฒฉ ๋ฐฉ์ง
๊ณต๊ฒฉ ๋ฐฉ์ง๋ฅผ ์ํด์ ํ ์ ์๋ ๊ฒ์ ์ ํ๋ฆฌ์ผ์ด์ ์ต์ ๋ฒ์ ์ ๋ฐ์ดํธ ์ ๋๋ค.
ํ์ฌ CVE-2014-6287 ์ทจ์ฝ์ ์ 2.3c ๋ฒ์ ๋ถํฐ๋ ํจ์น๊ฐ ๋์ด ์์ผ๋ฏ๋ก 2.3c ์ด์์ ๋ฒ์ ์ ์ค์นํ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
2.3c ๋ฒ์ ์ ์ค์นํ ํ๊ฒฝ์๋ ๋๊ฐ์ ๋ฐฉ์์ผ๋ก ๊ณต๊ฒฉ์ ํ์์์๋ ์๋ฌด๋ฐ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
์ฐธ๊ณ
https://wins21.co.kr/kor/promotion/information.html?bmain=view&language=KOR&uid=2361
WINS
์ธ๊ณต์ง๋ฅ ๋ณด์๊ธฐ์ , IPS, ๋๋์ค, APT๋ฐฉ์ด, ์ฐจ์ธ๋๋ฐฉํ๋ฒฝ, AI๋ณด์๊ด์ , ํด๋ผ์ฐ๋๋ณด์, ๋ณด์SI, ๋ณด์์ปจ์คํ
wins21.co.kr
https://nvd.nist.gov/vuln/detail/CVE-2014-6287
NVD - CVE-2014-6287
CVE-2014-6287 Detail Description The findMacroMarker function in parserLib.pas in Rejetto HTTP File Server (aks HFS or HttpFileServer) 2.3x before 2.3c allows remote attackers to execute arbitrary programs via a %00 sequence in a search action. References
nvd.nist.gov
Mastering Metasploit - Second Edition
Overview of this book Metasploit is a popular penetration testing framework that has one of the largest exploit databases around. This book will show you exactly how to prepare yourself against the attacks you will face every day by simulating real-world p
subscription.packtpub.com
https://github.com/rejetto/hfs2/blob/master/parserLib.pas
'๐์ ๋ณด๋ณด์ > ์ทจ์ฝ์ ๋ถ์' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
์ทจ์ฝ์ ๋ถ์ - ์๋์ฐ ์๋ํ๋ ์ค ๊ณต๊ฒฉ ํ๊ฒฝ ๊ตฌ์ถ (0) | 2024.03.24 |
---|