Log in

View Full Version : GCB engine release.


Indy
November 26th, 2010, 10:44
GCBE(Control Flow Graph Creation And Build Engine) - this is the base engine for morphing(x86). To create and build the graph. Allows us to solve very complex problems associated with graphs.

http://indy-vx.narod.ru/Bin/GCBE.zip ("http://indy-vx.narod.ru/Bin/GCBE.zip")

dELTA
November 27th, 2010, 15:02
Sweet.

CRCETL:
http://www.woodmann.com/collaborative/tools/GCBE_%28Control_Flow_Graph_Creation_And_Build_Engine%29

evaluator
November 28th, 2010, 05:18
hm, dELTA, so you are putting in CRECTL also tools related to virusology?
is that safe choice?

Indy
November 28th, 2010, 05:38
evaluator
A knife is a weapon, but its use is not prohibited for peaceful purposes

evaluator
November 28th, 2010, 06:59
problem not in weapon/not-weapon, but will be you sued for that-thing.

btw, for dld your zip, one must turn off AV. can that behavior avoided?

niaren
November 28th, 2010, 09:38
Quote:
[Originally Posted by Indy;88388]evaluator
A knife is a weapon, but its use is not prohibited for peaceful purposes


Such as for instance watermarking!?....

dELTA
November 28th, 2010, 11:53
I agree that most tools on our site could be used for malicious purposes if someone wanted to, so that's irrelevant. Code flow analysis can be very useful for "normal" reversing/unpacking/deobfuscation too.

Indy, could you possibly provide us with a little more thorough description of the capabilities for that tool? That would be great.

Indy
November 28th, 2010, 13:09
Here the possibilities of this tool one can not appreciate. You do not have a sufficient level for evaluation.

dELTA
November 28th, 2010, 21:59
First of all, if you truly believed that "no one here can appreciate the possibilities of this tool", what exactly would the point be of making a post about it here in the first place?

Second of all, the tools in the CRCETL are not only meant for "the people here", and thus, a better description for the tool in the CRCETL would benefit everyone interested in such a tool (which would of course also imply that they would be able to "appreciate its capabilities".

If you don't have any logically sound replies/arguments to the question and statement above, would you please supply a somewhat more detailed description of the tool? (not meaning a paper about its inner workings for that matter, just a few more key sentences about its capabilities would do just fine)

Indy
November 29th, 2010, 09:55
dELTA
Interested people should study such mechanisms. Can not be otherwise - is a complex materiel opens up great opportunities. I just do not understand your position, this code as my other technology can be laid only at elite sites. What are you unhappy?

If you have a problem that the code affects vx technology, I can give you an example. Simplified example. Need to get control after working ISR: http://indy-vx.narod.ru/Bin/Ki.zip ("http://indy-vx.narod.ru/Bin/Ki.zip")

For example this: http://www.woodmann.com/forum/showthread.php?13926-Debugger-detection-methods...-WHEN-to-call-them&p=88363&viewfull=1#post88363 ("http://www.woodmann.com/forum/showthread.php?13926-Debugger-detection-methods...-WHEN-to-call-them&p=88363&viewfull=1#post88363")

I thought it would be normal technical discussion
If something does not suit you, I'll go away.

dELTA
November 29th, 2010, 10:15
Quote:
[Originally Posted by Indy;88410]dELTA
Interested people should study such mechanisms. Can not be otherwise - is a complex materiel opens up great opportunities. I just do not understand your position, this code as my other technology can be laid only at elite sites. What are you unhappy?
Yes, all I'm saying is that in order to start and inspire such a discussion, it is very effective to give an "initial description" that will give people a little more detailed understanding about the unique capabilities and possibilities of a posted tool. Even though people might very well be able to download and analyze the source code/functionality/whatever of a posted zip-file, they will be much more likely to do so if they know a little more about it. Otherwise they will highly likely just discard it due to lack of time, because they don't know at all if it's worth the time investment to even take a look at it. There are LOTS of unknown zip files on the net to investigate, all too many actually.

All I'm saying is that it would be a shame if people skipped it for those reasons, when you have invested time in a complex and most likely very good tool. It breaks my heart when big time investments like this aren't spread anywhere close to their potential just because of some small detail like a lacking description in the very last step. That's why I created the CRCETL, i.e. to expose and "market" all the fine tools that reversers put oceans of time into developing, but only seconds into spreading so that others could have great use of them.


Quote:
[Originally Posted by Indy;88410]If you have a problem that the code affects vx technology, I can give you an example. Simplified example. Need to get control after working ISR: http://indy-vx.narod.ru/Bin/Ki.zip ("http://indy-vx.narod.ru/Bin/Ki.zip")
If you look above, you will see that I defended the tool from the vx accusations...


Quote:
[Originally Posted by Indy;88410]I thought it would be normal technical discussion
If something does not suit you, I'll go away.
Sadly, people in general (and especially the smartest ones) have very little time to spare between all their other projects, so if you upload a zip file with a one sentence description, you don't exactly maximize the possibilities of such a discussion starting, because few people will take the time to download and investigate the tool just to see if it can do anything interesting to begin with. Oh, and insulting their intelligence when they ask for a few more sentences of description instead of putting an hour that they don't have into investigating the tool themselves probably won't do much for inspiration either.

We do appreciate your skills, you input, and your tools, I just tried to help you get some more interest for your tool, that's all.

Indy
November 29th, 2010, 17:11
dELTA
Quote:
"initial description"

Just one who understands what is morphing and graphs will understand how it works subj. This is very huge and complex subject, there is no sense to describe the basics. For example rebuild the graph allows you to separate the procedure entirely. Absolutely no need to describe how it happens and what can be applied. Simply because those who are familiar with these mechanisms do not need a description, for those who are not familiar with this brief description would be futile because of their complexity.

dELTA
November 29th, 2010, 20:46
Even though again, this is not a big issue at all, I must provide a counter example just for the hell of it :

Just because someone "knows the art of word processing", they still won't have a clue about the capabilities of a tool that is presented such as:

Quote:
Here is my word processor. It can process words. (wordprocessor.zip)
And most of them probably won't have the time to download it just to see what it can do either. If the author would like people (that know the art of word processing of course) to do that, a description such as the following might be more efficient, while still not containing any info about "the basics of word processing":

Quote:
Word 2010 provides an array of new and improved tools that help you look like a design pro and make your important content stand out.
* Add impressive formatting effects—such as gradient fills and reflections—directly to the text in your document. You can now apply many of the same effects to text and shapes that you might already use for pictures, charts, and SmartArt graphics.

Use new and improved picture editing tools—including versatile artistic effects and advanced correction, color, and cropping tools—to fine-tune every picture in your document to look its absolute best.

Choose from more customizable Office themes to coordinate colors, fonts, and graphic formatting effects throughout your documents. Customize themes to use your own personal or business branding. The same Office themes are available in Microsoft PowerPoint and Excel 2010, so it’s easy to give all your documents a consistent, professional look.

Make a statement with a wide selection of SmartArt graphics— including many new layouts for organization charts and picture diagrams—to create impressive graphics as easily as typing a bulleted list. SmartArt graphics automatically coordinate with your chosen document theme, so great-looking formatting for all your document content is just a couple of clicks away.
And I don't mean the marketing spin, but rather the description of some actual features, contrary to just a one-sentence classification of what kind of program it is at all.

Finally, myself for example, know a fair bunch about graph theory and control flow analysis, but judging only from your description of the tool, I still don't have the faintest idea about what it can actually accomplish within these fields, and which main features and tools it contains to help accomplish this.

There will be a massive difference in interest for the tool (and subsequent "technical discussion" too mind you) between these two methods of presenting it. That being said, it is in no way required that the author of a posted tool must do this, absolutely not. Insulting people's intelligence or competence when they ask for some more information about the tool while trying to decide if it's worth the time to evaluate it might be somewhat frowned upon though.

evaluator
November 30th, 2010, 07:43
short-cut from me:
THUSLeY, CRCETL entry is not required for this object.

Indy
November 30th, 2010, 09:24
evaluator
Why not?

BanMe
December 6th, 2010, 11:14
I counter-agree with indy and (delta/evaluator) in that,I agree a more accurate description of this is in order but that if you know asm you should be able to tell what it does..

its a length disasm engine with code to data graphing capabilities..

the way its built is like a service

GCBE:: is the 'defaulted to' entry point and it requires eax equals the value of the called function, this can be seen here..
Code:

GCBE::
; GPE Services
test eax,eax
jz QueryOpcodeSize
dec eax
jz QueryPrefixLength
dec eax
jz GpParse
dec eax
jz GpTrace
dec eax
jz GpFastCheckIpBelongToSnapshot
dec eax
jz GpCheckIpBelongToSnapshot
dec eax
jz GpFindCallerBelongToSnapshot
dec eax
jz GpSearchRoutineEntry
dec eax
jz GpQueryRoutineArgsNumber
dec eax
; GCBE service.
jz GpBuildGraph
mov eax,STATUS_INVALID_PARAMETER
ret
%GET_GRAPH_REFERENCE
assume fs:nothing


the test cases are really what illustrate the usage of this functionality and luckily I've been keeping track of good ol Indy

so I will provide what I have..

Test 1..args count and address
Code:

.686p
.model flat, stdcall
option casemap :none

include \masm32\include\ntdll.inc
includelib \masm32\lib\ntdll.lib

.code

include Engine.inc

%NTERR macro
.if Eax
Int 3
.endif
endm

; 10 args
_imp__RtlCreateUserThread proto \
ProcessHandle:HANDLE, \
SecurityDescriptor:PSECURITY_DESCRIPTOR, \
CreateSuspended:BOOLEAN, \
ZeroBits:ULONG, \
SizeOfStackReserve:ULONG, \
SizeOfStackCommit:ULONG, \
InitialEip:ULONG, \
nitialValueInStack:ULONG, \
OutThreadHandle:PHANDLE, \
OutClientId:PCLIENT_ID

$Msg CHAR "Address: 0x%p, Args: %u", 13, 10, 0

Ep proc
Local GpBase:PVOID, GpSize:ULONG
Local GpLimit:PVOID
Local ArgsCount:ULONG
mov GpBase,NULL
mov GpSize,4*X86_PAGE_SIZE
invoke ZwAllocateVirtualMemory, NtCurrentProcess, addr GpBase, 0, addr GpSize, MEM_COMMIT, PAGE_READWRITE
%NTERR
mov ecx,GpBase
lea edx,GpLimit
mov ebx,dword ptr [_imp__RtlCreateUserThread]
mov GpLimit,ecx
push eax
push eax
push eax
push eax
push eax
push eax
push edx
push ebx
mov eax,GP_PARSE;parse the region in question ebx
Call GP
%NTERR
lea ecx,ArgsCount
push ecx
push GpBase
mov eax,GP_QUERY_ROUTINE_ARGS_NUMBER
Call GP
%NTERR
invoke DbgPrint, addr $Msg, Ebx, ArgsCount
ret
Ep endp
end Ep


Test 2:Whats loading?
Code:

.686p
.model flat, stdcall
option casemap :none

include \masm32\include\ntdll.inc
includelib \masm32\lib\ntdll.lib

include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib

.code GPECODE
include ..\Bin\Gpe.inc

%NTERR macro
.if Eax
Int 3
.endif
endm

%APIERR macro
.if !Eax
Int 3
.endif
endm

Public gChainDispatch
Public gLoadLibraryArg
.data
gSnapshot GP_SNAPSHOT <>
gChainDispatch PVOID ?
gLoadLibraryArg PSTR ?

.code
LoadLibrary2ndDispatch proc C
pushad
invoke DbgPrint, gLoadLibraryArg
popad
jmp gChainDispatch
LoadLibrary2ndDispatch endp

LdrpManifestProberRoutine proc DllBase:PVOID, FullDllPath:PCWSTR, ActivationContext:PVOID
Local Caller:GP_CALLER
lea eax,Caller
push eax
push UserMode
push NULL
push offset gSnapshot
%GPCALL GP_FIND_CALLER_BELONG_TO_SNAPSHOT
.if !Eax
mov edx,Caller.Frame ; ~PspCreateProcess()
lea ecx,LoadLibrary2ndDispatch
mov edx,STACK_FRAME.Next[edx]
xchg STACK_FRAME.Ip[edx],ecx
mov gChainDispatch,ecx
mov edx,dword ptr [edx + sizeof(STACK_FRAME)] ; Arg.
mov gLoadLibraryArg,edx
.endif
xor eax,eax
ret
LdrpManifestProberRoutine endp

LdrSetDllManifestProber proto :PVOID

_imp__LoadLibraryA proto :PSTR

$Dll CHAR "psapi.dll",0

Ep proc
Local GpSize:ULONG
Local OldProtect:ULONG
mov gSnapshot.GpBase,NULL
mov GpSize,1000H * X86_PAGE_SIZE
invoke ZwAllocateVirtualMemory, NtCurrentProcess, addr gSnapshot.GpBase, 0, addr GpSize, MEM_COMMIT, PAGE_READWRITE
mov ebx,gSnapshot.GpBase
%NTERR
add gSnapshot.GpBase,0FFFH * X86_PAGE_SIZE
mov GpSize,X86_PAGE_SIZE
invoke ZwProtectVirtualMemory, NtCurrentProcess, addr gSnapshot.GpBase, addr GpSize, PAGE_NOACCESS, addr OldProtect
%NTERR
mov gSnapshot.GpLimit,ebx
mov gSnapshot.GpBase,ebx
lea ecx,gSnapshot.GpLimit
push eax
push eax
push eax
push eax
push eax
push 1
push GCBE_PARSE_SEPARATE
push ecx
push dword ptr [_imp__LoadLibraryA]
%GPCALL GP_PARSE
%NTERR
invoke LdrSetDllManifestProber, offset LdrpManifestProberRoutine
invoke LoadLibrary, addr $Dll
%APIERR
ret
Ep endp
end Ep


test :3 Parsing a function to find a undocumented symbol...
exemplifies Parsing Tracing find undocumented entry and num of args..
Code:

.686p
.model flat, stdcall
option casemap :none

include \masm32\include\ntdll.inc
includelib \masm32\lib\ntdll.lib

_imp__LdrLoadDll proto :PWCHAR, :PULONG, :PUNICODE_STRING, :PHANDLE

.code GPECODE
include ..\Bin\Gpe.inc

%NTERR macro
.if Eax
Int 3
.endif
endm

%APIERR macro
.if !Eax
Int 3
.endif
endm

.code
GCBE_PARSE_NL_UNLIMITED equ -1

TRACE_DATA struct
ScanBase PVOID ?
ScanLimit PVOID ?
Message PSTR ?
MsgLength ULONG ?
Gp PVOID ?
TRACE_DATA ends
PTRACE_DATA typedef ptr TRACE_DATA

TraceCallback proc uses ebx esi edi GpEntry:PVOID, TraceData:PTRACE_DATA
mov eax,GpEntry
test dword ptr [eax + EhEntryType],TYPE_MASK
mov ebx,TraceData
jne Exit ; !HEADER_TYPE_LINE
assume eax:PBLOCK_HEADER
mov esi,[eax].Address
mov edi,[eax]._Size
assume ebx:PTRACE_DATA
Ip:
push esi ; Ip
%GPCALL GP_LDE ; LDE()
cmp al,5
jne @f
cmp byte ptr [esi],68H ; push imm32
mov edx,dword ptr [esi + 1] ; ref.
jne @f
cmp [ebx].ScanBase,edx
ja @f
cmp [ebx].ScanLimit,edx
jbe @f
push esi
push edi
mov esi,edx
mov edi,[ebx].Message
mov ecx,[ebx].MsgLength
cld
repe cmpsb
pop edi
pop esi
jne @f
mov eax,GpEntry
mov [ebx].Gp,eax
jmp Exit
@@:
add esi,eax
sub edi,eax
ja Ip
Exit:
xor eax,eax
ret
TraceCallback endp

$Message CHAR "LdrpResolveDllName", 0

$Ldrp CHAR "Def.: LdrpResolveDllName(), Address: 0x%p, Arg's: %x", 13, 10, 0

assume fs:nothing
Ep proc
Local GpSize:ULONG
Local Snapshot:GP_SNAPSHOT
Local ArgsCount:ULONG
Local OldProtect:ULONG
Local TraceData:TRACE_DATA
Local Gp:PVOID
mov Snapshot.GpBase,NULL
mov GpSize,1000H * X86_PAGE_SIZE
invoke ZwAllocateVirtualMemory, NtCurrentProcess, addr Snapshot.GpBase, 0, addr GpSize, MEM_COMMIT, PAGE_READWRITE
mov ebx,Snapshot.GpBase
%NTERR
add Snapshot.GpBase,0FFFH * X86_PAGE_SIZE
mov GpSize,X86_PAGE_SIZE
invoke ZwProtectVirtualMemory, NtCurrentProcess, addr Snapshot.GpBase, addr GpSize, PAGE_NOACCESS, addr OldProtect
%NTERR
mov Snapshot.GpLimit,ebx
mov Snapshot.GpBase,ebx
lea ecx,Snapshot.GpLimit
push eax
push eax
push eax
push eax
push eax
push GCBE_PARSE_NL_UNLIMITED
push GCBE_PARSE_DISCLOSURE
push ecx
push dword ptr [_imp__LdrLoadDll]
%GPCALL GP_PARSE
%NTERR
mov eax,fs:[TEB.Peb]
mov eax,PEB.Ldr[eax]
mov eax,PEB_LDR_DATA.InLoadOrderModuleList.Flink[eax]
mov eax,LDR_DATA_TABLE_ENTRY.InLoadOrderModuleList.Flink[eax]
mov esi,LDR_DATA_TABLE_ENTRY.DllBase[eax] ; ntdll.dll
invoke RtlImageNtHeader, Esi
%APIERR
mov ecx,IMAGE_NT_HEADERS.OptionalHeader.BaseOfCode[eax]
mov edx,IMAGE_NT_HEADERS.OptionalHeader.SizeOfCode[eax]
mov TraceData.Gp,NULL
add ecx,esi
lea edx,[edx + esi - sizeof $Message]
mov TraceData.Message,offset $Message
mov TraceData.MsgLength,sizeof $Message
mov TraceData.ScanBase,ecx
mov TraceData.ScanLimit,edx
lea ecx,TraceData
lea edx,TraceCallback
push ecx
push edx
push ebx
%GPCALL GP_TRACE
%NTERR
.if TraceData.Gp == NULL
Int 3
.endif
lea ecx,Gp
lea edx,Snapshot
push ecx
push eax
push eax
push 1
push eax
push TraceData.Gp
push edx
%GPCALL GP_SEARCH_ROUTINE_ENTRY
%NTERR
mov ebx,Gp ; ref.
mov eax,dword ptr [ebx + EhEntryType]
and eax,TYPE_MASK
.if Eax != HEADER_TYPE_CALL
Int 3
.endif
assume ebx:PCALL_HEADER

mov ecx,[ebx].BranchLink
lea eax,ArgsCount
and ecx,NOT(TYPE_MASK)
push eax
push ecx
%GPCALL GP_QUERY_ROUTINE_ARGS_NUMBER
%NTERR

invoke DbgPrint, addr $Ldrp, [ebx].BranchAddress, ArgsCount
ret
Ep endp
end Ep


test 4:real function length
Code:

.686p
.model flat, stdcall
option casemap :none

include \masm32\include\ntdll.inc
includelib \masm32\lib\ntdll.lib

.code GPECODE
include ..\Bin\Gpe.inc

GCBE_PARSE_NL_UNLIMITED equ -1

%NTERR macro
.if Eax
Int 3
.endif
endm

.data
pRoutine PVOID offset GPE ; Àäðåñ ðàçáèðàåìîé ïðîöåäóðû.
NestingLevel ULONG GCBE_PARSE_NL_UNLIMITED ; Óðîâåíü âëîæåííîñòè. Äëÿ îäíîé ïðîöåäóðû 1.

.code
$Msg CHAR "0x%X", 13, 10, 0

assume fs:nothing
Ep proc
Local GpBase:PVOID, GpLimit:PVOID, GpSize:ULONG
Local OldProtect:ULONG
mov GpBase,NULL
mov GpSize,1000H * X86_PAGE_SIZE
invoke ZwAllocateVirtualMemory, NtCurrentProcess, addr GpBase, 0, addr GpSize, MEM_COMMIT, PAGE_READWRITE
mov ebx,GpBase
%NTERR
add GpBase,0FFFH * X86_PAGE_SIZE
mov GpSize,X86_PAGE_SIZE
invoke ZwProtectVirtualMemory, NtCurrentProcess, addr GpBase, addr GpSize, PAGE_NOACCESS, addr OldProtect
%NTERR
mov GpLimit,ebx
mov GpBase,ebx
lea ecx,GpLimit
push eax
push eax
push eax
push eax
push eax
push NestingLevel
push GCBE_PARSE_DISCLOSURE
push ecx
push pRoutine
%GPCALL GP_PARSE
%NTERR

xor ebx,ebx
mov esi,GpBase
@@:
test dword ptr [esi + EhEntryType],TYPE_MASK
.if Zero? ; Line
add ebx,dword ptr [esi + EhSize]
.else
push dword ptr [esi + EhAddress]
%GPCALL GP_LDE
add ebx,eax
.endif
add esi,ENTRY_HEADER_SIZE
cmp GpLimit,esi
ja @b

invoke DbgPrint, addr $Msg, Ebx
ret
Ep endp
end Ep


I do agree with indy that no better example of what something does is illustrated in the source, though 'picking' it out for some is difficult..

regards BanMe

also if you didnt read the code be aware that it is from a older version of GCBE called GPE.. but it looks like all that code migrated so it should work with but a few tweaks.. enjoy..

Indy
December 6th, 2010, 11:33
GPE is engine creates a basic graph. GCBE an addon it. This part is designed to build the graph. Taken together, the engine allows you to separate the code.

BanMe
December 6th, 2010, 11:49
It's funny to see what a 'little' interest does to us.

Auspicious code btw Indy love it...I picked up asm again, just to understand its full potentials..and I've been working alot, so its taken quite a while...

Indy
December 6th, 2010, 11:57
See this example: http://indy-vx.narod.ru/Bin/Ki.zip ("http://indy-vx.narod.ru/Bin/Ki.zip")
You will understand how this powerful technique.

BanMe
December 6th, 2010, 12:07
also my isp seems to not like that website and denies access maybe a file or direct upload ive had to piece together code and search wasm for this stuff.. :/

a lil help would be great..

Indy
December 6th, 2010, 12:13
Оо.. Poor provider, once cut files. Probably because of the signature in the LDE

2367

BanMe
December 9th, 2010, 12:32
As dElta mentioned above about 'graph theory'.. This is not something I was familiar with ..So I decided to look into to this a little,very interesting subject thanks for the mention of it.

But the mention I think is not enough, to say you know of it is good(escially for me),but to show what it is and how it is described in mathmatical terms and graph(s).

http://www.personal.kent.edu/~rmuhamma/GraphTheory/graphTheory.htm

Quote:
[Originally Posted by evaluator]
problem not in weapon/not-weapon, but will be you sued for that-thing.

btw, for dld your zip, one must turn off AV. can that behavior avoided?


yes it can as indy mentions it is because of VirXAsm.b that ur av go's off..this is simply a viralized length disasm engine.. its not a virus...so this can be avoided by using some other form of Length disasm Engine.

kind regards BanMe

Indy
December 9th, 2010, 23:48
BanMe
Quote:
Тут сказали что этот семпл палится как Win32: DNSChanger-VJ. Так вот эта сигнатура лежит в дизасме длин(VirXasm32b). Для устранения проблемы добавить Nop по метке xa_no16.

Normally, this code should be morphe. This will break all the signature. You can use the generation of Nop-series in the simplest case.

BanMe
December 10th, 2010, 11:58
lol I'm not at all worried about it, I know of at least 3 or 4 length disasm engines that could suffice for this purpose.But thats not why Im posting so..

Ive modularized GCBE into a loadable dll and imported its functions into a c++ project, my first step was rewriting the examples and test them..

I started at the Relative Length example in my prior post..
Code:

ULONG GpGetRelativeLength(PVOID Ip)
{
PVOID GpBase,GpLimit;
ULONG GpSize = 0;
ULONG OldProtect;
ULONG TotalSize = 0;
//Create The Graph
GpBase = NULL;
GpSize = 0x1000 * X86_PAGE_SIZE;
if(NtAllocateVirtualMemory(NtCurrentProcess(),&GpBase, 0,&GpSize, MEM_COMMIT, PAGE_READWRITE) != STATUS_SUCCESS)
{
__asm int 3;
}
GpLimit = GpBase;
GpLimit += 0FFFH * X86_PAGE_SIZE;
GpSize = X86_PAGE_SIZE
if(NtProtectVirtualMemory(NtCurrentProcess(),&GpLimit,&GpSize, PAGE_NOACCESS,&OldProtect) != STATUS_SUCCESS)
{
__asm int 3;
}
GpLimit = GpBase;
//Parse the function to our graph.
if(GpParse(Ip,&GpLimit,GCBE_PARSE_DISCLOSURE,0,0,0,0,0,0) != STATUS_SUCCESS)
{
__asm int 3;
}
GpSize = QueryOpcodeSize(Ip);
Total Size = 0;
do
{
TotalSize += GpSize;
Ip = (PVOID)((*ULONG *)Ip +GpSize);
GpSize = QueryOpcodeSize(Ip);
}while(Ip > GpLimit);
return TotalSize;
}


I hope I got it correct ..

regards BanMe

Indy
December 10th, 2010, 13:07
BanMe
I used the best of the existing LDE. The signature is not an issue and will be established immediately for any static vx-code. Moreover we can use the system(Shim) LDE.

PAGE_NOACCESS used to set the limit buffer. When accessing the page buffer extends the same stack. In the examples of the extension is not implemented, and the buffer is used very large.

Each entry in the graph can describe a few instructions. The size of linear block defined in the entry.

BanMe
December 17th, 2010, 11:35
Maybe a extensible graph is more suitable for some..

Code:

PVOID GpExtendGraph(PVOID VmAddress)
{
PVOID GpBase,GpLimit;
ULONG GpSize = 0,OldProtect = 0;
MEMORY_BASIC_INFORMATION Mbi = {0};
GpBase = VmAddress;
if(NT_SUCCESS(NtQueryVirtualMemory(NtCurrentProcess(),GpBase,MemoryBasicInformation,&Mbi,sizeof(MEMORY_BASIC_INFORMATION),&GpSize)))
{
SwProtect:
switch(Mbi.AllocationProtect)
{
case PAGE_NOACCESS:
{
GpSize = X86_PAGE_SIZE;
if(NT_SUCCESS(NtProtectVirtualMemory(NtCurrentProcess(),&GpBase,&GpSize,PAGE_READWRITE,&OldProtect)))
{
GpLimit = (PVOID)((ULONG)GpBase + GpSize + 1);//next page
if(NT_SUCCESS(NtAllocateVirtualMemory(NtCurrentProcess(),&GpLimit,0,&GpSize,MEM_COMMIT,PAGE_NOACCESS)))
{
return GpBase;
}
}
break;
}
case PAGE_READWRITE:
{
GpBase = (PVOID)((ULONG)Mbi.BaseAddress + (ULONG)Mbi.RegionSize + 0x1);//next page
if(NT_SUCCESS(NtQueryVirtualMemory(NtCurrentProcess(),GpBase,MemoryBasicInformation,&Mbi,sizeof(MEMORY_BASIC_INFORMATION),&GpSize)))
{
__asm jmp SwProtect;
}
break;
}
default:
{
break;
}
}
}
return 0;
}
PVOID GpGraphInit(void)
{
PVOID GpBase = 0, GpLimit = 0;
ULONG GpSize = X86_PAGE_SIZE * 256, OldProtect = 0;
if(NT_SUCCESS(NtAllocateVirtualMemory(NtCurrentProcess(),&GpBase,0,&GpSize,MEM_COMMIT,PAGE_NOACCESS)))
{
GpSize = X86_PAGE_SIZE;
if(NT_SUCCESS(NtProtectVirtualMemory(NtCurrentProcess(),&GpBase,&GpSize,PAGE_READWRITE,&OldProtect)))
{
return GpBase;
}
}
return 0;
}


Im working on translating the comments in the code to english.

This really is quite the venture Indy, though more documentation of flags and parameters would really be a nice addition to this.

Indy
December 17th, 2010, 13:22
BanMe
The memory manager used in IDPE: 2369

Indy
December 18th, 2010, 17:50
Generation of Gs-series: 2375

evaluator
December 20th, 2010, 12:58
"bravo!"

what will your next step?
freeware-malware-cryptor?

Indy
December 20th, 2010, 23:36
evaluator
Has no relation to malware.

BanMe
January 22nd, 2011, 18:05
I really want to tell the signifigance of this code put in the correct 'spot' its a DBI,in another its a dynamic analysis tool of runtime memory...to be short and sweet code 'could' be mapped moved or w/e into any process and take instruction on how to analyze that processes memory..What each of the people that understands this code does is really up to them, but not much can hamper this technique..and I do not speak of stpt..I speak of the dagger not the cut made by it.

Indy
January 23rd, 2011, 02:32
Sample

2410

evaluator
January 23rd, 2011, 11:15
Indy, i have good anti-boring idea.
how about you will make CRACKME!?
that will some challenge..

Indy
February 19th, 2011, 08:55
Updated engine, now can capture threads

Indy
February 27th, 2011, 04:40
A small example of the detection of changes in the code.
2437
2438

BanMe
February 28th, 2011, 22:40
@evaluator:for some the 'ultimate CRACKME is 'you' or 'life lessons', or windows in this case..' my question is 'was the methodology needed to accomplish the task at heart?"

@Indy What of the other dll in the 'data of the first'.. :d