1

I'm new to security field. I have a website. Whenever I upload a photo to the website that, for example, its name is 123 with the format of .jpg, its name seems to turn to string like this f408KFcUb+k=. The address for reaching this image will be something like this:

example.com?imgID=f408KFcUb%2bk%3d

If I upload the same photo again, its name will turn to another string on the website.

It seems that the name is being encrypted or encoded, Am I right? If so, is there any way to find out what encryption algorithm is being used for encrypting the names of the files?

Pablo
  • 123
  • 1
  • 5

1 Answers1

0

Yes, there are several potential ways to find out, what algorithm was used. But lets analyze what is actually happening first.

Unrestricted file uploads are dangerous. Therefore, several different measures are suggested to protect against the different threats, including the following (quoted from the linked OWASP page):

It is recommended to use an algorithm to determine the filenames. For instance, a filename can be a MD5 hash of the name of file plus the date of the day.

This is very likely what is happening here, except that it isn't simply an MD5 hash. There are different ways to find out, which algorithms is used:

  1. Consult the manual. If you can find out, which software runs this part of the website, chances are, that they actually describe this mechanism in the docs. Easy as that.

  2. Check the source code. I'm still assuming you know which software runs this part of the website. Further I'm assuming it is an open source project. In this case you can download the source code and check directly, which functionality is used.

  3. Reversing the algorithm. In case the website is a black box for you, you can try to analyze the algorithm per hand. I did some quick manual checks and it looks like a base64 encoded value with a length of 64 bits (0111111110001101001111000010100001010111000101000110111111101001). This could be the result of a hash function but also something highly proprietary. As a next step you can try to compare the values of different uploads to see if the whole sequence changes or just part of it. Without further insights it will most likely be pretty hard to reverse the algorithm, but at least it is an option.

Please note that it can be something totally different like a random unique ID that points to a blob in a database, where the file is stored. With so little information, this is all guesswork.

Demento
  • 7,249
  • 5
  • 36
  • 45