无文件执行 ELF

Exploring Linux Memory Manipulation for Stealth and Evasion Strategies to bypass Read-Only No-Exec and Distroless Environments

https://media.defcon.org/DEF%20CON%2031/DEF%20CON%2031%20presentations/Carlos%20Polop%20Yago%20Gutierrez%20-%20Exploring%20Linux%20Memory%20Manipulation%20for%20Stealth%20and%20Evasion%20Strategies%20to%20bypass%20Read-Only%20No-Exec%20and%20Distroless%20Environments.pdf

memfd_create

memfd_create 返回一个引用匿名文件的文件描述符

需要内核版本高于 3.17

metasploit 中的实现:

https://github.com/rapid7/mettle/blob/master/libreflect/src/map_elf.c

Python & Perl

https://github.com/nnsee/fileless-elf-exec

/proc/$pid/mem

通过覆盖 /proc/self/mem 修改当前进程内存的技术

https://github.com/arget13/DDexec

类似 Windows 下的反射 DLL 注入技术

引导头

使用场景:绕过敏感命令执行限制 & 记录

权限过低无法写入可执行目录

APISIX 结合 https://github.com/L-codes/Neo-reGeorg/blob/master/templates/tunnel.go

这种方法需要修改 ddexec.sh,将脚本原有的从 stdin 获取文件修改为从硬编码的字符串获取

文件下载的替代方案

C 实现的下载器:

为了优化文件大小使用 musl libc 代替 glic 进行编译,文件大小可以控制在 10 K 以内

压缩编码后可以通过 echo 写入