-- [ ABOUT ME Francisco Alonso - ReverseSkills http://twitter.com/revskills Security researcher from Spain. *Nix lover & Hardware Hacking  ░▒▓ -- [ ABOUT SERVICE From Wikipedia : Twitter is a website, owned and operated by Twitter Inc., which offers a social networking and microblogging service, enabling its users to send and read other users' messages called tweets. Tweets are text-based posts of up to 140 characters displayed on the user's profile page. Tweets are publicly visible by default, however senders can restrict message delivery to their friends list. Users may subscribe to other users' tweets—this is known as following and subscribers are known as followers.[7] All users can send and receive tweets via the Twitter website, compatible external applications (such as for smartphones), or by Short Message Service (SMS) available in certain countries.[8] While the service is free, accessing it through SMS may incur phone service provider fees. The website is based in San Francisco, California. Twitter also has servers and offices in San Antonio, Texas and Boston, Massachusetts. -- [ DESCRIPTION OF THE VULNERABILITIES A security bug in user profiles, allows for the avatar upload files that are not really images, directly from the web form. When a user wants to change their profile picture, you can upload any image in three different formats JPG, PNG and GIF. To upload the image in any of the above three files are generated two different sizes for parts of the profile. If you try to upload a JPG and PNG image to be treated by the GD library, Twitter backend removes any extra content of the image and check the header correctly. This does not happen with the application that handles GIF files, enabling a user to upload content that is not really a GIF file by simply changing the header. Combined with the possibility of defining the form 'Content-type' of file you can upload content. Sent HTML and JavaScript (XSS, weaponized, etc) and binary content / executable to distribute Malware directly from Twitter's servers (Hosted on Akamai and Amazon S3) . Poc easier and less worrisome is this: http://a2.twimg.com/profile_images/1096102091/file.html  [HTML XSS] We could also play around with the image name filter rise. -[ form code Content-Disposition: form-data; name="profile_image[uploaded_data]"; filename="namefile"\r\nContent-Type: application/octet-stream\r\n\r\n\r This we can do to send the file in the form of the profile, adding a NOP (x: ö) to the filename. As the filter removed all the string "filename.html" but it was uploaded successfully.  http://a2.twimg.com/profile_images/xxxx/ For security reasons there has been no further evidence of this kind, but the possibility exists that the user could move a directory and overwrite after Twitter legitimate files or images from other profiles. -- Not tested, but I think it is entirely feasible.-- --[ IMPACT OF THE VULNERABILITIES - A malicious user can change their profile picture to target customers through either Twitter or access applications from the Web. - Can be used to distribute Malware in Twitter. - Technically it is possible to modify files within that legitimate Bucket (HTML, Javascript or  default profile images) --[ SOLUTIONS Improve image upload filter to allow file uploads correctly GIF, trying in all cases the images as a new and removing content is not validated in the file header. -- Done -- --[ TIMELINE 27/09/10 - Bug found 08/11/10 - Twitter has been notified 08/11/10 - Twitter answers (7 minutes) 16/11/10 - Twitter patched security flaw, it is not possible to use it. 28/11/10 - Published --[ CREDITS -A response time unmatched in Twitter security team, thanks to Bob Lord / http://twitter.com/boblord -Thanks to all the team http://www.securitybydefault.com / http://twitter.com/secbydefault _______________________________________________ Full-Disclosure - We believe in it. Charter: http://lists.grok.org.uk/full-disclosure-charter.html Hosted and sponsored by Secunia - http://secunia.com/