HimitsuShell

August 12, 2026 · View on GitHub

HimitsuShell Logo

Latest Release PolyForm Noncommercial 1.0.0 License GitHub Total Downloads

翻译版本,错误请提 Issue。

README: English | 中文 | 日本語 | 한국어

HimitsuShell

即使在内核级追踪下也无法被察觉的 Shell 脚本。

将 shell 脚本转换为包含内置解释器、基于 LLVM 的混淆及反调试保护的单一静态二进制文件(shc 的替代方案)。


基本块流程图(Ghidra)

使用方法

# 1. download and load docker image
curl -LO https://github.com/HimitsuShell/Himitsu/releases/download/v1.2.0/himitsu_core_v1.2.0.tar.gz
docker load -i himitsu_core_v1.2.0.tar.gz

# 2. start container
docker run --name himitsu_core -d -it himitsu_core:v1.2.0

# 3. upload your shell script (must be named launcher.sh)
docker cp launcher.sh himitsu_core:/var/work/

# 4. build and download binary (10–20 seconds)
docker exec himitsu_core /var/work/compile.sh
docker cp himitsu_core:/var/work/safeLauncher .

混淆选项(基于 LLVM)

# obfuscation options
- bcf         # bogus control flow (warning: significantly increases build time and binary size.)
  - bcf_prob  # probability (1–100, default: 70)
  - bcf_loop  # number of iterations (default: 2)
- sub         # instruction substitution (add/and/sub/or/xor)
  - sub_loop  # number of iterations (default: 1)
- sobf        # string encryption
- split       # basic block splitting
  - split_num # number of splits (default: 3)
- ibr         # indirect branches
- icall       # indirect calls
- igv         # indirect global variable

# default options
sobf, icall, ibr, igv, sub

# how to customize
modify /var/work/compile.sh inside the `himitsu_core` container.

系统要求

  • CPU: x86_64(Intel/AMD),2.5 GHz 或更高 (推荐 6 核心 / 12 线程)
  • 内存: 16 GB RAM
  • 存储: 10 GB 可用空间(SSD/NVMe)

支持的平台

  • Linux x86_64(静态 musl)
  • Linux ARM64(即将支持)
  • Linux ARMv7(计划中)
  • Linux RISC-V 64(计划中)

功能

  • 操作系统级日志与 Hook 防护
    使用自带的内置 shell 解释器执行 shell 脚本,而非依赖系统 shell(例如 /bin/bash)。因此即使是操作系统级的日志记录与 hook 工具(auditdbpftrace)也无法捕获脚本内容。

  • 字符串与常量加密
    二进制文件中的所有字符串和常量均经过加密,从而增加静态分析的难度(例如 IDAGhidra)。

  • 调试器检测
    在运行过程中持续检测调试器,从而增加动态分析的难度(例如 gdbptracestrace)。

  • 高级混淆技术
    包含指令替换、间接调用、间接跳转、基本块拆分以及虚假控制流等技术。

  • 许可证验证(计划中)
    限制仅拥有有效许可证密钥的用户才能执行 shell 脚本。

研究与安全分析

为什么不用 shc、ssc 等工具?

已知的自动反编译工具:

与 shc 的对比

HimitsuShellshc
操作系统级日志与 Hook 防护
动态库 Hook 防护
字符串与常量加密
调试器检测
高级混淆技术

相关文章

常见问题

  • 支持哪些 Linux shell?
    支持符合 POSIX/LSB 标准的 shell(例如 /bin/sh)。

  • Bash 或 Zsh 脚本可以使用吗?
    可以使用,但可能会出现错误,建议在正式使用前先进行测试。

  • 支持哪些 shell 命令?
    以下列出的命令已内置于二进制文件中。其他命令同样可以使用,但会依赖系统 shell,因此可能会被 hook 或日志记录捕获。

    basename bash blkdiscard blkid blockdev bunzip2 bzcat cal cat chattr chgrp chmod chown chroot chrt chvt cksum clear cmp comm count cp cpio crc32 cut date dd deallocvt devmem df dirname dmesg dnsdomainname dos2unix du echo egrep eject env expand factor fallocate false fgrep file find flock fmt fold free freeramdisk fsfreeze fstype fsync ftpget ftpput getconf getopt gpiodetect gpiofind gpioget gpioinfo gpioset grep groups gunzip halt hd head help hexedit host hostname httpd hwclock i2cdetect i2cdump i2cget i2cset i2ctransfer iconv id ifconfig inotifyd insmod install ionice iorenice iotop kill killall killall5 link linux32 ln logger login logname losetup ls lsattr lsmod lspci lsusb makedevs mcookie md5sum memeater microcom mix mkdir mkfifo mknod mkpasswd mkswap mktemp modinfo mount mountpoint mv nbd-client nbd-server nc netcat netstat nice nl nohup nologin nproc nsenter od oneit openvt partprobe paste patch pgrep pidof ping ping6 pivot_root pkill pmap poweroff printenv printf prlimit ps pwd pwdx pwgen readahead readelf readlink realpath reboot renice reset rev rfkill rm rmdir rmmod rtcwake sed seq setfattr setsid sh sha1sum sha224sum sha256sum sha384sum sha3sum sha512sum shred shuf sleep sntp sort split stat strings su swapoff swapon switch_root sync sysctl tac tail tar taskset tee test time timeout top touch true truncate ts tsort tty tunctl uclampset ulimit umount uname unicode uniq unix2dos unlink unshare uptime usleep uudecode uuencode uuidgen vconfig vmstat w watch watchdog wc wget which who whoami xargs xxd yes zcat

  • 可以只使用混淆引擎吗?
    可以,请参见 HimitsuObfuscator

讨论

欢迎提出问题、报告 bug、提交功能请求以及进行任何形式的讨论。
您也可以通过 hjyun@mushsw.com 与我们联系。

License

See README.md and LICENSE for details.