When you download a large file such as a Linux distribution in the form of an ISO you should validate it to make sure that the file has downloaded properly.
CHRONO MA:GIA 2.5.0. By GungHoOnlineEntertainment. MD5, SHA-1, SHA-256 signatures. Uploaded June 11, 2019 at 7:13PM PDT by HoldTheDoor. Each unit is able to produce a MD5 hash in 68 clock cycles, and since the FPGA has a clock rate of 50 MHz this system is able to produce over 44 million hashes a minute. The MD5 hash is inputted by the user through a keyboard, and if the system finds a match, the clear text password is displayed on a VGA monitor.
In the past, there have been many ways to validate the authenticity of a file. At the crudest level, you can check the file size or you might check the date the file was created. You could also count the number of files in an ISO or other archive or if you are really keen you could check the size, date, and contents of every file within an archive.
The above suggestions range from ineffective to complete overkill.
One method that has been used for a number of years is for the developers of software and Linux distributions to provide an ISO which they send through an encryption method called MD5. This provides a unique checksum.
The idea is that as a user you can download the ISO and then run a tool which creates an MD5 checksum against that file. The checksum that is returned should match the one located on the website of the software developer.
This guide will show you how to use Windows and Linux to check the MD5 checksum of a Linux distribution.
Downloading a File With an MD5 Checksum
To demonstrate how to validate the checksum of a file you will need a file that already has an MD5 checksum available for it to compare against.
Most Linux distributions provide either an SHA or MD5 checksum for their ISO images. One distribution that definitely uses the MD5 checksum method of validating a file is Bodhi Linux.
You can download a live version of Bodhi Linux from http://www.bodhilinux.com/.
The linked page has three versions available:
- Standard;
- AppPack Release;
- Legacy Release.
For this guide, we will be showing the Standard Release version because it is the smallest but you can choose anyone you wish.
This makes it very difficult to read the results.Let's look at an easy example.Based on the Excel spreadsheet above, we can concatenate a space character using the & operator as follows: =A1 & ' ' & A2Result: 'TechOnTheNet.com website'In this example, we have used the & operator to add a space character between the values in cell A1 and cell A2. How to add text in excel formula. Example (as Worksheet Function)Let's look at some Excel & operator examples and explore hwo you would use the & operator as a worksheet function in Microsoft Excel:Based on the Excel spreadsheet above, the following & examples would return: =A1 & A2Result: 'Alphabet'='Tech on the ' & 'Net'Result: 'Tech on the Net'=(A1 & 'bet soup')Result: 'Alphabet soup' Concatenate Space CharactersWhen you are concatenating values together, you might want to add space characters to separate your concatenated values. Otherwise, you might get a long string with the concatenated values running together.
You'll want to download TWO files: The actual Bodhi Linux ISO, available at the Download link, and the MD5 File, which you'll want to open in Notepad, as below. You'll compare the checksum you see in the MD5 file with the checksum you'll get from the Command Prompt (below).
- First, download the ISO itself by clicking on the Download link just under the Standard Release section.
- Next to the download link you will see a link called MD5. Click it to download the MD5 checksum file to your computer.
- Next, open the file in Notepad. The contents will be something like this:
Verify the MD5 Checksum Using Windows
To verify the MD5 checksum of the Linux ISO or indeed any other file which has an accompanying MD5 checksum follow these instructions:
- Open Command Prompt.
- Navigate to the downloads folder by typing cd Downloads.Of course, if the file you want to check is not in the Downloads folder, you'll need to type the exact folder name, like cd 'folderpathhere'.
- Type certutil -hashfile followed by the file name and then MD5.
- Check that the value returned matches the value the MD5 file you downloaded from the Bodhi website (and opened in Notepad).
- If the values don't match then the file is not valid and you should download it again.
Verify the MD5 Checksum Using Linux
To verify the MD5 checksum using Linux follow these instructions:
- Open a terminal window by pressing ALT and T at the same time.
- Type cd ~/Downloads, or a different folder name if that's not where your file is stored.
- Enter md5sum followed by the file name.
- The value displayed by the md5sum command should match the md5 in the file displayed using the cat command in step 4.
- If the values do not match there is a problem with the file and you should download it again.
Issues
The md5sum method of checking the validity of a file only works as long as the site you are downloading the software from hasn't been compromised.
In theory, it works well when there are lots of mirrors because you can always check back against the main website.
However, if the main site gets hacked and a link is provided to a new download site and the checksum is changed on the website then you are basically being hoodwinked into downloading something you probably don't want to use.
Here is an article showing how to check the md5sum of a file using Windows. This guide mentions that many other distributions now also use a GPG key to validate their files. This is more secure but the tools available on Windows for checking GPG keys are lacking. Ubuntu uses a GPG key as a means for verifying their ISO images and you can find a link showing how to do that here.
Even without a GPG key, the MD5 checksum is not the most secure method for securing files. It is now more common to use the SHA-2 algorithm.
Many Linux distributions use the SHA-2 algorithm and for validating the SHA-2 keys you need to use programs such as sha224sum, sha256sum, sha384sum, and sha512sum. They all work in much the same way as the md5sum tool.
I. Thuật toán Base64EncodeThuật toán chia đầu vào thành những nhóm gồm 6bits (giá trị từ 0->63) và rồi chuyển chúng lại thành mã ASCII theo hình sau. Kỹ thuật coding này làm gia tăng kích thước file lên 33%, bởi vì 3 bytes trở thành 4 ký tự.
Lưu ý: Nếu như không đủ để gộp thành 6 thì thêm 0 cho đủ và có dấu = là ký tự đặc biệt để kết thúc trong trường hợp không đủ 3. Vì đầu vào theo encoding bằng base64 thì nó sẽ nhóm lần lượt 6 bit thành một và dựa theo bảng trên (64 kí tự) để quy đổi ngược lại ký tự.
Ví dụ:
‘A’ chuyển sang bit sẽ là 01000001
Nhóm 6 bit đầu sẽ trở thành 010000 còn dư 2 bit 01 thì thêm 0000 vào cho đủ 6 bit. Đối chiếu bảng trên ta có 010000 là Q. Vậy ký tự A sau khi encode base64 sẽ là QQ. Sở dĩ có 2 dấu là do, cứ 3 ký tự thông thường sẽ chuyển được 4 ký tự ở dạng Base64 và trường hợp này ko đủ nên xuất hiện hai dấu .
II. Kỹ thuật salt trong HASH.
Như ta đã biết MD5(haison) nó sẽ ra một HASH e9197849e07df68389b612875b22a03f (128 bits). Như vậy nếu có từ điển thì có thể so khớp hai HASH này với nhau nếu như trùng thì suy ngược lại chuỗi gốc. Để tránh tình trạng này thì có thể sử dụng kỹ thuật salt trong HASH như sau:
MD5(MD5(haison):key) như vậy HASH cuối cùng sẽ là kết quả của
MD5(e9197849e07df68389b612875b22a03f:key), như vậy khả năng mà e9197849e07df68389b612875b22a03f:key có trong từ điển là rất thấp.
Ví dụ trong Unix hash nó sẽ như sau: $uid:$salt:$password.
III. NT-LM
Sử dụng 32 ký tự và được sử dụng để mã hóa mật khẩu trong Windows. Và cũng giống như MD5, nó sử dụng salt để tăng tính an toàn. Trong Windows nó sử dụng như sau:
username:random:LM:NT::::
IV. Các bước nhận biết và giải mã
Ban đầu ta sẽ có tập ký tự nếu như mà thực hiện giải mã ngay có thể vấp một số trường hợp mà người lập trình có thể sử dụng nhiều kỹ thuật kết hợp, do vậy dẫn đến tốn thời gian trong việc giải mã mà không có kết quả gì. Do vậy sau khi ta có tập ký tự thì phải quan sát và phân tích nó trước, quy trình thì giống như hình trên.
Ví dụ nếu bắt gặp trong chuỗi nhận được có ký tự & hoặc = thì có thể phỏng đoán nó là HTML hoặc Base64.
Ví dụ 1 Bắt gặp một chuỗi như sau: JTNDcGFzc3dvcmQlM0QlMjJUJTNBaGFraW45JTNBVCUyMiUzRQ. Ta nhận thấy có dấu = có thể phỏng đoán nó dùng Base64. Do vậy ta dùng Base64decode và kết quả ta nhận được là %3Cpassword%3D%22T%3Ahakin9%3AT%22%3E, chúng ta lại thấy chưa phải là kết quả cuối cùng nhận được, quan sát tiếp ta lại thấy %num, có thể đây là URL char code và chúng ta decode tiếp một lần nữa:!password='T:hakin9:?, nhìn chuỗi bây giờ có thể xác định là chuỗi đích cần tìm.
Ví dụ 2: Bắt gặp một chuỗi như sau
YWM2MThiODhmNmNkODA4ZDk1ZmEzN2NiYTA2YWU1ZTA%3D, ta có quan sát chỉ thấy %3D là có thể encode bởi URL char code nên ta đổi ngay %3D--> = và ta có chuỗi mới YWM2MThiODhmNmNkODA4ZDk1ZmEzN2NiYTA2YWU1ZTA=. Có chuỗi mới ta lại phỏng đoán tiếp là có dấu =, khả năng này là Base64Encode, ta decode Base64 ta được như sau ac618b88f6cd808d95fa37cba06ae5e0 là một dang full hexa có chiều dài là 32, Do vậy nó là MD5
Toàn bộ tất cả quá trình trên có thể sử dụng công cụ Hackvertor ( http://hackvertor.co.uk/public) Nó sẽ có một số bước phân tích nhất định.
Một đoạn python script nhỏ tên Hash-ID v1.1 tôi tìm được trên Google Code , đoạn mã nay giúp nhanh chóng xác định đoạn hash , đoạn chuỗi (mật khẩu) bị encode bằng thuật toán nào. Để chạy đoạn script này bạn cần cài Python vào máy, rồi click chạy sript này ( trước đó đã được save vào một file text có phần mở rộng là .py )
Code:
Code: