elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  Tutorial como poner tus procesos en PWNED
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Tutorial como poner tus procesos en PWNED  (Leído 1,689 veces)
Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Tutorial como poner tus procesos en PWNED
« en: 20 Marzo 2017, 12:25 pm »

Hola en este tutorial os enseñare a como poner tus procesos en PWNED con la siguiente apariencia:


El inyector:
Código:
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <Tlhelp32.h>
#include <wchar.h>
#include <iostream>
using namespace std;

void error(char *err);

HANDLE myProc = NULL;

void error(char *err)
{
if (myProc != NULL) CloseHandle(myProc);
printf("%s", err);
exit(0);
}

HANDLE Startpausedprocess( char* cmd, PHANDLE ptr_thread ) // cleaned up a bit, but no RAII
{
    if( ptr_thread == nullptr ) return nullptr ;

    PROCESS_INFORMATION pi;
    STARTUPINFOA si {} ; // initialize with zeroes.
    si.cb = sizeof(STARTUPINFOA);

    if( !CreateProcessA( nullptr, cmd, nullptr, nullptr, false, CREATE_SUSPENDED,
                         nullptr, nullptr, std::addressof(si), std::addressof(pi) ) )
    {
        std::cerr << "CreateProcess failed, " << GetLastError() << '\n' ;
        *ptr_thread = nullptr ;
        return nullptr;
    }

    *ptr_thread = pi.hThread;
    return pi.hProcess;
}


int main(int argc, char *argv[])
{
char cmd[] = "taskmgr.exe" ; // note: non-const (writeable array)
    HANDLE thread = nullptr ;
    auto myProc=Startpausedprocess( cmd, std::addressof(thread) ) ;
if(myProc)
    {
        std::cout << "press enter to resume process... " && std::cin.get() ;
        ResumeThread(thread) ;

        //CloseHandle(thread) ;
        //CloseHandle(myProc) ;
    }

// Reservar memoria para el argumento (ruta de la DLL)
char thData[] = "dllmain.dll";
LPVOID dirToArg = VirtualAllocEx(myProc, NULL, strlen(thData), MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (dirToArg == NULL)
error("[-] Error reservando memoria para argumento.\n");
else
printf("[+] Memoria reservada para argumento (%i bytes).\n", strlen(thData));


// Escribir la ruta de la DLL en la memoria reservada
SIZE_T written = 0;
if (WriteProcessMemory(myProc, dirToArg, (LPVOID)&thData, strlen(thData), &written) == 0)
error("[-] Error escribiendo memoria.\n");
else
printf("[+] Memoria escrita (arg %i bytes).\n", written);
//Lanzar un hilo con LoadLibrary
//Load the DLL
//Load the DLL
HANDLE rThread = CreateRemoteThread(myProc, NULL, NULL, (LPTHREAD_START_ROUTINE)GetProcAddress(LoadLibrary(L"Kernel32.dll"), "LoadLibraryA"), dirToArg, NULL, NULL);
if (rThread == NULL)
error("[-] Error creando el hilo.\n");
else
printf("[+] Hilo creado.\n");
CloseHandle(rThread);
}

El código, simplemente compilas en gcc y inyectais.
Código:
#include "stdafx.h"
#include "cabecera minhook"//MHook header
#include <iostream>
#include <windows.h>
#include <Commctrl.h>
#include <conio.h>

using namespace std;

typedef void (*SENDMESSAGEW)();//Typedef for the hooked function
static SENDMESSAGEW Basewritefoobar;//Backup of the originak fonction

static wchar_t pwned[]=L"PWNED";

LRESULT WINAPI BSSSendMessageW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
    if ( msg == LVM_INSERTITEMW || msg == LVM_SETITEMW)//Intercepts LVM_INSERTITEM and LVM_SETITEM messages
    {
        ((LVITEMW*)lparam)->pszText=pwned;//Replace the item text with our text.
    }
    return SendMessage(hwnd, msg, wparam, lparam);//Calls the real SendMessage function.
}

static bool Hook();

template <typename T>
inline MH_STATUS MH_CreateHookEx(void* target, void* const base, T** original)
{
    return MH_CreateHook(target, base, reinterpret_cast<void**>(original));
}


extern "C" __declspec (dllexport) void __cdecl SendWrite()
{

}

BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
//Different behaviors depending on the reason why DllMain is called
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
if (!Hook())//Hook "Writefoobar"
{
cout << "Hook failed" << endl;
return 1;
}
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}

return TRUE;
}

bool Hook()
{
    if (MH_Initialize() != MH_OK)
    {
        return false;
    }

    if (MH_CreateHookEx((void*)&SendMessageW, (void*)&BSSSendMessageW, &Basewritefoobar) != MH_OK)
    {
        return FALSE;
    }
    return MH_EnableHook((void*)&SendMessageW) == MH_OK;
}

Funcionara como filtro y cambiara la apariencia de vuestro administrador de tareas.


« Última modificación: 20 Marzo 2017, 12:52 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
z3nth10n


Desconectado Desconectado

Mensajes: 1.583


"Jack of all trades, master of none." - Zenthion


Ver Perfil WWW
Re: Tutorial como poner tus procesos en PWNED
« Respuesta #1 en: 20 Marzo 2017, 12:59 pm »

Y esto se puede deshacer o se va a quedar así para siempre? :silbar:


En línea


Interesados hablad por Discord.
Borito30


Desconectado Desconectado

Mensajes: 481


Ver Perfil
Re: Tutorial como poner tus procesos en PWNED
« Respuesta #2 en: 20 Marzo 2017, 13:05 pm »

Y esto se puede deshacer o se va a quedar así para siempre? :silbar:
Necesita funcionar como rootkit para que permanezca para siempre.. se puede ocultar el proceso, cambiar todos los procesos o hacerlos todos invisible tapar botones entre otras muchas cosas más..

Hace no mucho tiempo un compañero hizo un ejemplo en c# con las winapi y funcionaba como rootkit pero claro hay que implementarlo
« Última modificación: 20 Marzo 2017, 13:12 pm por Ragaza » En línea

Estoy en contra del foro libre y la Sección de juegos y consolas (distraen al personal)
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Tutorial-Poner imágenes en un post « 1 2 »
Sugerencias y dudas sobre el Foro
-sagitari- 13 12,180 Último mensaje 15 Octubre 2005, 18:27 pm
por Za3LoT
Tutorial: Poner Fotografías encima
Diseño Gráfico
Zedmix 2 5,498 Último mensaje 27 Abril 2009, 21:08 pm
por + enrique ZP
Re Pwned!
Foro Libre
Shell Root 8 4,261 Último mensaje 22 Junio 2010, 22:13 pm
por [D4N93R]
Tutorial:Como poner un mensaje al final de cada articulo que se publique en SMF.
Desarrollo Web
Graphixx 1 1,999 Último mensaje 12 Marzo 2011, 22:27 pm
por Graphixx
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines