New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iCMS V7.0.13 unzip vulnerability GET SHELL[CVE-2019-7160] #50

Closed
dbappxuji opened this Issue Jan 29, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@dbappxuji
Copy link

dbappxuji commented Jan 29, 2019

in files.admincp.php
public function do_IO(){ files::$watermark_enable = $_GET['watermark']; $udir = iSecurity::escapeStr($_GET['udir']); $name = iSecurity::escapeStr($_GET['name']); $ext = iSecurity::escapeStr($_GET['ext']); iFS::check_ext($ext,0) OR iUI::json(array('state'=>'ERROR','msg'=>'不允许的文件类型')); iFS::$ERROR_TYPE = true; $F = iFS::IO($name,$udir,$ext); $F ===false && iUI::json(iFS::$ERROR); iUI::json(array( "value" => $F["path"], "url" => iFS::fp($F['path'],'+http'), "fid" => $F["fid"], "fileType" => $F["ext"], "image" => in_array($F["ext"],files::$IMG_EXT)?1:0, "original" => $F["oname"], "state" => ($F['code']?'SUCCESS':$F['state']) )); }
and see the iFS.class.php
`public static function IO($FileName = '', $udir = '', $FileExt = 'jpg',$type='3',$filedata=null) {
$filedata===null && $filedata = file_get_contents('php://input');
if (empty($filedata)) {
return false;
}

	$fileMd5 = md5($filedata);
	$FileName OR $FileName = $fileMd5;
	$FileSize = strlen($filedata);
	$FileExt = self::valid_ext($FileName . "." . $FileExt); //判断文件类型
	if ($FileExt === false) {
		return false;
	}

	list($RootPath, $FileDir) = self::mk_udir($udir,$fileMd5,$FileExt); // 文件保存目录方式
	$FilePath = $FileDir . $FileName . "." . $FileExt;
	$FileRootPath = $RootPath . $FileName . "." . $FileExt;
	self::write($FileRootPath, $filedata);
	$fid = self::insert_filedata(array($FileName,'',$FileDir,'',$FileExt,$FileSize), $type);
	self::hook('upload',array($FileRootPath,$FileExt));
	$value = array(
		1,$fid,$fileMd5,$FileSize,
		'',$FileName,$FileName.".".$FileExt,
		$FileDir,$FileExt,
		$FileRootPath,$FilePath,$RootPath
	);
	return self::_data($value);
}`

so we can use ../ to write a package file to anyother folder in the server。
fitst use this request to write a package file with a php file in it
10
1
see apps.admincp.php
` public function do_local_app(){

  $zipfile = trim($_POST['zipfile']);
  print($zipfile);
  if(preg_match("/^iCMS\.APP\.(\w+)\-v\d+\.\d+\.\d+\.zip$/", $zipfile,$match)){
    apps_store::$zip_file = iPATH.$zipfile;
    apps_store::$msg_mode = 'alert';
    apps_store::install_app($match[1]);
    iUI::success('应用安装完成','js:1');
  }else{
    iUI::alert('What the fuck!!');
  }
}`

and than use this request to unzip this package
3
so we upload a php file
4

author by ji.xu@dbappsecurity.com.cn

@idreamsoft

This comment has been minimized.

Copy link
Owner

idreamsoft commented Jan 29, 2019

Thank you, we will fix it as soon as possible

@dbappxuji dbappxuji changed the title iCMS V7.0.13 unzip vulnerability GET SHELL iCMS V7.0.13 unzip vulnerability GET SHELL[CVE-2019-7160] Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment