Suppose I build a .NET assembly and don't have it signed with a strong name, then it is copied to some storage, then to another and then it ends up in production. If a bit or two of the assembly contents get accidentally changed (some hardware problem or something like that) is there a chance that .NET runtime doesn't notice it and still considers the assembly image valid?
Write this program:
using System;
namespace ConsoleApplication13
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello world!");
}
}
}
compile it, run it...
Now open it in Notepad++, go to Find, select Extended research type, search for H\0
... Find the H NUL e NUL l
... and replace the H
with a X
... Save and relaunch...
Xello world!
Note that strong named assemblies aren't verified normally... Try to add a strong name... compile... run
sn -v yourprogram.exe
and check that it is correct...
now modify it... rerun the
sn -v yourprogram.exe
and see that the validation fails...
now try to run it... It runs correctly!
From MSDN
Starting with the .NET Framework version 3.5 Service Pack 1 (SP1), strong-name signatures are not validated when an assembly is loaded into a full-trust AppDomain object, such as the default AppDomain for the MyComputer zone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With