### HYPERHYPERHYPERCUBELOVER's blog

By HYPERHYPERHYPERCUBELOVER, history, 2 years ago, ,

I have noticed a strange feature while conducting some experiments. Look at the following. My large profile picture and small profile picture look different.

#### I can't believe that.

You can see that my profile pictures look different here and here. Still not convinced? Upload this and check how your profile pictures are changed.

#### Why does this happen?

I uploaded this to change my profile picture. The result was interesting. The large profile picture was almost black, but the small was white. I thought that Codeforces uses Nearest-neighbor interpolation to scale pictures in proper sizes. (This is just a guess!)

Nearest-neighbor interpolation selects the value of nearest point and does not consider the values of neighboring points at all. I tracked which values are used and found how to make profile pictures look different.

#### So, how did you do it?

I used this python script to create a 3600x3600 image that will make your profile pictures look different. Requirements are Python 3 and PIL. First, save a 300x300 image that you would like you use as the large profile picture as pic1.png. Likewise, save a 80x80 image for the sub profile picture as pic2.png. Finally, run the script and upload pic.png. pic1.png will be the large profile picture, while pic2.png being the small profile picture.

I hope you love this feature :D

•
• +672
•

 » 2 years ago, # | ← Rev. 3 →   +68 Thanks to Nemmo and Bus for revising this article.
•  » » 21 month(s) ago, # ^ |   0 I used your code several times, and it fail once because the image i was using had 4 channels instead of 3, (r, g, b, alpha). With a minor fix, it works perfectly.
 » 2 years ago, # |   +46 god
 » 2 years ago, # |   +131 I did it with cute Flareon :D
•  » » 2 years ago, # ^ |   +11 and I did it with two versions of Umaru :D
•  » » » 2 years ago, # ^ |   +1 Awesome! XD
 » 2 years ago, # |   +151 Man, that's the coolest blog I have seen in a while :D
 » 2 years ago, # |   +85 Something similar: http://thume.ca/projects/2012/11/14/magic-png-files/It also reminds me for this: CVE-2010-3970 Windows were using something more complicated than Nearest-neighbor interpolation to generate thumbnails, but it have an overflow bug and so one can embed any code into that picture to be executed when generating thumbnail.)
•  » » 2 years ago, # ^ |   +5 Do you study Network Security or something like that at USC or is it some kind of hobby? I mean how do you know about this vulnerability? Just really curious...
•  » » » 2 years ago, # ^ | ← Rev. 2 →   +5 I used to upload large pictures to change my profile images, but the results were noisy. They looked really bad. I tried to reduce noise, and that's how I found out this vulnerability.
•  » » » 2 years ago, # ^ |   +6 There was a popular post in China few years ago: if you save the picture locally, thumbnail will show something different in Windows XP. (Like this one: http://blog.csdn.net/vince6799/article/details/1810458)The vulnerability was mentioned [here] in a Chinese website. (http://www.baike.com/wiki/%E7%BC%A9%E7%95%A5%E5%9B%BE%E6%BC%8F%E6%B4%9E).
 » 21 month(s) ago, # |   0 Running the script gives an error : "IndexError : image index out of range " .
•  » » 21 month(s) ago, # ^ |   0 I'm not sure but I think the resolution for the image your using is incorrect.use 300x300 resolution for the big image and 80x80 resolution for the small image.
 » 21 month(s) ago, # |   0 Nice post, kudos for you.I don't know if this is really a feature or a bug, but I hope they keep it :)
 » 21 month(s) ago, # |   0 Just one thing, how to run the script? :p, I know I'm stupid but please can you help me ?
•  » » 21 month(s) ago, # ^ |   0 Save that code in something like "compress.py". Then put the script + the 2 png files in the same folder, go into the folder path using the terminal and run "Python3 compress.py". If the pics have the right sizes then the script will generate the pic.png file for you. Also, thank you cubelover for sharing this with us :).
 » 21 month(s) ago, # |   0 Thank you very much man this was the coolest trick of all times.P.S: can you use it on other websites like Facebook for example ?
 » 4 months ago, # | ← Rev. 2 →   0 -- edited --Oh well, I suppose this feature is not working anymore (at least for now.)
•  » » 4 months ago, # ^ |   -9 Lol it isn't working