Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Private Server > SRO PServer Guides & Releases
You last visited: Today at 11:32

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Guide] Injecting DLL into silkroad exes without loader

Discussion on [Guide] Injecting DLL into silkroad exes without loader within the SRO PServer Guides & Releases forum part of the SRO Private Server category.

Reply
 
Old   #1
 
Hedgehock's Avatar
 
elite*gold: 0
Join Date: Oct 2015
Posts: 45
Received Thanks: 81
Arrow [Guide] Injecting DLL into silkroad exes without loader

Injecting a DLL into windows x86 PE on startup without using external injector.

First of all, sorry for my bad english. Russian is not allowed here, so, deal with it. I really hope you can understand this, lol. I do know there are some guides to do this out there. But this is focused on sro, and I do actually give support to people having issues.

Sorry for the images. They will be visible as soon as I get premium subscription or 20 posts, I guess.

1. Purpose
As many of you already know, there are multiple dll injectors out there. Unfortunately, they run as external process (in most cases, it's totally okay, unless you don't want each of your dll users to inject it manually each time he starts your redistributed exe/dll). This guide will explain you the basic idea of manual dll injection.

2. Requirements
OllyDbg 1.10
PE Explorer (trial)



3. Theory
Each Windows executable has so called header. All we have to know for now is that header has the following stucture:



The only thing that interests us is PE Header which contains OEP (Original Entry Point). OEP value is an address from where execution of program will start. This is important because we are going to change it to our own code address, which will load the desired DLL and go back to the original entry point address, so program flow executes as normal after our "dirty job" is done. We can divide dll injection into 7 simple steps.

1. Locate OEP
2. Find free space for your dll loading code
3. Replace OEP with your code address
4. Write DLL name to some place in executable.
5. push dll name address to stack
6. call kernel32.LoadLibraryA
7. return to the original entry point

4. Implementation
What we will do inject a really basic dll into silkroad.exe. First of all, you will need to find the original entry point of silkroad.exe. This can be done by running PE Explorer your previously installed. Simply open silkroad.exe and take a look at "Address of entry point" field.



You will need to copy it somewhere (ex: some text file).

For now, that's all we need from the PE Explorer.
Let's run OllyDbg 1.10 and go to the OEP. This can be done by opening silkroad.exe, pressing CTRL + G and pasting OEP you got from PE Explorer and hitting enter. After you are done, you should see something like this at the left side of OllyDbg window:



Now, we have to find some empty space for our code. Normally you can just scroll down to the buttom until you each the end:



I've selected
Code:
00497F7A   0000             ADD BYTE PTR DS:[EAX],AL
Since 0x00497FFE (section end) - 0x00497F7A (our code start address) = 84 bytes, which should be totally enough for both dll name ascii string and dll loading code itself. Now we have to put our dll name somewhere near the code (remember, it will take some space... so move it after or before expected code position for ~ 20 - 30 bytes at least). This can be done by selecting multiple lines (should be enough space for your dll name string) and pressing pressing CTRL + E. Entering your dll name into ASCII field and pressing OK button. I've chosen address starting from 0x0049F96. When we will do push to stack, we will need to specify that one.



Now we do have desired dll name writen into silkroad.exe, and we can use it for LoadLibraryA function call. You should have something like this:



Now what we have to do is to write a little a little codecave which will load our dll.

Code:
push <dllNameAddr>
call LoadLibraryA
jmp <oep>
<dllNameAddr> = 00497F96
<oep> = 004778D0 (see in PE Explorer, or loop at olly EIP register value on the right upper corner).

When you are done, everything should look like this:



Now we have to save our changes made in olly. To do this, right click somewhere on frame you did put your code / dll name in and select Copy to executable -> All Modifications and save your silkroad.exe to any place you want.
There's just one step left now. You have to modify your original OEP to the new one (where you did put your CODE at).

Open the saved exe with PE Explorer, and mofiy OEP (004778D0) to 00497F7A
. Press the green button near OEP text box, and go to File -> Save file as... and save it to some location (most likely, in our case, game client folder).

And you're done. Now just place dll that has DllMain function in same folder as your modified exe, and run it. Dll should load at startup.


Update: Added a youtube video.

If you still got any questions, feel free to contact me.

Skype: hedgehock94
Hedgehock is offline  
Thanks
18 Users
Old 11/11/2015, 09:31   #2
dotCom
 
Devsome's Avatar
 
elite*gold: 12400
The Black Market: 104/0/0
Join Date: Mar 2009
Posts: 15,880
Received Thanks: 4,386
Quote:
Originally Posted by ​Exo View Post
ugay
When you are quoting him only for the pictures, nice comment.



@B2T: This tutorial will hopefully help other players :3
Devsome is offline  
Old 11/11/2015, 10:03   #3

 
AceSpace's Avatar
 
elite*gold: 71
Join Date: Mar 2011
Posts: 1,594
Received Thanks: 1,099
I find this way too hard to understand lol.. Doing it by urself by trying would be have been better also it won't work. You cannot select many lines for the binary.. (Result: Dll won't be detected due to wrong name)
AceSpace is offline  
Old 11/11/2015, 10:48   #4
 
elite*gold: 1
Join Date: Aug 2015
Posts: 55
Received Thanks: 19
way hard lol but thanks for your time!
Konami$ is offline  
Old 11/12/2015, 02:21   #5
 
Hedgehock's Avatar
 
elite*gold: 0
Join Date: Oct 2015
Posts: 45
Received Thanks: 81
Youtube video added.
Hedgehock is offline  
Thanks
1 User
Old 11/13/2015, 04:42   #6
 
elite*gold: 2
Join Date: Aug 2011
Posts: 833
Received Thanks: 1,130
This is basically the same as what drew (pushedx) posted in 2011... with more pictures

Good job though.
Timlock is offline  
Thanks
1 User
Old 11/14/2015, 21:40   #7
 
elite*gold: 0
Join Date: Feb 2008
Posts: 339
Received Thanks: 72
Can we call 2 *.dll like that?
If yes, jmp 1st to second and 2nd to OEP or w/e is called?
pushipu is offline  
Old 11/15/2015, 11:30   #8
 
Hedgehock's Avatar
 
elite*gold: 0
Join Date: Oct 2015
Posts: 45
Received Thanks: 81
You are completely right, pushipu. Yes, you can load multiple dlls. It would look something like this:


Code:
push <dllNameAddr1>
call LoadLibraryA
push <dllNameAddr2>
call LoadLibraryA
jmp <oep>
Hedgehock is offline  
Thanks
2 Users
Old 11/18/2015, 14:50   #9
 
SnapPop's Avatar
 
elite*gold: 0
Join Date: Jun 2012
Posts: 113
Received Thanks: 59
dam, all that time i use ollydbg to change OEP while another easier solution is existing xP
btw i wonder is this the way that increase the executable's size ?
for ex: hyperfilter injecting their dlls into sro exes , increasing their default size
at last nice generic guide Hedgehock
SnapPop is offline  
Old 11/18/2015, 15:06   #10


 
​Exo's Avatar
 
elite*gold: 28
Join Date: Aug 2014
Posts: 4,096
Received Thanks: 2,649
Quote:
Originally Posted by SnapPop View Post
dam, all that time i use ollydbg to change OEP while another easier solution is existing xP
btw i wonder is this the way that increase the executable's size ?
for ex: hyperfilter injecting their dlls into sro exes , increasing their default size
at last nice generic guide Hedgehock
Injecting dlls has nothing to do with the binary size. The point of injecting dlls instead of using any external tools is that a dll will share the same memory of its host so it'll be much easier to access the memory anytime you want once injected. That's all.
​Exo is offline  
Old 11/28/2015, 07:16   #11
 
Hedgehock's Avatar
 
elite*gold: 0
Join Date: Oct 2015
Posts: 45
Received Thanks: 81
SnapPop. What you are talking about is called binding. Yes, you can put your dll code directly into the target executable. It's pretty hard doing it by hand, but well... there are some pretty good binders available on the internet. Check
Hedgehock is offline  
Old 03/09/2016, 10:51   #12
 
elite*gold: 0
Join Date: Nov 2012
Posts: 4
Received Thanks: 0
Quote:
Originally Posted by Hedgehock View Post
SnapPop. What you are talking about is called binding. Yes, you can put your dll code directly into the target executable. It's pretty hard doing it by hand, but well... there are some pretty good binders available on the internet. Check
Hello , can you help me .
atahan457 is offline  
Old 09/01/2016, 16:49   #13
 
Hedgehock's Avatar
 
elite*gold: 0
Join Date: Oct 2015
Posts: 45
Received Thanks: 81
Feel free to request more guides.

Skype: live:cherno0x33
Hedgehock is offline  
Old 09/26/2017, 16:19   #14
 
athena1410's Avatar
 
elite*gold: 0
Join Date: Jul 2017
Posts: 118
Received Thanks: 65
I injected my dll in your way. It worked (hwid sent to my server) but when i copied (sro_client and dll) to sro folder in other computer. it not worked ( hwid not sent to server )
athena1410 is offline  
Old 09/27/2017, 22:35   #15
 
DjAlejo's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 256
Received Thanks: 60
lol you are very funny
DjAlejo is offline  
Reply

Tags
dll, injection, silkroad


Similar Threads Similar Threads
[Guide] Creating a Simple Loader with Injected DLL for Silkroad
02/02/2016 - SRO Coding Corner - 37 Replies
This next article in my series is a very important one for anyone wanting to get started with client modifications or understanding the client itself. This is the base article that will be used for all my future articles that explain various Silkroad development concepts. Like my previous article, there is nothing terribly exciting with this one as we have to get through the necessary boring stuff first before we can have any real fun. Unfortunately, this article is very heavy text wise and...
Guide for INJECTING for NEWBIE.
12/16/2009 - Soldier Front Hacks, Bots, Cheats & Exploits - 18 Replies
Normal Injecting: Open injector Change Gunz.exe to specialforce.exe/soldierfront.exe Browse the file/DLL Log in and play. USB Method:



All times are GMT +2. The time now is 11:32.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.