MsfMania

lepotekilMIT长期未更新

用 Python 编写的模块化恶意软件载荷生成器,通过压缩、编码、加密和 PE 格式混淆等手段绕过杀毒软件与 EDR 检测,常用于渗透测试。

Python AV Evasion Tools

v3.0.1发布于 2025-10-14 19:30 UTC512star72fork同步于 2026-11-07 07:33 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/lepotekil/MsfMania.git
cd MsfMania
docker build -t msfmania:latest .
硬件要求按 README 说明

README 未说明具体硬件要求,只列出任意操作系统、联网和 Docker;编译依赖 MinGW 交叉编译,未提及 GPU 或显存。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用多态 C stub 和 RC4 加密混淆 Windows payload,帮你在授权测试中绕过 EDR/AV 检测

用 Python 编写的模块化恶意软件载荷生成器,通过压缩、编码、加密和 PE 格式混淆等手段绕过杀毒软件与 EDR 检测,常用于渗透测试。

核心能力

  • 生成多态 C stub,混淆变量名与函数名
  • 用 4 表 S-box 的改进 RC4 加密,密钥长度 1-3 字节可选
  • 加密前先 zlib 压缩并 Base64 编码,stub 内递归爆破密钥
  • 用 djb2 哈希加随机盐校验 payload 完整性
  • 伪造二进制版本信息、公司、描述与图标等元数据

容易踩的坑

必须通过 Docker 构建镜像运行,直接跑 Python 脚本缺少 MinGW 等编译环境;需要自备 payload 文件(如 msfvenom 生成的 .bin)作为 -p 输入;--spoof-bin 需指向本地已有的目标 exe 才能提取元数据。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

3 个版本v3.0.1
  1. v3.0.1Catalix:v3.0.1最新正式版2025-10-14 · 2025-10-14 19:30 UTC

    Overview

    MsfMania v3.0.1 introduces advanced code obfuscation and junkcode injection capabilities, significantly enhancing evasion techniques while maintaining the Docker-based architecture.

    Changelog

    Added

    • Junkcode injection system with 52 mathematical and algorithmic functions
    • Advanced code obfuscation with C keyword preservation
    • RC4 encryption improvements with pseudo-random generation algorithm
    • Encryption verbosity for detailed logging
    • Modular architecture with separated obfuscation logic
    • Mathematical junkcodes: trigonometric, logarithmic, and statistical functions
    • Sorting algorithms: bubble sort, gnome sort, and shaker sort implementations
    • Number theory functions: Fibonacci, Armstrong numbers, prime number algorithms
    • Array manipulation: reverse, geometric, and statistical operations
    • Command-line integration with --junkcodes parameter
    • Smart injection avoiding loops and return statements
    • Forward declarations for automatic function declaration generation
    • Include management for automatic dependency resolution
    • Syntax validation for balanced braces and parentheses

    Enhanced

    • Code obfuscation with improved identifier renaming
    • RC4 encryption with enhanced pseudo-random generation
    • Modularity with better separation of concerns
    • Template system with enhanced C stub generation
    • Build process with integrated junkcode injection

    Removed

    • Legacy evasion module (replaced with obfuscator.py)
    • Unused variables (fixed compiler warnings)

    Disclaimer

    For educational and authorized security testing only. Unauthorized access is illegal. Authors assume no liability for misuse.

    Resources

  2. v3.0.0Catalix:v3.0.02025-10-12 · 2025-10-12 06:29 UTC
    查看更新说明

    Overview

    Complete rewrite of MsfMania. This major version removes the Metasploit dependency and introduces a Docker-based architecture.

    WARNING: Breaking changes. Not backward compatible with v2.4.0.

    Changelog

    Added

    • Docker-based build system with MinGW
    • Polymorphic C stub with dynamic identifier generation
    • RC4 encryption with configurable key size
    • zlib compression before encryption
    • djb2 hash payload integrity verification
    • Recursive key bruteforce in stub
    • PE metadata extraction and spoofing
    • Multi-resolution icon extraction and injection
    • Template-based C stub generation
    • Example payloads

    Removed

    • Metasploit framework dependency
    • Remote memory injection
    • Junk code injection
    • Run as Administrator flag
    • Automatic Metasploit configuration
    • Certificate signing
    • UPX packing
    • XOR encryption

    Workflow change: No Metasploit required. Bring your own payload binary.

    Disclaimer

    For educational and authorized security testing only. Unauthorized access is illegal. Authors assume no liability for misuse.

    Resources

  3. v2.4.0NewBie:2.4.02025-01-24 · 2025-01-24 20:06 UTC
    查看更新说明

    This is both the first and the final release of the project for the Python and C/C++ versions. Future development will take a completely new direction with version 3.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    MsfMania

    GitHub stars GitHub forks GitHub issues GitHub last commit GitHub release

    Python License Docker Status

    MsfMania is an advanced Python-based payload obfuscation framework designed to evade EDR/AV detection on Windows systems. It generates highly polymorphic executables through dynamic code generation, multi-layer encryption (RC4), and binary metadata spoofing.

    ⚠️ Educational Purpose Only - This tool is designed for authorized security testing and research purposes.


    Table of Contents


    Screenshots

    Features

    • Polymorphic C stub with variable/function obfuscation
    • Local memory injection (RWX)
    • RC4 variant using 4‑table S‑box & modified KSA/PRGA with configurable key size (1-3 bytes)
    • Payload integrity verification using djb2 hash with random salt
    • zlib compression before encryption
    • Base64 encoding for obfuscation
    • Recursive key bruteforce in stub
    • Binary metadata spoofing (version info, company, description, icon, etc...)
    • Dynamic junkcode injection for C
    • Executable stripping for reduced file size
    • Cross-compilation with MinGW

    Requirements

    • Electricity
    • Internet
    • Personal Computer or Server
    • Operating System (any)
    • Docker

    Installation

    • Git clone this repository: git clone https://github.com/lepotekil/MsfMania.git
    • cd into the MsfMania folder: cd MsfMania
    • Build the MsfMania docker image: docker build -t msfmania:latest .

    Usage

    Basic Help

    # docker run --rm -v "$(pwd):/app/output" msfmania:latest
                                                                                  
                    ███╗   ███╗███████╗███████╗███╗   ███╗ █████╗ ███╗   ██╗██╗ █████╗ 
                    ████╗ ████║██╔════╝██╔════╝████╗ ████║██╔══██╗████╗  ██║██║██╔══██╗
                    ██╔████╔██║███████╗█████╗  ██╔████╔██║███████║██╔██╗ ██║██║███████║
                    ██║╚██╔╝██║╚════██║██╔══╝  ██║╚██╔╝██║██╔══██║██║╚██╗██║██║██╔══██║
                    ██║ ╚═╝ ██║███████║██║     ██║ ╚═╝ ██║██║  ██║██║ ╚████║██║██║  ██║
                    ╚═╝     ╚═╝╚══════╝╚═╝     ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝╚═╝  ╚═╝                                                                                                                                                                                                                   
                Version : 3.0.1   -   Author : Killian CASAROTTO   -  Updated : 10/14/2025           
        
    usage: main.py [-h] -p PAYLOAD -o OUTPUT [-k {1,2,3}] [-s]
                   [--spoof-bin TARGET_EXE] [-j JUNKCODES]
    
    options:
      -h, --help            show this help message and exit
      -p, --payload PAYLOAD
                            Select the payload file to use (ex: cobalt64.bin)
      -o, --output OUTPUT   Output path including filename (ex:
                            /path/to/output/payload)
      -k, --keysize {1,2,3}
                            RC4 key size in bytes (1-3)
      -s, --strip           Strip the executable
      --spoof-bin TARGET_EXE
                            Spoof binary metadata from target executable (ex:
                            assets/bins/bitsadmin_11-21H2_KB5032192.exe)
      -j, --junkcodes JUNKCODES
                            Number of junkcodes to inject (default: 0)
    

    Complete example

    # docker run --rm -v "$(pwd):/app/output" msfmania:latest python3 main.py -p msfmania/assets/bins/win_x64_msgbox_msfvenom_20251010.bin -o output/payload_test_$(date +%s) --keysize 3 --spoof-bin assets/bins/explorer_11-24H2_KB5065789.exe --junkcodes 1000
                                                                               
                    ███╗   ███╗███████╗███████╗███╗   ███╗ █████╗ ███╗   ██╗██╗ █████╗ 
                    ████╗ ████║██╔════╝██╔════╝████╗ ████║██╔══██╗████╗  ██║██║██╔══██╗
                    ██╔████╔██║███████╗█████╗  ██╔████╔██║███████║██╔██╗ ██║██║███████║
                    ██║╚██╔╝██║╚════██║██╔══╝  ██║╚██╔╝██║██╔══██║██║╚██╗██║██║██╔══██║
                    ██║ ╚═╝ ██║███████║██║     ██║ ╚═╝ ██║██║  ██║██║ ╚████║██║██║  ██║
                    ╚═╝     ╚═╝╚══════╝╚═╝     ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝╚═╝  ╚═╝                                                                                                                                                                                                                   
                Version : 3.0.1   -   Author : Killian CASAROTTO   -  Updated : 10/14/2025           
        
    [~] Starting shellcode encryption (key size: 3)
    [~] Compressing shellcode (303 bytes)
    [+] Shellcode compressed to 284 bytes
    [~] Encrypting with modified RC4
    [+] Encryption completed: 284 bytes (b64: 380 bytes)
    [~] Injecting 1000 junkcodes...
    [~] Found 27 injection points in main()
    [~] Created 973 additional injection points
    [+] Inserted 1000/1000 function calls
    [+] 1000 junkcodes injected successfully
    [+] Successfully injected 1000 junkcodes
    [~] Applying obfuscation...
    [+] Obfuscated 145 identifiers
    [~] Extracting metadata from: assets/bins/explorer_11-24H2_KB5065789.exe
    [+] Extracted metadata:
        Description: Windows Explorer
        Version: 10.0.26100.6725 (WinBuild.160101.0800)
        Company: Microsoft Corporation
        Product: Microsoft® Windows® Operating System
    [~] Found 23 icon groups with 181 icons
    [+] Extracted 26 unique icon(s) from 181 total
    [+] Extracted 26 icon(s)
    [~] Compiling to: /app/output/output/payload_test_1760467840.exe
    [~] Compiling resource file: /tmp/payload_test_1760467840.rc
    [+] Resource file compiled: /tmp/payload_test_1760467840.res
    [+] Compilation successful: /app/output/output/payload_test_1760467840.exe
    [+] Binary size: 405ko
    [+] C source copied to: /app/output/examples/main.c
    [*] Deploying to remote server...
    [+] Payload deployed successfully
    

    Disclaimer

    ⚠️ IMPORTANT: This project is for educational and authorized security testing purposes only.

    • Use this tool only on systems you own or have explicit permission to test
    • Unauthorized access to computer systems is illegal
    • The authors are not responsible for misuse or damage caused by this tool
    • Always comply with local laws and regulations

    License

    This project is licensed under the MIT License - see the LICENSE file for details.