简体   繁体   中英

C++, Winsocket DLL Send injection

Thanks for reading. I've been trying to send packets with "send" from Winsock from an injected DLL, but i coulnd't do it, i've seen alot of guides about HOOKING "recv" and "send", but not about sending packets by using "send" or "WSASend" and the same socket, is there a way to use "send" and use the same socket?, should i get the socket handle?. Thanks

should i get the socket handle?

Yes if you can get the socket handle, I don't see what the problem could be: because your injected DLL is running inside the same process, it is allowed to use the existing handle (if you can discover the handle value, perhaps by hooking one of the socket functions to see what socket handle the hooked application is using).

You probably can't reopen the same socket to get a new handle of your own.

There might be several reasons. Some of them I might think of:

  1. You are trying to send to the socket that has already been closed. If you are doing you send() calls asynchronously to the main application activity, the application might have already closed the socket by the time you are trying to send. Try to send within the hook function for send() or recv() calls on the socket that you are using to send your data.
  2. There is another send() call on the same socket in another thread.
  3. The buffer length parameter is not aligned with the real buffer length (might occur if you just change the buffer parameter, but leave the length parameter intact from the original call)

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM