Elton Stoneman

  Home  |   Contact  |   Syndication    |   Login
  120 Posts | 0 Stories | 3601 Comments | 0 Trackbacks

News

Archives

Post Categories

[Source: http://geekswithblogs.net/EltonStoneman]

I was debugging a particularly nasty problem and found myself wanting to edit the manifest of a compiled .NET assembly, to change the version number of the assemblies it was referencing. Not necessarily best practice, but in this case it would enable me to confirm the exact issue without a two-hour build-and-deploy cycle. Turns out that nasty hacks like this are very straightforward:

  1. Run ILDASM, open the assembly and choose File…Dump to extract the IL
  2. Open the IL file in Visual Studio and edit the manifest – in this case, the version numbers of the referenced assemblies are easily found at the top of the file:

    // Metadata version: v2.0.50727
    .assembly extern mscorlib
    {
      .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
      .ver 2:0:0:0
    }
    .assembly extern x.y.z
    {
      .publickeytoken = (E4 21 0D 54 23 66 A2 B4 )                         // . .D'f..
      .ver 1:0:9:12
    }

  3. Save the IL and reassemble it with ILASM – if the assembly was signed, re-sign it using ilasm /DLL x.y.z.il /KEY=x.y.z.snk
  4. Ensure the new assembly has the same name as the original, and it will operate as an exact replacement, only now its dependencies will be for the modified versions.

Simon McEnlly's article on CodeProject describes going further with the manifest to change the visibility of methods, and generally modifying and rebuilding assemblies where you don't have the source code. Note that if the assembly is signed and you don't have the strong name key to re-sign it, the modified assembly will warn about being tampered with and won't load.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Wednesday, March 11, 2009 5:44 PM

Feedback

# re: Hacking the Assembly Manifest 7/8/2009 9:59 AM Olurin Adeyinka
I need to know h0w to wrote the codes for a missing assembly manifest

# re: Hacking the Assembly Manifest 7/9/2009 7:16 AM Rick Ratayczak
When it comes to loading assemblies that are strong named, there are tools to re-sign it. see my blog for the code:
http://blogs.compdj.com/post.aspx?id=7c9a67a9-e5fb-4233-9278-c5385fe76ee1

# re: Hacking the Assembly Manifest 4/28/2010 7:56 AM neways-69
This was a very well-written blog.I like the way you describe all the things in this post.Thanks a lot for sharing.


# re: Hacking the Assembly Manifest 4/29/2010 2:24 AM weight-loss.78
I am following your blog regularly and got great information. I really like the tips you have given.Thank you so much for sharing this information. I have bookmarked this page for future use.

# re: Hacking the Assembly Manifest 5/20/2010 6:59 AM digital scrapbook49
Having written articles that require this much work, I commend you for your service to the future bloggers. I’m sure they will appreciate it! Really a great one.Thanks a lot.Keep blogging.

# re: Hacking the Assembly Manifest 5/25/2010 4:32 AM platinum protection63
Interesting post and thanks for sharing.I like the way you describe all the things and the examples.This is exactly what I've been looking for.Thanks again.Keep blogging.

# Assembled code 6/27/2010 12:31 AM Dust Collector Bag
That's the problem with assembled type code, it's hard to look under the hood.

# re: Hacking the Assembly Manifest 9/18/2010 4:59 AM Charlotte Real Estate
Your posts are always so interesting and informative.I was very pleased to find this site.I wanted to thank you for this great read!keep blogging.

# re: Hacking the Assembly Manifest 11/16/2010 8:38 AM loans mortgages
A nasty hack, but it worked for you, well done.

# re: Hacking the Assembly Manifest 11/16/2010 8:41 AM compare exchange rates
Assebled code is a right sod sometimes a hack is the only way.

# re: Hacking the Assembly Manifest 12/18/2010 4:32 PM Strompreisvergleich
Thanks vor this Posting, yor Blog ist god for my

# re: Hacking the Assembly Manifest 1/10/2011 11:39 AM BMI berechnen
Thx a lot for this code...well done

# re: Hacking the Assembly Manifest 3/29/2011 6:38 AM p90x reviews
I found this blog was very well written and very informative too. I have gone through it's details and got a lot of useful tips. Looking forward for more information....

# re: Hacking the Assembly Manifest 5/17/2011 6:47 AM London oriental escorts
The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post.


# re: Hacking the Assembly Manifest 6/5/2011 12:24 AM London Escorts
Very impressive article, rarely do we encounter one that’s both educative and entertaining, check us out and one of us could be visiting you soon… Indian escorts London

# re: Hacking the Assembly Manifest 2/5/2012 11:33 AM Shawn
Your a bunch of punk bitch's!!! I dare you to do your worst!
Shawn Jeffrey Weightman 
Lucerne on the lake
5877 Lake Street #14
County Road 307 Ad
Lucerne CA. 95458
DOB: 12/28/1987 
SSN: 608-05-3134
Plate# 4EEU074

I don't think a single one of you has the balls to come after me. I challenge anyone to try something. I give you my full permission to use my info and take full responsibility for the outcome. So, bring it on!!!

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: