쉘코드 로더

쉘코드를 테스트하기 위한 오픈 소스 도구.

쉘코드 로더 쉘코드를 테스트하기 위한 명령줄 유틸리티입니다.
이 작은 오픈 소스 유틸리티는 자체 프로세스의 메모리 내부에 사용자 지정 셸 코드를 삽입합니다.

Shellcode Loader는 C로 작성되었으며 오픈 소스로 제공됩니다.
WinXP에서 Win11까지 모든 Windows에서 작동합니다.

셸코드 로더는 3가지 다른 셸코드 로딩 방법을 제공합니다.

  • 인라인 ASM
  • C 기능
  • CallWindowProc
용법:
  1. cmd.exe 또는 Windows Powershell을 엽니다.
  2. ShellLoad + 쉘코드 파일의 경로를 입력하십시오.
    예: ShellLoad “C:\Shellcode.file”
  3. 엔터 키를 치시오. 쉘코드가 로드되고 실행됩니다.
    정보 및 오류 메시지가 콘솔에 표시됩니다.
  4. 사용 도움말 및 고급 설정(예: 쉘코드 실행 방법)을 보려면,
    매개변수 없이 ShellLoad.exe를 실행합니다.
쉘코드 로더

"쉘코드 로더" 다운로드 ShellcodeLoader.zip – 858회 다운로드 – 55KB


패키지 내용물 :
ShellLoad.exe(컴파일됨)
ShellLoad.c(C 소스)

소스 코드 :

쉘로드.c:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// ________________________________________________
//
// ShellLoad.c
//
// PURPOSE:
// Useful tool to test shellcodes.
// The program will load the shellcode from file and execute it into its own process memory.
// 3 different shellcode loading methods are provided as option.
//
// USAGE:
// Execute the program passing the shellcode file path as parameter.
// 2° parameter is optional and lets you define the preferred shellcode loading method:
// 1 = Inline ASM (Default)
// 2 = C Function
// 3 = CallWindowProc
//
//
// RELEASE NOTES:
// v1.0.0
// 27 Jul 2021
//
// AUTHOR:
// © BreakingSecurity.net 
// https://BreakingSecurity.net
// ________________________________________________

#include <Windows.h>
#include <stdio.h>
// Shellcode Entrypoint function prototype
// TIP: We can edit this function to support different return types and parameters
typedef INT(*ShellEntry)();
#define METHOD_INLINEASM 1
#define METHOD_CFUNCTION 2
#define METHOD_CALLWINDOWPROC 3

int main(int argc, char *argv[])
{
	int ret = 0;
	int mtd = 1;
	int err = 0;
	DWORD fsize = 0;
	printf("\n");
	printf("-------------------------\n");
	printf(" Shellcode Loader v1.0.0\n");
	printf(" BreakingSecurity.net\n");
	printf("-------------------------\n");
	printf("\n");
	if (argc < 2)
	{
		printf("USAGE MODE:\n");
		printf("ShellLoad.exe path\n");
		printf("ShellLoad.exe path method\n");
		printf("\n");
		printf("METHODS:\n");
		printf("1 = Inline ASM (default)\n");
		printf("2 = C Function\n");
		printf("3 = CallWindowProc\n\n");
		printf("EXAMPLE (default method): ShellLoad.exe \"C:\\shellcode.file\" \n");
		printf("EXAMPLE (select method): ShellLoad.exe \"C:\\shellcode.file\" 1\n");
		printf("------------------------\n");
		printf("\n[-] ERROR: No parameter passed. Path to shellcode is required.\n\n");
		_getch();
		return 0;
	}
	if (argc > 2)
	{
		mtd = atoi(argv[2]);
	}
	printf("[+] Opening file: %s\n", argv[1]);
	HANDLE hFile = CreateFileA(argv[1], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (hFile == INVALID_HANDLE_VALUE) 
	{
		err = GetLastError();
		printf("[-] ERROR: Unable to open file. Error %i\n", err);
		return 0;
	}
	fsize = GetFileSize(hFile, NULL);
	if (fsize == INVALID_FILE_SIZE) 
	{
		err = GetLastError();
		printf("[-] ERROR: GetFileSize error %i\n", err);
		CloseHandle(hFile);
		return 0;
	}
	printf("[+] File Size: %i bytes\n", fsize);
	printf("[+] Allocating memory buffer...\n");
	void* pShellcode = VirtualAlloc(NULL, fsize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
	if (pShellcode == NULL) 
	{
		err = GetLastError();
		printf("[-] ERROR: VirtualAlloc error %i\n", err);
		CloseHandle(hFile);
		return 0;
	}
	printf("[+] Reading file...\n");
	DWORD nBytesRead = 0;
	ReadFile(hFile, pShellcode, fsize, &nBytesRead, NULL);
	CloseHandle(hFile);
	switch (mtd)
	{
		case METHOD_INLINEASM:
		{
			printf("[+] Executing shellcode (method: Inline ASM)\n");
			__asm
			{
				call pShellcode	// Execute shellcode entrypoint
				mov ret, eax	// Retrieve return value
			}
			break;
		}
		case METHOD_CFUNCTION:
		{
			printf("[+] Executing shellcode (method: C Function)\n");
			ShellEntry fShellcode = (ShellEntry)pShellcode;
			ret = fShellcode();
			break;
		}
		case METHOD_CALLWINDOWPROC:
		{
			printf("[+] Executing shellcode (method: CallWindowProc)\n");
			// TIP: we can use CallWindowProc parameters to pass arguments to our function
			ret = CallWindowProcA((WNDPROC)pShellcode, 0, 0, 0, 0);
			break;
		}
	}
	printf("[+] Shellcode executed!\n");
	_getch(); // Keep shellcode running
	return ret;
}
메뉴