Open vaibhavrmore1 opened 3 years ago
As far as I can tell, that's just dotPeek telling you the SHA1 of the whole file, it's not an actual header inside the file.
So there shouldn't be any security issue here.
Modifying (or recreating) an executable and making it have the same hash is still not trivial, not even for SHA-1.See the below link for more Information https://crypto.stackexchange.com/questions/48289/how-secure-is-sha1-what-are-the-chances-of-a-real-exploit
using System; using System.IO; using System.Security.Cryptography;
class Program { static void Main() { string filePath = "path_to_your_file.exe"; FileInfo fileInfo = new FileInfo(filePath);
if (fileInfo.Exists)
{
using (FileStream fileStream = fileInfo.OpenRead())
{
using (SHA1Managed sha1 = new SHA1Managed())
{
byte[] hash = sha1.ComputeHash(fileStream);
string sha1Hash = BitConverter.ToString(hash).Replace("-", string.Empty);
Console.WriteLine("SHA1 Hash: " + sha1Hash);
}
}
}
else
{
Console.WriteLine("File does not exist.");
}
}
}
**Please be informed the path has to be changed.
The metadata of the .Net EXE shows that it has been using SHA1 for its internal purpose. The property navigation is : Metadata->Headers->FileInfo->SHA1
Steps to reproduce:
Create any console app with .Net Framework or.Net Core Generate the EXE Use any .Net Reflector to view Metadata. For Eg. dotPeek Load the EXE and navigate to the above path - Metadata->Headers->FileInfo->SHA1 It shows SHA1 is key and has some value associated with it. Screenshot of the same:
Questions: As it is known that SHA1 is not secure and SHA256 should be used everywhere.
What is this property about and where is it used internally? Do we have the option to change it to SHA256 due to security reasons?