This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
#include <psapi.h> | |
// Compile this code using: cl /TC rop.c /link psapi.lib | |
int main(int argc, char **argv) | |
{ | |
FILE *fp; | |
FILE *rop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This code can be used to test the code injection in a remote process | |
The CPU usage will be at its peak after running this code | |
as a result of injecting the bytes, 0xeb, 0xfe into the remote process | |
If you get a high CPU usage for the remote process, you have successfully | |
injected the code. You can also confirm it by attaching a debugger to the | |
remote process and setting a breakpoint at the return address of VirtualAllocEx() | |
c0d3inj3cT | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; decryption routine for Stage 1 of the custom packer used in Win32/Injector virus | |
; c0d3inj3cT | |
include \masm32\include\masm32rt.inc | |
.data | |
Message db "decryption stage1 completed!",0 | |
.code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This code will hook the IAT by overwriting the function pointer of Sleep() imported from Kernel32.dll | |
It can be modified to hook any other function in the IAT | |
*/ | |
#include <stdio.h> | |
#include <windows.h> | |
void spoofedfunction(DWORD); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Below are the first few lines of code of the Window Procedure: | |
00402680 55 PUSH EBP | |
00402681 8BEC MOV EBP,ESP | |
00402683 83E4 F8 AND ESP,FFFFFFF8 | |
00402686 83EC 4C SUB ESP,4C | |
00402689 A1 04A04000 MOV EAX,DWORD PTR DS:[40A004] | |
0040268E 33C4 XOR EAX,ESP | |
00402690 894424 48 MOV DWORD PTR SS:[ESP+48],EAX | |
00402694 8B45 0C MOV EAX,DWORD PTR SS:[EBP+C] ; window message code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Pintool to detect API hooks in a process | |
c0d3inj3cT | |
*/ | |
#include <stdio.h> | |
#include <iostream> | |
#include "pin.H" | |
int i=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ESI - Function Pointer | |
EDI - Buffer | |
00C816F9 803E E9 CMP BYTE PTR DS:[ESI],0E9 ; check if the first instruction of API is a jump instruction | |
00C816FC 75 09 JNZ SHORT 00C81707 | |
00C816FE 8B46 01 MOV EAX,DWORD PTR DS:[ESI+1] | |
00C81701 8D4430 05 LEA EAX,DWORD PTR DS:[EAX+ESI+5] | |
00C81705 EB 12 JMP SHORT 00C81719 | |
00C81707 8D46 05 LEA EAX,DWORD PTR DS:[ESI+5] ; point eax to the 5th byte of the function | |
00C8170A A5 MOVS DWORD PTR ES:[EDI],DWORD PTR DS:[ESI] ; store 5 bytes from the function into the buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Detect VMWare using OEM String in Memory | |
Tested on Windows XP SP3/VMWare Workstation 7.1.0 | |
c0d3inj3cT | |
*/ | |
#include <windows.h> | |
#include <stdio.h> | |
#define MARKER "MS_VM_CERT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Overwrite RETN opcode | |
; Control Flow Obfuscation | |
; c0d3inj3cT | |
include \masm32\include\masm32rt.inc | |
.data | |
hMod dd 0 | |
.code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Instruction Tracer to identify | |
interesting sequence of instructions | |
in malwares. | |
c0d3inj3cT | |
*/ | |
#include <stdio.h> | |
#include <iostream> |
OlderNewer