RZ-GG(1)
π RZ-GG(1) π
okay bestie, gather round, because rz-gg is the Rizin frontend for RzEgg, and its whole thing is compiling programs into teeny tiny binaries for alllll the different architectures. like, it's giving "main character who makes shellcode" energy. π¦
β¨ SYNOPSIS β¨
rz-gg [-FOLsrxvhz] [-a arch] [-b bits] [-k os] [-f format] [-o file]
[-i shellcode] [-I path] [-e encoder] [-B hexpairs] [-c k=v]
[-C file] [-n dword] [-N dword] [-d off:dword] [-D off:qword]
[-w off:hexpairs] [-p padding] [-P size] [-q fragment]
file|f.asm|-
like yes she takes a file, or a f.asm, or a - for stdin, and then a whole little village of flags. we love a flexible queen. π
πΈ DESCRIPTION πΈ
so first thing: this command is part of the Rizin project. family business. π«Ά
Programs generated by RzEgg are relocatable, which is the fancy way of saying you can yeet them into a running process or into an on-disk binary file. no cap, that's the whole vibe.
and THEN β since the rz-gg-cc merge β rz-gg can now generate shellcodes from C code. π iconic. the final code can be linked with rz-bin, and it is relocatable, allowing injection into any remote process. this feature is conceptually based on shellforge4, but (and this is important bestie) it only supports Linux/OSX x86-32/64 platforms. so don't come for her about your weird platform, she said what she said.
π DIRECTIVES π
The rrz (rz-gg) configuration file accepts the following directives, described as key=value entries, and comments which are defined as lines starting with #. (yes, # is the comment girly. she's mysterious. she's above it all.)
-aarch β Select architecture (x86,mips,arm). pick your fighter β¨-bbits β Set register size (32,64,..).-Bhexpairs β Append hexpair bytes. just tacking them on the end, no thoughts, head empty.-ck=v β Set configure option for the shellcode encoder. The argument must bekey=valueβ she's not flexible on this one, bestie, it's literally the whole format.-Cfile β Append contents of file.-doff:dword β Patch dword (4 bytes) at given offset.-Doff:qword β Patch qword (8 bytes) at given offset.-eencoder β Use specific encoder. See-L. π-fformat β Output format (raw,c,pe,elf,mach0,python,javascript). so many aesthetics to choose from.-Fβ Output native format (osx=mach0,linux=elf,..). she'll match the local vibe automatically, queen behavior.-hβ Show usage help message. when in doubt, ask her.-ishellcode β Include shellcode plugin, use options. See-L.-Ipath β Add include path.-kkernel β Operating system's kernel (linux,bsd,osx,w32).-Lβ List all plugins (shellcodes and encoders). the full menu, the whole buffet π-nnum32 β Append 32bit number (4 bytes).-Nnum64 β Append 64bit number (8 bytes).-ofile β Output file to write result of compilation.-Oβ Use default output file (filename without extension ora.out). chaotic but she's got a system.-ppadding β Add padding after compilation (padding=n10s32)ntas: begin nop, trap,'a', sequenceNTAS: same as above, but at the end
-Psize β Prepend debruijn sequence of given length.-qfragment β Debruijn pattern offset.-rβ Show raw bytes instead of hexpairs.-sβ Show assembler.-Sstring β Append a string.-vβ Show version information.-woff:hex β Patch hexpairs at given offset.-xβ Execute. yes ma'am, run it, no fear π-Xhexpairs β Execute rop chain, using the stack provided.-zβ Output in C string syntax.
π₯ EXAMPLE π₯
so this is the part where she actually eats. watch. π
$ cat hi.r
/* hello world in RzEgg */
write@syscall(4); //x64 write@syscall(1);
exit@syscall(1); //x64 exit@syscall(60);
main@global(128) {
.var0 = "hi!\n";
write(1,.var0, 4);
exit(0);
}
$ rz-gg -O -F hi.r
$ ./hi
hi!
# With C file :
$ cat hi.c
main() {
write(1, "Hello\n", 6);
exit(0);
}
$ rz-gg -O -F hi.c
$ ./hi
Hello
# Linked into a tiny binary. This is 165 bytes
$ wc -c < hi
165
# The compiled shellcode has zeroes
$ rz-gg hi.c | tail -1
eb0748656c6c6f0a00bf01000000488d35edffffffba06000000b8010
000000f0531ffb83c0000000f0531c0c3
# Use a xor encoder with key 64 to bypass
$ rz-gg -e xor -c key=64 -B $(rz-gg hi.c | tail -1)
6a2d596a405be8ffffffffc15e4883c60d301e48ffc6e2f9ab4708252
c2c2c2f4a40ff4140404008cd75adbfbfbffa46404040f8414040404f45
71bff87c4040404f45718083
side note bestie: notice the shellcode has zeroes (that's the comment up there, it's a whole plot point), and the xor encoder withkey=64is the glow-up that bypasses them.-c key=64and-Bwith the hexpairs fromrz-gg hi.c | tail -1. that's the whole trick. iykyk. π
π SEE ALSO π
rizin(1), rz-hash(1), rz-find(1), rz-bin(1), rz-find(1), rz-diff(1), rz-asm(1),
(yes, rz-find(1) is listed twice. no, we are not editing the guest list. she said what she said. π)
π AUTHORS π
pancake <pancake@nopcode.org>byteninjaa0
and that's the whole page, bestie!! β¨ this version is from the manual RZ_GG(1), dated Jan 24, 2024. mwah, go compile something tiny and iconic. ππ
π¦π
π¦ where this page comes from
- arch rolling: rizin 0.8.2-2 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND CC-PDDC AND CC0-1.0 AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only AND GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND LGPL-3.0-only AND MIT
- epel 10: rizin 0.7.4-5.el10_1 Β· LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib
- epel 9: rizin 0.7.4-5.el9 Β· LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib
- fedora 43: rizin 0.7.4-9.fc43 Β· LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib
- fedora 43: rizin 0.7.4-9.fc43 Β· LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib
- fedora 44: rizin 0.7.4-9.fc43 Β· LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib
- fedora 44: rizin 0.7.4-9.fc43 Β· LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib
- nixos 26.05: rizin 0.8.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms