![]() |
|
|
|
#1
|
|||
|
|||
|
How to Patch (IL Edit) of Assembles loaded from Resource
I'm currently debugging a .NET DLL that, upon execution, loads some dependencies using the:
C#: Code:
Assembly.Load |
|
#2
|
|||
|
|||
|
The only thing I can think of is to insert a DebugBreak() into the .NET DLL. Maybe some has a better solution.
|
| The Following User Says Thank You to Stingered For This Useful Post: | ||
cracki (01-08-2024) | ||
|
#3
|
|||
|
|||
|
Quote:
Quote:
|
|
#4
|
|||
|
|||
|
Quote:
If I save a version of the DLL that has been extracted from the embedded state alongside the program and somehow (as per the techniques mentioned in the tutorial you provided) remove the "module initializer" so that "the embedded references will be ignored when running the binary" will the program then use the file I saved and patched? |
|
#5
|
|||
|
|||
|
Quote:
As long as the executable has import references to functions in the patched DLL. You should save it in the same folder the calling executable is in. This is same principle why proxy dll or DLL hijacking works. |
| The Following User Says Thank You to th3tuga For This Useful Post: | ||
cracki (01-13-2024) | ||
|
#6
|
|||
|
|||
|
I do not understand. Can someone explain with a simple example?
|
|
#7
|
|||
|
|||
|
Quote:
Then edit the dumped dll with your patches. Remove the dll module initialize including the load statements from the exe. Place the edited dll in the same folder with the exe and run. That's all. I also use the nick Selya on some forums, since you cannot PM me here. I respond only to known people though (no crack requests please). |
|
#8
|
|||
|
|||
|
@th3tuga, would ILmerge be useful here?
|
|
#9
|
|||
|
|||
|
In this case I think that you should write your own hooking program to dynamically patching the DLL during runtime. LibHarmony should make in-memory patching becomes easier. Just need to wait until the dll is loaded into memory and then call your patching module.
__________________
My Personal Blog:http://ltops9.wordpress.com |
| The Following User Gave Reputation+1 to Levis For This Useful Post: | ||
ahmadmansoor (01-09-2024) | ||
| The Following 3 Users Say Thank You to Levis For This Useful Post: | ||
|
#10
|
|||
|
|||
|
Thanks a bunch for the tip!
My target is a .NET Core app without plugin support. What's the best way to inject LibHarmony Patcher? One of examples in the docs that works on my case, involve npm, which seems odd for my case. Any other methods you know of? |
|
#11
|
|||
|
|||
|
Quote:
Remember that if your target is .NET Core, your hooking DLL must be .NET Core, too. Exact Runtime and exact version. For e.g, Target is .NET 6, then your code must be .NET 6, and so on. If using function name is hard (when it's obfuscated), then you can try to resolve method using Method token. There is no big difference.
__________________
My Personal Blog:http://ltops9.wordpress.com |
| The Following User Says Thank You to Levis For This Useful Post: | ||
niculaita (01-13-2024) | ||
|
#12
|
|||
|
|||
|
Quote:
![]() One other question: How i can "resolve method using Method token" by HarmonyLib? is this possible? Thanks again for the valuable insight! |
|
#13
|
|||
|
|||
|
And how i can Patch something like this in 0Harmony?
![]() The name of method is "\uE000" Code:
private LicenseStatus \uE000(){
...
|
|
#14
|
|||
|
|||
|
Quote:
|
| The Following User Says Thank You to Aakriti For This Useful Post: | ||
cracki (01-14-2024) | ||
|
#15
|
|||
|
|||
|
have you tried dnSpyEx?
patch inside it (at IL level) then save patched binary -> Profit |
![]() |
| Tags |
| .net, assembly, dnspy, dotnet |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Olly Crash when this simple app loaded... | kunam | General Discussion | 6 | 10-10-2023 21:00 |
| Question on IDA's Edit|Patch program? | boya | General Discussion | 2 | 10-23-2004 01:36 |
| IDA Pro (what happened to edit->patch) | ReDucTor | General Discussion | 3 | 08-31-2004 21:02 |
| Modules loaded by a exe | loman | General Discussion | 15 | 05-18-2004 22:37 |