PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Suche nur einen Tipp zum ins Arbeitsspeicher laden



rtroeger92
10.09.2008, 08:19
ALso ich habe schon die Sufu genutzt, falls ich aber was übersehen haben sollte, bitte darauf hinweisen.

Ich beschäftige mich mit c++ seit .a. 1 Jahr mit ein paar Aussetzer zwischendrin und habe mich auch schon das PE Format angeschaut.
Einen Binder habe ich auch schon programmiert, was eher leicht im Gegensatz zu einem Crypter ist. Trojaner vor AV's Mittels weghexxen und EP Point verschieben kann ich auch. Nur jetzt versuche ich mich an einem Crypter. Verschlüsseln kann ichs schon und mit einer Stub zusammenbinden. Also bitte nicht mit Antworten, wie z.B. lern erstmal c++ und setz dich mit dem PE Format auseinander, kommen.

Was ich will sind nur Tipps und Anregungen, wie ich meine gecryptete exe
in den Arbeitsspeicher laden kann. Ob das mit speziellen Strings oder mit mit ASM Befehlen sind. Wenn es geht mit Beispielen oder Internetlinks. Ich brauche keine Komplettlösungen, nur Anregungen unter was ich weiter Nachforschen muss, denn ich habe überhaupt keinen Ansatzpunkt, wie ich weiter verfahren soll.

Vielen Dank schonmal im voraus :)

EDIT: Ich habe vergessen zu schreiben, dass ich mich an einem Crypter versuche :wink:

TiduS
10.09.2008, 14:41
Ich weiß nicht,ob ich Dich richtig verstanden habe,aber wenn ja:
Schau dir mal die Speicherallokation ausführlich an.

rtroeger92
10.09.2008, 14:56
Werde ich mir mal anschauen.
Wer mich sonst noch nicht verstanden hat:
ich will mir einen exe Crypter coden und weiß nicht, wie ich die exe in den RAM laden soll.

Added after 3 hours 17 minutes:

Hat noch jemand andere Tipps?

]=-antr4xx-=[
10.09.2008, 23:29
Wahrscheinlich genau das richtige für dich:

http://www.security.org.sg/code/loadexe.html





SIG^2 Secure Code Study Project Proof-Of-Concept

Dynamic Forking of Win32 EXE
by Tan Chew Keong
7 April 2004

Download

Introduction

This Proof-Of-Concept (POC) code demonstrates the dynamic loading of a Win32 EXE into the memory space of a process that was created using the CreateProcess API with the CREATE_SUSPENDED parameter. This code also shows how to perform manual relocation of a Win32 EXE and how to unmap the original image of an EXE from its process space.

Description of Technique

Under Windows, a process can be created in suspend mode using the CreateProcess API with the CREATE_SUSPENDED parameter. The EXE image will be loaded into memory by Windows but execution will not begin until the ResumeThread API is used. Before calling ResumeThread, it is possible to read and write this process's memory space using APIs like ReadProcessMemory and WriteProcessMemory. This makes it possible to overwrite the image of the original EXE with the image of another EXE, thus enabling the execution of the second EXE within the memory space of the first EXE. This can be achieved with the following sequence of steps.

1. Use the CreateProcess API with the CREATE_SUSPENDED parameter to create a suspended process from any EXE file. (Call this the first EXE).

2. Call GetThreadContext API to obtain the register values (thread context) of the suspended process. The EBX register of the suspended process points to the process's PEB. The EAX register contains the entry point of the process (first EXE).

3. Obtain the base-address of the suspended process from its PEB, i.e. at [EBX+8]

4. Load the second EXE into memory (using ReadFile) and perform the neccessary alignment manually. This is required if the file alignment is different from the memory alignment

5. If the second EXE has the same base-address as the suspended process and its image-size is <= to the image-size of the suspended process, simply use the WriteProcessMemory function to write the image of the second EXE into the memory space of the suspended process, starting at the base-address.

6. Otherwise, unmap the image of the first EXE using ZwUnmapViewOfSection (exported by ntdll.dll) and use VirtualAllocEx to allocate enough memory for the second EXE within the memory space of the suspended process. The VirtualAllocEx API must be supplied with the base-address of the second EXE to ensure that Windows will give us memory in the required region. Next, copy the image of the second EXE into the memory space of the suspended process starting at the allocated address (using WriteProcessMemory).

7. If the unmap operation failed but the second EXE is relocatable (i.e. has a relocation table), then allocate enough memory for the second EXE within the suspended process at any location. Perform manual relocation of the second EXE based on the allocated memory address. Next, copy the relocated EXE into the memory space of the suspended process starting at the allocated address (using WriteProcessMemory).

8. Patch the base-address of the second EXE into the suspended process's PEB at [EBX+8].

9. Set EAX of the thread context to the entry point of the second EXE.

10. Use the SetThreadContext API to modify the thread context of the suspended process.

11. Use the ResumeThread API to resume execute of the suspended process.

rtroeger92
11.09.2008, 12:47
Danke, genau das habe ich gesucht.
Eine andere Frage:
welcher Compiler ist um sowas zu coden am besten geeignet...mit meinem dev c++ komme ich da nciht weiter und mit borland und microsoft auch nicht

l0dsb
11.09.2008, 12:55
Der Compiler ist egal, wenn du weißt, wie du es umsetzen musst.

RolF32
11.09.2008, 13:18
Würde ich auch sagen ,,,,

Hast du schon mal gegooglet??

Mfg

Rolf

rtroeger92
12.09.2008, 21:31
Danke ]=-antr4xx-=[, dein Tipp war Gold wert.
Konnte mir nun nach 2 Tagen tüfteln einen billigen Crypter bauen, der bis auf 4 AV's auf virusscan.jotti FUD ist.
Werde nun noch weiter bis er FUD macht tüfteln.
Nochmals Danke.

Added after 14 hours 2 minutes:

!! Achtung: eine Frage für fortgeschrittene Programmierer oder Exe Kenner !!

Nun stehe ich vor einem erneuten Problem, zu der ich eine Frage habe.
Ich habe meinen Crypter nun so programmiert, dass er jede Section in der Exe durchgeht und verschlüsselt(Ausnahme: Section mit SizeofRawData = 0),
welche die gebundene stub wieder entschlüsselt.
Allerdings funktioniert es nicht und es kommt KEINE Error Meldung.
(Ich denke, dass das Programm einfach abstürtzt.)
Also habe ich mich auf die Suche nach dem Fehler gemacht und bin zu dem Ergebnis gekommen, dass wenn ich nur die Sections, die in der Characteristic !!KEINE!! INITIALIZED_DATA:READ haben, nehme, funktioniert der Crypter tadelos und das Programm wird beim ausführen gestartet.
Nun zu meiner Frage.
Kann es sein, dass man die Sections mit der obengenannten Characteristic nicht verschlüsselt in den Arbeitsspeicher laden darf?

Ich danke schonmal im voraus.
Falls es Fragen gibt, bitte melden.